HHH-2394 Allowed usage of {alias} marker.
This commit is contained in:
parent
1cd8db2ac3
commit
542bc5c83c
|
@ -123,10 +123,12 @@ public class FilterHelper {
|
|||
|
||||
private String render(FilterAliasGenerator aliasGenerator, int filterIndex){
|
||||
Map<String,String> aliasTableMap = filterAliasTableMaps[filterIndex];
|
||||
String condition = filterConditions[filterIndex];
|
||||
if (filterAutoAliasFlags[filterIndex]){
|
||||
return StringHelper.replace(filterConditions[filterIndex], FilterImpl.MARKER, aliasGenerator.getAlias(aliasTableMap.get(null)));
|
||||
} else{
|
||||
String condition = filterConditions[filterIndex];
|
||||
return StringHelper.replace(condition, FilterImpl.MARKER, aliasGenerator.getAlias(aliasTableMap.get(null)));
|
||||
} else if (isTableFromPersistentClass(aliasTableMap)){
|
||||
return condition.replace("{alias}", aliasGenerator.getAlias(aliasTableMap.get(null)));
|
||||
} else {
|
||||
for (Map.Entry<String, String> entry : aliasTableMap.entrySet()){
|
||||
condition = condition.replace("{"+entry.getKey()+"}", aliasGenerator.getAlias(entry.getValue()));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.hibernate.annotations.ParamDef;
|
|||
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
|
||||
@Table(name="ZOOLOGY_ANIMAL")
|
||||
@FilterDef(name="ignoreSome", parameters={@ParamDef(name="name", type="string")})
|
||||
@Filter(name="ignoreSome", condition=":name <> ANIMAL_NAME")
|
||||
@Filter(name="ignoreSome", deduceAliasInjectionPoints=false, condition=":name <> {alias}.ANIMAL_NAME")
|
||||
public class Animal {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
|
|
Loading…
Reference in New Issue