-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
829657f
commit a4de0c0
Showing
4 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...6/descriptor/AbstractFunctionWithConfigurationAndTextQueryFunctionDescriptorRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.github.starnowski.posjsonhelper.text.hibernate6.descriptor; | ||
|
||
import com.github.starnowski.posjsonhelper.hibernate6.descriptor.AbstractConditionalFunctionDescriptorRegister; | ||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor; | ||
import org.hibernate.query.sqm.function.SqmFunctionRegistry; | ||
|
||
public abstract class AbstractFunctionWithConfigurationAndTextQueryFunctionDescriptorRegister<T extends AbstractFunctionWithConfigurationAndTextQueryFunctionDescriptor> extends AbstractConditionalFunctionDescriptorRegister { | ||
|
||
private final T descriptor; | ||
|
||
public AbstractFunctionWithConfigurationAndTextQueryFunctionDescriptorRegister(boolean shouldOverrideFunctionIfAlreadyRegistered, T descriptor) { | ||
super(shouldOverrideFunctionIfAlreadyRegistered); | ||
this.descriptor = descriptor; | ||
} | ||
|
||
@Override | ||
protected SqmFunctionDescriptor register(SqmFunctionRegistry registry) { | ||
return registry.register(getHqlFunctionName(), descriptor); | ||
} | ||
|
||
@Override | ||
protected String getHqlFunctionName() { | ||
return descriptor.getName(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...ki/posjsonhelper/text/hibernate6/descriptor/PlainToTSQueryFunctionDescriptorRegister.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.starnowski.posjsonhelper.text.hibernate6.descriptor; | ||
|
||
public class PlainToTSQueryFunctionDescriptorRegister extends AbstractFunctionWithConfigurationAndTextQueryFunctionDescriptorRegister<PlainToTSQueryFunctionDescriptor>{ | ||
public PlainToTSQueryFunctionDescriptorRegister(boolean shouldOverrideFunctionIfAlreadyRegistered) { | ||
super(shouldOverrideFunctionIfAlreadyRegistered, new PlainToTSQueryFunctionDescriptor()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...sonhelper/text/hibernate6/descriptor/PlainToTSQueryFunctionDescriptorRegisterFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.github.starnowski.posjsonhelper.text.hibernate6.descriptor; | ||
|
||
import com.github.starnowski.posjsonhelper.core.Context; | ||
import com.github.starnowski.posjsonhelper.core.HibernateContext; | ||
import com.github.starnowski.posjsonhelper.hibernate6.descriptor.FunctionDescriptorRegister; | ||
import com.github.starnowski.posjsonhelper.hibernate6.descriptor.FunctionDescriptorRegisterFactory; | ||
|
||
public class PlainToTSQueryFunctionDescriptorRegisterFactory implements FunctionDescriptorRegisterFactory { | ||
@Override | ||
public FunctionDescriptorRegister get(Context context, HibernateContext hibernateContext) { | ||
return new PlainToTSQueryFunctionDescriptorRegister(true); | ||
} | ||
} |