HHH-2394 Got filters working on sub-classes.
This commit is contained in:
parent
1d2877838b
commit
dbff4c1839
|
@ -1297,7 +1297,7 @@ public abstract class CollectionBinder {
|
||||||
|
|
||||||
private static void checkFilterConditions(Collection collValue) {
|
private static void checkFilterConditions(Collection collValue) {
|
||||||
//for now it can't happen, but sometime soon...
|
//for now it can't happen, but sometime soon...
|
||||||
if ( ( collValue.getFilterMap().size() != 0 || StringHelper.isNotEmpty( collValue.getWhere() ) ) &&
|
if ( ( collValue.getFilters().size() != 0 || StringHelper.isNotEmpty( collValue.getWhere() ) ) &&
|
||||||
collValue.getFetchMode() == FetchMode.JOIN &&
|
collValue.getFetchMode() == FetchMode.JOIN &&
|
||||||
!( collValue.getElement() instanceof SimpleValue ) && //SimpleValue (CollectionOfElements) are always SELECT but it does not matter
|
!( collValue.getElement() instanceof SimpleValue ) && //SimpleValue (CollectionOfElements) are always SELECT but it does not matter
|
||||||
collValue.getElement().getFetchMode() != FetchMode.JOIN ) {
|
collValue.getElement().getFetchMode() != FetchMode.JOIN ) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.internal;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rob Worsnop
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface FilterAliasGenerator {
|
||||||
|
String getAlias(String table);
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.internal;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rob Worsnop
|
||||||
|
*/
|
||||||
|
public abstract class FilterConfiguration {
|
||||||
|
private final String name;
|
||||||
|
private final String condition;
|
||||||
|
|
||||||
|
protected FilterConfiguration(String name, String condition) {
|
||||||
|
this.name = name;
|
||||||
|
this.condition = condition;
|
||||||
|
}
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public String getCondition() {
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
public abstract String getQualifiedTableName(SessionFactoryImplementor factory);
|
||||||
|
|
||||||
|
}
|
|
@ -25,22 +25,27 @@
|
||||||
package org.hibernate.internal;
|
package org.hibernate.internal;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.sql.Template;
|
import org.hibernate.sql.Template;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of FilterHelper.
|
* Implementation of FilterHelper.
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
* @author Rob Worsnop
|
||||||
*/
|
*/
|
||||||
public class FilterHelper {
|
public class FilterHelper {
|
||||||
|
|
||||||
private final String[] filterNames;
|
private final String[] filterNames;
|
||||||
private final String[] filterConditions;
|
private final String[] filterConditions;
|
||||||
|
private final String[] filterTables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The map of defined filters. This is expected to be in format
|
* The map of defined filters. This is expected to be in format
|
||||||
|
@ -49,28 +54,30 @@ public class FilterHelper {
|
||||||
*
|
*
|
||||||
* @param filters The map of defined filters.
|
* @param filters The map of defined filters.
|
||||||
* @param dialect The sql dialect
|
* @param dialect The sql dialect
|
||||||
* @param functionRegistry The SQL function registry
|
* @param factory The session factory
|
||||||
*/
|
*/
|
||||||
public FilterHelper(Map filters, Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
public FilterHelper(List filters, Dialect dialect, SessionFactoryImplementor factory) {
|
||||||
int filterCount = filters.size();
|
int filterCount = filters.size();
|
||||||
filterNames = new String[filterCount];
|
filterNames = new String[filterCount];
|
||||||
filterConditions = new String[filterCount];
|
filterConditions = new String[filterCount];
|
||||||
Iterator iter = filters.entrySet().iterator();
|
filterTables = new String[filterCount];
|
||||||
|
Iterator iter = filters.iterator();
|
||||||
filterCount = 0;
|
filterCount = 0;
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
final Map.Entry entry = (Map.Entry) iter.next();
|
final FilterConfiguration filter = (FilterConfiguration) iter.next();
|
||||||
filterNames[filterCount] = (String) entry.getKey();
|
filterNames[filterCount] = (String) filter.getName();
|
||||||
filterConditions[filterCount] = Template.renderWhereStringTemplate(
|
filterConditions[filterCount] = Template.renderWhereStringTemplate(
|
||||||
(String) entry.getValue(),
|
filter.getCondition(),
|
||||||
FilterImpl.MARKER,
|
FilterImpl.MARKER,
|
||||||
dialect,
|
dialect,
|
||||||
functionRegistry
|
factory.getSqlFunctionRegistry()
|
||||||
);
|
);
|
||||||
filterConditions[filterCount] = StringHelper.replace(
|
filterConditions[filterCount] = StringHelper.replace(
|
||||||
filterConditions[filterCount],
|
filterConditions[filterCount],
|
||||||
":",
|
":",
|
||||||
":" + filterNames[filterCount] + "."
|
":" + filterNames[filterCount] + "."
|
||||||
);
|
);
|
||||||
|
filterTables[filterCount] = filter.getQualifiedTableName(factory);
|
||||||
filterCount++;
|
filterCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,20 +91,20 @@ public class FilterHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String render(String alias, Map enabledFilters) {
|
public String render(FilterAliasGenerator aliasGenerator, Map enabledFilters) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
render( buffer, alias, enabledFilters );
|
render( buffer, aliasGenerator, enabledFilters );
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(StringBuilder buffer, String alias, Map enabledFilters) {
|
public void render(StringBuilder buffer, FilterAliasGenerator aliasGenerator, Map enabledFilters) {
|
||||||
if ( filterNames != null && filterNames.length > 0 ) {
|
if ( filterNames != null && filterNames.length > 0 ) {
|
||||||
for ( int i = 0, max = filterNames.length; i < max; i++ ) {
|
for ( int i = 0, max = filterNames.length; i < max; i++ ) {
|
||||||
if ( enabledFilters.containsKey( filterNames[i] ) ) {
|
if ( enabledFilters.containsKey( filterNames[i] ) ) {
|
||||||
final String condition = filterConditions[i];
|
final String condition = filterConditions[i];
|
||||||
if ( StringHelper.isNotEmpty( condition ) ) {
|
if ( StringHelper.isNotEmpty( condition ) ) {
|
||||||
buffer.append( " and " )
|
buffer.append( " and " )
|
||||||
.append( StringHelper.replace( condition, FilterImpl.MARKER, alias ) );
|
.append( StringHelper.replace( condition, FilterImpl.MARKER, aliasGenerator.getAlias(filterTables[i]) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.internal;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
import org.hibernate.mapping.PersistentClass;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rob Worsnop
|
||||||
|
*/
|
||||||
|
public class PersistentClassFilterConfiguration extends FilterConfiguration {
|
||||||
|
|
||||||
|
private final PersistentClass persistentClass;
|
||||||
|
|
||||||
|
public PersistentClassFilterConfiguration(String name, PersistentClass persistentClass, String condition) {
|
||||||
|
super(name, condition);
|
||||||
|
this.persistentClass = persistentClass;;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQualifiedTableName(SessionFactoryImplementor factory) {
|
||||||
|
return persistentClass.getTable().getQualifiedName(factory.getDialect(),
|
||||||
|
factory.getSettings().getDefaultCatalogName(),
|
||||||
|
factory.getSettings().getDefaultSchemaName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.internal;
|
||||||
|
|
||||||
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rob Worsnop
|
||||||
|
*/
|
||||||
|
public class QualifiedTableNameFilterConfiguration extends FilterConfiguration {
|
||||||
|
|
||||||
|
private final String tableName;
|
||||||
|
|
||||||
|
public QualifiedTableNameFilterConfiguration(String name, String tableName, String condition) {
|
||||||
|
super(name, condition);
|
||||||
|
this.tableName = tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQualifiedTableName(SessionFactoryImplementor factory) {
|
||||||
|
return tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.internal;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rob Worsnop
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class StaticFilterAliasGenerator implements FilterAliasGenerator{
|
||||||
|
|
||||||
|
private final String alias;
|
||||||
|
|
||||||
|
public StaticFilterAliasGenerator(String alias) {
|
||||||
|
this.alias = alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAlias(String table) {
|
||||||
|
return alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -33,6 +34,8 @@ import org.hibernate.MappingException;
|
||||||
import org.hibernate.cfg.Mappings;
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
|
import org.hibernate.internal.FilterConfiguration;
|
||||||
|
import org.hibernate.internal.QualifiedTableNameFilterConfiguration;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||||
|
@ -81,8 +84,8 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
private Class collectionPersisterClass;
|
private Class collectionPersisterClass;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
private Properties typeParameters;
|
private Properties typeParameters;
|
||||||
private final java.util.Map filters = new HashMap();
|
private final java.util.List filters = new ArrayList();
|
||||||
private final java.util.Map manyToManyFilters = new HashMap();
|
private final java.util.List manyToManyFilters = new ArrayList();
|
||||||
private final java.util.Set synchronizedTables = new HashSet();
|
private final java.util.Set synchronizedTables = new HashSet();
|
||||||
|
|
||||||
private String customSQLInsert;
|
private String customSQLInsert;
|
||||||
|
@ -520,18 +523,30 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilter(String name, String condition) {
|
public void addFilter(String name, String condition) {
|
||||||
filters.put( name, condition );
|
filters.add(toFilterConfiguration(name, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.Map getFilterMap() {
|
public java.util.List getFilters() {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addManyToManyFilter(String name, String condition) {
|
public void addManyToManyFilter(String name, String condition) {
|
||||||
manyToManyFilters.put( name, condition );
|
manyToManyFilters.add(toFilterConfiguration(name, condition));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static FilterConfiguration toFilterConfiguration(String name, String condition){
|
||||||
|
String tableName = null;
|
||||||
|
String actualCondition = condition;
|
||||||
|
int pos = condition.lastIndexOf('.');
|
||||||
|
if (pos > -1){
|
||||||
|
tableName = condition.substring(0, pos);
|
||||||
|
actualCondition = condition.substring(pos+1);
|
||||||
|
}
|
||||||
|
return new QualifiedTableNameFilterConfiguration(name, tableName, actualCondition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.Map getManyToManyFilterMap() {
|
|
||||||
|
public java.util.List getManyToManyFilters() {
|
||||||
return manyToManyFilters;
|
return manyToManyFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,5 +32,5 @@ package org.hibernate.mapping;
|
||||||
public interface Filterable {
|
public interface Filterable {
|
||||||
public void addFilter(String name, String condition);
|
public void addFilter(String name, String condition);
|
||||||
|
|
||||||
public java.util.Map getFilterMap();
|
public java.util.List getFilters();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ import org.hibernate.MappingException;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
|
import org.hibernate.internal.FilterConfiguration;
|
||||||
|
import org.hibernate.internal.PersistentClassFilterConfiguration;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
import org.hibernate.internal.util.ReflectHelper;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.internal.util.collections.EmptyIterator;
|
import org.hibernate.internal.util.collections.EmptyIterator;
|
||||||
|
@ -76,7 +78,7 @@ public abstract class PersistentClass implements Serializable, Filterable, MetaA
|
||||||
private java.util.Map metaAttributes;
|
private java.util.Map metaAttributes;
|
||||||
private ArrayList joins = new ArrayList();
|
private ArrayList joins = new ArrayList();
|
||||||
private final ArrayList subclassJoins = new ArrayList();
|
private final ArrayList subclassJoins = new ArrayList();
|
||||||
private final java.util.Map filters = new HashMap();
|
private final java.util.List filters = new ArrayList();
|
||||||
protected final java.util.Set synchronizedTables = new HashSet();
|
protected final java.util.Set synchronizedTables = new HashSet();
|
||||||
private String loaderName;
|
private String loaderName;
|
||||||
private Boolean isAbstract;
|
private Boolean isAbstract;
|
||||||
|
@ -636,10 +638,10 @@ public abstract class PersistentClass implements Serializable, Filterable, MetaA
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilter(String name, String condition) {
|
public void addFilter(String name, String condition) {
|
||||||
filters.put(name, condition);
|
filters.add(new PersistentClassFilterConfiguration(name, this, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.util.Map getFilterMap() {
|
public java.util.List getFilters() {
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -254,8 +255,10 @@ public class Subclass extends PersistentClass {
|
||||||
return mv.accept(this);
|
return mv.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getFilterMap() {
|
public java.util.List getFilters() {
|
||||||
return getSuperclass().getFilterMap();
|
java.util.List filters = new ArrayList(super.getFilters());
|
||||||
|
filters.addAll(getSuperclass().getFilters());
|
||||||
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSubselectLoadableCollections() {
|
public boolean hasSubselectLoadableCollections() {
|
||||||
|
|
|
@ -62,7 +62,9 @@ import org.hibernate.engine.spi.SubselectFetch;
|
||||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.internal.FilterHelper;
|
import org.hibernate.internal.FilterHelper;
|
||||||
|
import org.hibernate.internal.StaticFilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
|
@ -573,10 +575,10 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle any filters applied to this collection
|
// Handle any filters applied to this collection
|
||||||
filterHelper = new FilterHelper( collection.getFilterMap(), dialect, factory.getSqlFunctionRegistry() );
|
filterHelper = new FilterHelper( collection.getFilters(), dialect, factory);
|
||||||
|
|
||||||
// Handle any filters applied to this collection for many-to-many
|
// Handle any filters applied to this collection for many-to-many
|
||||||
manyToManyFilterHelper = new FilterHelper( collection.getManyToManyFilterMap(), dialect, factory.getSqlFunctionRegistry() );
|
manyToManyFilterHelper = new FilterHelper( collection.getManyToManyFilters(), dialect, factory);
|
||||||
manyToManyWhereString = StringHelper.isNotEmpty( collection.getManyToManyWhere() ) ?
|
manyToManyWhereString = StringHelper.isNotEmpty( collection.getManyToManyWhere() ) ?
|
||||||
"( " + collection.getManyToManyWhere() + ")" :
|
"( " + collection.getManyToManyWhere() + ")" :
|
||||||
null;
|
null;
|
||||||
|
@ -1544,7 +1546,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
public String getManyToManyFilterFragment(String alias, Map enabledFilters) {
|
public String getManyToManyFilterFragment(String alias, Map enabledFilters) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
manyToManyFilterHelper.render( buffer, alias, enabledFilters );
|
manyToManyFilterHelper.render( buffer, elementPersister.getFilterAliasGenerator(alias), enabledFilters );
|
||||||
|
|
||||||
if ( manyToManyWhereString != null ) {
|
if ( manyToManyWhereString != null ) {
|
||||||
buffer.append( " and " )
|
buffer.append( " and " )
|
||||||
|
@ -1649,7 +1651,7 @@ public abstract class AbstractCollectionPersister
|
||||||
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
||||||
|
|
||||||
StringBuilder sessionFilterFragment = new StringBuilder();
|
StringBuilder sessionFilterFragment = new StringBuilder();
|
||||||
filterHelper.render( sessionFilterFragment, alias, enabledFilters );
|
filterHelper.render( sessionFilterFragment, getFilterAliasGenerator(alias), enabledFilters );
|
||||||
|
|
||||||
return sessionFilterFragment.append( filterFragment( alias ) ).toString();
|
return sessionFilterFragment.append( filterFragment( alias ) ).toString();
|
||||||
}
|
}
|
||||||
|
@ -1929,4 +1931,6 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.SubselectFetch;
|
import org.hibernate.engine.spi.SubselectFetch;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
|
import org.hibernate.internal.StaticFilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.jdbc.Expectations;
|
import org.hibernate.jdbc.Expectations;
|
||||||
|
@ -354,4 +356,9 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
|
||||||
|
return new StaticFilterAliasGenerator(rootAlias);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.SubselectFetch;
|
import org.hibernate.engine.spi.SubselectFetch;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
import org.hibernate.jdbc.Expectations;
|
import org.hibernate.jdbc.Expectations;
|
||||||
|
@ -407,4 +408,9 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
.loadElement( session, key, incrementIndexByBase(index) );
|
.loadElement( session, key, incrementIndexByBase(index) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
|
||||||
|
return getElementPersister().getFilterAliasGenerator(rootAlias);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
|
|
||||||
import org.hibernate.AssertionFailure;
|
import org.hibernate.AssertionFailure;
|
||||||
import org.hibernate.EntityMode;
|
import org.hibernate.EntityMode;
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
|
@ -73,7 +71,6 @@ import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||||
import org.hibernate.engine.spi.FilterDefinition;
|
import org.hibernate.engine.spi.FilterDefinition;
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.engine.spi.PersistenceContext;
|
|
||||||
import org.hibernate.engine.spi.PersistenceContext.NaturalIdHelper;
|
import org.hibernate.engine.spi.PersistenceContext.NaturalIdHelper;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
|
@ -84,7 +81,11 @@ import org.hibernate.id.PostInsertIdentityPersister;
|
||||||
import org.hibernate.id.insert.Binder;
|
import org.hibernate.id.insert.Binder;
|
||||||
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
|
import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
|
import org.hibernate.internal.FilterConfiguration;
|
||||||
import org.hibernate.internal.FilterHelper;
|
import org.hibernate.internal.FilterHelper;
|
||||||
|
import org.hibernate.internal.StaticFilterAliasGenerator;
|
||||||
|
import org.hibernate.internal.PersistentClassFilterConfiguration;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.jdbc.Expectation;
|
import org.hibernate.jdbc.Expectation;
|
||||||
|
@ -99,6 +100,7 @@ import org.hibernate.mapping.Component;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.Selectable;
|
import org.hibernate.mapping.Selectable;
|
||||||
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.metadata.ClassMetadata;
|
import org.hibernate.metadata.ClassMetadata;
|
||||||
import org.hibernate.metamodel.binding.AssociationAttributeBinding;
|
import org.hibernate.metamodel.binding.AssociationAttributeBinding;
|
||||||
import org.hibernate.metamodel.binding.AttributeBinding;
|
import org.hibernate.metamodel.binding.AttributeBinding;
|
||||||
|
@ -127,6 +129,7 @@ import org.hibernate.type.EntityType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeHelper;
|
import org.hibernate.type.TypeHelper;
|
||||||
import org.hibernate.type.VersionType;
|
import org.hibernate.type.VersionType;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic functionality for persisting an entity via JDBC
|
* Basic functionality for persisting an entity via JDBC
|
||||||
|
@ -767,7 +770,7 @@ public abstract class AbstractEntityPersister
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle any filters applied to the class level
|
// Handle any filters applied to the class level
|
||||||
filterHelper = new FilterHelper( persistentClass.getFilterMap(), factory.getDialect(), factory.getSqlFunctionRegistry() );
|
filterHelper = new FilterHelper( persistentClass.getFilters(), factory.getDialect(), factory );
|
||||||
|
|
||||||
temporaryIdTableName = persistentClass.getTemporaryIdTableName();
|
temporaryIdTableName = persistentClass.getTemporaryIdTableName();
|
||||||
temporaryIdTableDDL = persistentClass.getTemporaryIdTableDDL();
|
temporaryIdTableDDL = persistentClass.getTemporaryIdTableDDL();
|
||||||
|
@ -1086,11 +1089,13 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
propertyDefinedOnSubclass = ArrayHelper.toBooleanArray( definedBySubclass );
|
propertyDefinedOnSubclass = ArrayHelper.toBooleanArray( definedBySubclass );
|
||||||
|
|
||||||
Map<String, String> filterDefaultConditionsByName = new HashMap<String, String>();
|
List<FilterConfiguration> filterDefaultConditions = new ArrayList<FilterConfiguration>();
|
||||||
for ( FilterDefinition filterDefinition : entityBinding.getFilterDefinitions() ) {
|
for ( FilterDefinition filterDefinition : entityBinding.getFilterDefinitions() ) {
|
||||||
filterDefaultConditionsByName.put( filterDefinition.getFilterName(), filterDefinition.getDefaultFilterCondition() );
|
filterDefaultConditions.add(new PersistentClassFilterConfiguration(filterDefinition.getFilterName(),
|
||||||
|
null,
|
||||||
|
filterDefinition.getDefaultFilterCondition()));
|
||||||
}
|
}
|
||||||
filterHelper = new FilterHelper( filterDefaultConditionsByName, factory.getDialect(), factory.getSqlFunctionRegistry() );
|
filterHelper = new FilterHelper( filterDefaultConditions, factory.getDialect(), factory);
|
||||||
|
|
||||||
temporaryIdTableName = null;
|
temporaryIdTableName = null;
|
||||||
temporaryIdTableDDL = null;
|
temporaryIdTableDDL = null;
|
||||||
|
@ -3416,8 +3421,7 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
||||||
final StringBuilder sessionFilterFragment = new StringBuilder();
|
final StringBuilder sessionFilterFragment = new StringBuilder();
|
||||||
filterHelper.render( sessionFilterFragment, generateFilterConditionAlias( alias ), enabledFilters );
|
filterHelper.render( sessionFilterFragment, getFilterAliasGenerator(alias), enabledFilters );
|
||||||
|
|
||||||
return sessionFilterFragment.append( filterFragment( alias ) ).toString();
|
return sessionFilterFragment.append( filterFragment( alias ) ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4734,6 +4738,10 @@ public abstract class AbstractEntityPersister
|
||||||
public void setPropertyValue(Object object, String propertyName, Object value) {
|
public void setPropertyValue(Object object, String propertyName, Object value) {
|
||||||
getEntityTuplizer().setPropertyValue( object, propertyName, value );
|
getEntityTuplizer().setPropertyValue( object, propertyName, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias){
|
||||||
|
return new StaticFilterAliasGenerator(rootAlias);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityMode getEntityMode() {
|
public EntityMode getEntityMode() {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.ValueInclusion;
|
import org.hibernate.engine.spi.ValueInclusion;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.metadata.ClassMetadata;
|
import org.hibernate.metadata.ClassMetadata;
|
||||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||||
import org.hibernate.tuple.entity.EntityTuplizer;
|
import org.hibernate.tuple.entity.EntityTuplizer;
|
||||||
|
@ -747,4 +748,6 @@ public interface EntityPersister extends OptimisticCacheSource {
|
||||||
public EntityTuplizer getEntityTuplizer();
|
public EntityTuplizer getEntityTuplizer();
|
||||||
|
|
||||||
public EntityInstrumentationMetadata getInstrumentationMetadata();
|
public EntityInstrumentationMetadata getInstrumentationMetadata();
|
||||||
|
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.hibernate.engine.OptimisticLockStyle;
|
||||||
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
||||||
import org.hibernate.engine.spi.Mapping;
|
import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
import org.hibernate.mapping.Join;
|
import org.hibernate.mapping.Join;
|
||||||
|
@ -835,7 +836,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
|
|
||||||
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
|
public Declarer getSubclassPropertyDeclarer(String propertyPath) {
|
||||||
if ( "class".equals( propertyPath ) ) {
|
if ( "class".equals( propertyPath ) ) {
|
||||||
// special case where we need to force incloude all subclass joins
|
// special case where we need to force include all subclass joins
|
||||||
return Declarer.SUBCLASS;
|
return Declarer.SUBCLASS;
|
||||||
}
|
}
|
||||||
return super.getSubclassPropertyDeclarer( propertyPath );
|
return super.getSubclassPropertyDeclarer( propertyPath );
|
||||||
|
@ -860,4 +861,19 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
}
|
}
|
||||||
throw new HibernateException( "Could not locate table which owns column [" + columnName + "] referenced in order-by mapping" );
|
throw new HibernateException( "Could not locate table which owns column [" + columnName + "] referenced in order-by mapping" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(final String rootAlias) {
|
||||||
|
return new FilterAliasGenerator() {
|
||||||
|
@Override
|
||||||
|
public String getAlias(String table) {
|
||||||
|
if (table == null){
|
||||||
|
return rootAlias;
|
||||||
|
} else{
|
||||||
|
JoinedSubclassEntityPersister outer = JoinedSubclassEntityPersister.this;
|
||||||
|
int tableNumber = JoinedSubclassEntityPersister.getTableId(table, outer.subclassTableNameClosure);
|
||||||
|
return outer.generateTableAlias(rootAlias, tableNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -818,6 +818,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
||||||
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
||||||
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
||||||
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
||||||
|
<xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
|
||||||
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
||||||
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
||||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
@ -1586,6 +1587,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
||||||
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
||||||
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
||||||
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
||||||
|
<xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
|
||||||
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
||||||
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
||||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
@ -1670,6 +1672,7 @@ arbitrary number of queries, and import declarations of arbitrary classes.
|
||||||
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
<xs:element name="sql-insert" minOccurs="0" type="sql-insert-element"/>
|
||||||
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
<xs:element name="sql-update" minOccurs="0" type="sql-update-element"/>
|
||||||
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
<xs:element name="sql-delete" minOccurs="0" type="sql-delete-element"/>
|
||||||
|
<xs:element name="filter" minOccurs="0" maxOccurs="unbounded" type="filter-element"/>
|
||||||
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
<xs:element name="fetch-profile" minOccurs="0" maxOccurs="unbounded" type="fetch-profile-element"/>
|
||||||
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
<xs:element name="resultset" minOccurs="0" maxOccurs="unbounded" type="resultset-element"/>
|
||||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.ValueInclusion;
|
import org.hibernate.engine.spi.ValueInclusion;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.mapping.Collection;
|
import org.hibernate.mapping.Collection;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.metadata.ClassMetadata;
|
import org.hibernate.metadata.ClassMetadata;
|
||||||
|
@ -560,6 +561,12 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
|
||||||
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory) {
|
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class NoopCollectionPersister implements CollectionPersister {
|
public static class NoopCollectionPersister implements CollectionPersister {
|
||||||
|
|
|
@ -26,6 +26,8 @@ import org.hibernate.event.spi.PostLoadEvent;
|
||||||
import org.hibernate.event.spi.PreLoadEvent;
|
import org.hibernate.event.spi.PreLoadEvent;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
import org.hibernate.id.UUIDHexGenerator;
|
import org.hibernate.id.UUIDHexGenerator;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
|
import org.hibernate.internal.StaticFilterAliasGenerator;
|
||||||
import org.hibernate.internal.util.compare.EqualsHelper;
|
import org.hibernate.internal.util.compare.EqualsHelper;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.metadata.ClassMetadata;
|
import org.hibernate.metadata.ClassMetadata;
|
||||||
|
@ -644,4 +646,9 @@ public class CustomPersister implements EntityPersister {
|
||||||
public EntityInstrumentationMetadata getInstrumentationMetadata() {
|
public EntityInstrumentationMetadata getInstrumentationMetadata() {
|
||||||
return new NonPojoInstrumentationMetadata( getEntityName() );
|
return new NonPojoInstrumentationMetadata( getEntityName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
|
||||||
|
return new StaticFilterAliasGenerator(rootAlias);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.engine.spi.ValueInclusion;
|
import org.hibernate.engine.spi.ValueInclusion;
|
||||||
import org.hibernate.id.IdentifierGenerator;
|
import org.hibernate.id.IdentifierGenerator;
|
||||||
|
import org.hibernate.internal.FilterAliasGenerator;
|
||||||
import org.hibernate.mapping.Collection;
|
import org.hibernate.mapping.Collection;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.metadata.ClassMetadata;
|
import org.hibernate.metadata.ClassMetadata;
|
||||||
|
@ -582,6 +583,11 @@ public class PersisterClassProviderTest {
|
||||||
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory) {
|
public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class GoofyException extends RuntimeException {
|
public static class GoofyException extends RuntimeException {
|
||||||
|
|
Loading…
Reference in New Issue