Skip to content

Commit

Permalink
#116 - Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
starnowski committed Mar 10, 2024
1 parent ac24cf9 commit 03faf8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ public static ContextBuilder builder() {

/**
* Returns copy of value of property {@link #functionsThatShouldBeExecutedWithSchemaReference}.
* If {@link #functionsThatShouldBeExecutedWithSchemaReference} is null then the empty set is being returned.
*
* @return copy of value of property {@link #functionsThatShouldBeExecutedWithSchemaReference}
*/
public Set<String> getFunctionsThatShouldBeExecutedWithSchemaReference() {
return functionsThatShouldBeExecutedWithSchemaReference == null ? new HashSet<>() : new HashSet<>(functionsThatShouldBeExecutedWithSchemaReference);
return functionsThatShouldBeExecutedWithSchemaReference == null ? null : new HashSet<>(functionsThatShouldBeExecutedWithSchemaReference);
}

/**
Expand Down Expand Up @@ -116,7 +115,8 @@ public ContextBuilder withFunctionsThatShouldBeExecutedWithSchemaReference(Set<S
public ContextBuilder withContext(Context context) {
return withJsonbAllArrayStringsExistFunctionReference(context.getJsonbAllArrayStringsExistFunctionReference())
.withJsonbAnyArrayStringsExistFunctionReference(context.getJsonbAnyArrayStringsExistFunctionReference())
.withSchema(context.getSchema());
.withSchema(context.getSchema())
.withFunctionsThatShouldBeExecutedWithSchemaReference(context.getFunctionsThatShouldBeExecutedWithSchemaReference());
}

public ContextBuilder withSchema(String schema) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class NamedSqmFunctionWithSchemaReferenceDescriptor extends NamedSqmFunct

protected final HibernateContext hibernateContext;
protected final Context context;

public NamedSqmFunctionWithSchemaReferenceDescriptor(String functionName, Context context, HibernateContext hibernateContext) {
super(functionName, false, null, null);
this.context = context;
Expand Down Expand Up @@ -46,8 +47,8 @@ public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> sqlAstArg
super.render(sqlAppender, sqlAstArguments, filter, respectNulls, fromFirst, returnType, walker);
}

protected void renderOptionalSchemaReference(SqlAppender sqlAppender){
if (context.getFunctionsThatShouldBeExecutedWithSchemaReference().contains(getName())) {
protected void renderOptionalSchemaReference(SqlAppender sqlAppender) {
if (context.getFunctionsThatShouldBeExecutedWithSchemaReference() != null && context.getFunctionsThatShouldBeExecutedWithSchemaReference().contains(getName())) {
sqlAppender.appendSql(context.getSchema());
sqlAppender.appendSql(".");
}
Expand Down

0 comments on commit 03faf8e

Please sign in to comment.