cleanup lots of warnings, especially generics-related
This commit is contained in:
parent
d193a9409a
commit
3c72f6fe12
|
@ -88,7 +88,7 @@ import org.hibernate.mapping.Table;
|
|||
import org.hibernate.mapping.TableOwner;
|
||||
import org.hibernate.mapping.Value;
|
||||
|
||||
import org.hibernate.tuple.Tuplizer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static org.hibernate.cfg.BinderHelper.toAliasEntityMap;
|
||||
|
@ -305,7 +305,7 @@ public class EntityBinder {
|
|||
//set persister if needed
|
||||
Persister persisterAnn = annotatedClass.getAnnotation( Persister.class );
|
||||
if ( persisterAnn != null ) {
|
||||
Class persister = persisterAnn.impl();
|
||||
Class<? extends EntityPersister> persister = (Class<? extends EntityPersister>) persisterAnn.impl();
|
||||
persistentClass.setEntityPersisterClass( persister );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.event.internal;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
|
|
|
@ -75,33 +75,33 @@ public final class ArrayHelper {
|
|||
return array;
|
||||
}
|
||||
|
||||
public static String[] toStringArray(Collection coll) {
|
||||
return (String[]) coll.toArray( new String[coll.size()] );
|
||||
public static String[] toStringArray(Collection<String> coll) {
|
||||
return coll.toArray( EMPTY_STRING_ARRAY );
|
||||
}
|
||||
|
||||
public static String[][] to2DStringArray(Collection coll) {
|
||||
return (String[][]) coll.toArray( new String[coll.size()][] );
|
||||
public static String[][] to2DStringArray(Collection<String[]> coll) {
|
||||
return coll.toArray( new String[0][] );
|
||||
}
|
||||
|
||||
public static int[][] to2DIntArray(Collection coll) {
|
||||
return (int[][]) coll.toArray( new int[coll.size()][] );
|
||||
public static int[][] to2DIntArray(Collection<int[]> coll) {
|
||||
return coll.toArray( new int[0][] );
|
||||
}
|
||||
|
||||
public static Type[] toTypeArray(Collection coll) {
|
||||
return (Type[]) coll.toArray( new Type[coll.size()] );
|
||||
public static Type[] toTypeArray(Collection<Type> coll) {
|
||||
return coll.toArray( EMPTY_TYPE_ARRAY );
|
||||
}
|
||||
|
||||
public static int[] toIntArray(Collection coll) {
|
||||
Iterator iter = coll.iterator();
|
||||
public static int[] toIntArray(Collection<Integer> coll) {
|
||||
Iterator<Integer> iter = coll.iterator();
|
||||
int[] arr = new int[coll.size()];
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
arr[i++] = (Integer) iter.next();
|
||||
arr[i++] = iter.next();
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static boolean[] toBooleanArray(Collection coll) {
|
||||
public static boolean[] toBooleanArray(Collection<Boolean> coll) {
|
||||
Iterator iter = coll.iterator();
|
||||
boolean[] arr = new boolean[coll.size()];
|
||||
int i = 0;
|
||||
|
|
|
@ -19,18 +19,18 @@ import java.util.List;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JoinedIterator<T> implements Iterator<T> {
|
||||
private Iterator<T>[] wrappedIterators;
|
||||
private final Iterator<? extends T>[] wrappedIterators;
|
||||
|
||||
private int currentIteratorIndex;
|
||||
private Iterator<T> currentIterator;
|
||||
private Iterator<T> lastUsedIterator;
|
||||
private Iterator<? extends T> currentIterator;
|
||||
private Iterator<? extends T> lastUsedIterator;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public JoinedIterator(List<Iterator<T>> wrappedIterators) {
|
||||
this( wrappedIterators.toArray( new Iterator[ wrappedIterators.size() ]) );
|
||||
this( wrappedIterators.toArray(new Iterator[0]) );
|
||||
}
|
||||
|
||||
public JoinedIterator(Iterator<T>... iteratorsToWrap) {
|
||||
public JoinedIterator(Iterator<? extends T>... iteratorsToWrap) {
|
||||
if( iteratorsToWrap == null ) {
|
||||
throw new NullPointerException( "Iterators to join were null" );
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class JoinedIterator<T> implements Iterator<T> {
|
|||
protected void updateCurrentIterator() {
|
||||
if ( currentIterator == null ) {
|
||||
if( wrappedIterators.length == 0 ) {
|
||||
currentIterator = Collections.<T>emptyList().iterator();
|
||||
currentIterator = Collections.emptyIterator();
|
||||
}
|
||||
else {
|
||||
currentIterator = wrappedIterators[0];
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.hibernate.sql.ast.Clause;
|
|||
import org.hibernate.sql.ast.SqlAstTranslatorFactory;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBaseManager;
|
||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
||||
import org.hibernate.sql.ast.tree.expression.JdbcParameter;
|
||||
import org.hibernate.sql.ast.tree.expression.QueryLiteral;
|
||||
|
@ -61,7 +60,6 @@ class DatabaseSnapshotExecutor {
|
|||
private static final Logger log = Logger.getLogger( DatabaseSnapshotExecutor.class );
|
||||
|
||||
private final EntityMappingType entityDescriptor;
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
|
||||
private final JdbcSelect jdbcSelect;
|
||||
private final List<JdbcParameter> jdbcParameters;
|
||||
|
@ -70,7 +68,6 @@ class DatabaseSnapshotExecutor {
|
|||
EntityMappingType entityDescriptor,
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
this.entityDescriptor = entityDescriptor;
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.jdbcParameters = new ArrayList<>(
|
||||
entityDescriptor.getIdentifierMapping().getJdbcTypeCount()
|
||||
);
|
||||
|
@ -170,7 +167,7 @@ class DatabaseSnapshotExecutor {
|
|||
// TODO: Instead use a delayed collection result? Or will we remove this when redesigning this
|
||||
//noinspection unchecked
|
||||
domainResults.add(
|
||||
new BasicResult<Object>(
|
||||
new BasicResult(
|
||||
0,
|
||||
null,
|
||||
contributorMapping.getJavaTypeDescriptor()
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
|
||||
import org.hibernate.internal.FilterConfiguration;
|
||||
|
||||
/**
|
||||
* Defines mapping elements to which filters may be applied.
|
||||
*
|
||||
|
@ -15,5 +17,5 @@ package org.hibernate.mapping;
|
|||
public interface Filterable {
|
||||
public void addFilter(String name, String condition, boolean autoAliasInjection, java.util.Map<String,String> aliasTableMap, java.util.Map<String,String> aliasEntityMap);
|
||||
|
||||
public java.util.List getFilters();
|
||||
public java.util.List<FilterConfiguration> getFilters();
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ public class Join implements AttributeContainer, Serializable {
|
|||
|
||||
private static final Alias PK_ALIAS = new Alias(15, "PK");
|
||||
|
||||
private ArrayList properties = new ArrayList();
|
||||
private ArrayList declaredProperties = new ArrayList();
|
||||
private final ArrayList<Property> properties = new ArrayList<>();
|
||||
private final ArrayList<Property> declaredProperties = new ArrayList<>();
|
||||
private Table table;
|
||||
private KeyValue key;
|
||||
private PersistentClass persistentClass;
|
||||
|
@ -52,14 +52,14 @@ public class Join implements AttributeContainer, Serializable {
|
|||
prop.setPersistentClass( getPersistentClass() );
|
||||
}
|
||||
|
||||
public Iterator getDeclaredPropertyIterator() {
|
||||
public Iterator<Property> getDeclaredPropertyIterator() {
|
||||
return declaredProperties.iterator();
|
||||
}
|
||||
|
||||
public boolean containsProperty(Property prop) {
|
||||
return properties.contains(prop);
|
||||
}
|
||||
public Iterator getPropertyIterator() {
|
||||
public Iterator<Property> getPropertyIterator() {
|
||||
return properties.iterator();
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,9 @@ public class Join implements AttributeContainer, Serializable {
|
|||
}
|
||||
|
||||
public boolean isLazy() {
|
||||
Iterator iter = getPropertyIterator();
|
||||
Iterator<Property> iter = getPropertyIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
if ( !prop.isLazy() ) {
|
||||
if ( !iter.next().isLazy() ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class JoinedSubclass extends Subclass implements TableOwner {
|
|||
}
|
||||
}
|
||||
|
||||
public Iterator getReferenceablePropertyIterator() {
|
||||
public Iterator<Property> getReferenceablePropertyIterator() {
|
||||
return getPropertyIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.hibernate.internal.FilterConfiguration;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.sql.Alias;
|
||||
|
||||
|
@ -47,10 +48,10 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
private String entityName;
|
||||
|
||||
private String className;
|
||||
private transient Class mappedClass;
|
||||
private transient Class<?> mappedClass;
|
||||
|
||||
private String proxyInterfaceName;
|
||||
private transient Class proxyInterface;
|
||||
private transient Class<?> proxyInterface;
|
||||
|
||||
private String jpaEntityName;
|
||||
|
||||
|
@ -125,7 +126,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
this.proxyInterface = null;
|
||||
}
|
||||
|
||||
public Class getMappedClass() throws MappingException {
|
||||
public Class<?> getMappedClass() throws MappingException {
|
||||
if ( className == null ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
public Class getProxyInterface() {
|
||||
public Class<?> getProxyInterface() {
|
||||
if ( proxyInterfaceName == null ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -214,33 +215,33 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
* Iterate over subclasses in a special 'order', most derived subclasses
|
||||
* first.
|
||||
*/
|
||||
public Iterator getSubclassIterator() {
|
||||
Iterator[] iters = new Iterator[subclasses.size() + 1];
|
||||
Iterator iter = subclasses.iterator();
|
||||
public Iterator<Subclass> getSubclassIterator() {
|
||||
Iterator<Subclass>[] iters = new Iterator[subclasses.size() + 1];
|
||||
Iterator<Subclass> iter = subclasses.iterator();
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
iters[i++] = ( (Subclass) iter.next() ).getSubclassIterator();
|
||||
iters[i++] = iter.next().getSubclassIterator();
|
||||
}
|
||||
iters[i] = subclasses.iterator();
|
||||
return new JoinedIterator( iters );
|
||||
return new JoinedIterator<>( iters );
|
||||
}
|
||||
|
||||
public Iterator getSubclassClosureIterator() {
|
||||
ArrayList iters = new ArrayList();
|
||||
iters.add( new SingletonIterator( this ) );
|
||||
Iterator iter = getSubclassIterator();
|
||||
public Iterator<PersistentClass> getSubclassClosureIterator() {
|
||||
ArrayList<Iterator<PersistentClass>> iters = new ArrayList<>();
|
||||
iters.add( new SingletonIterator<>( this ) );
|
||||
Iterator<Subclass> iter = getSubclassIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
PersistentClass clazz = (PersistentClass) iter.next();
|
||||
PersistentClass clazz = iter.next();
|
||||
iters.add( clazz.getSubclassClosureIterator() );
|
||||
}
|
||||
return new JoinedIterator( iters );
|
||||
return new JoinedIterator<>( iters );
|
||||
}
|
||||
|
||||
public Table getIdentityTable() {
|
||||
return getRootTable();
|
||||
}
|
||||
|
||||
public Iterator getDirectSubclasses() {
|
||||
public Iterator<Subclass> getDirectSubclasses() {
|
||||
return subclasses.iterator();
|
||||
}
|
||||
|
||||
|
@ -314,11 +315,11 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
public abstract boolean isDiscriminatorInsertable();
|
||||
|
||||
public abstract Iterator getPropertyClosureIterator();
|
||||
public abstract Iterator<Property> getPropertyClosureIterator();
|
||||
|
||||
public abstract Iterator getTableClosureIterator();
|
||||
public abstract Iterator<Table> getTableClosureIterator();
|
||||
|
||||
public abstract Iterator getKeyClosureIterator();
|
||||
public abstract Iterator<KeyValue> getKeyClosureIterator();
|
||||
|
||||
protected void addSubclassProperty(Property prop) {
|
||||
subclassProperties.add( prop );
|
||||
|
@ -332,23 +333,23 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
subclassTables.add( subclassTable );
|
||||
}
|
||||
|
||||
public Iterator getSubclassPropertyClosureIterator() {
|
||||
ArrayList iters = new ArrayList();
|
||||
public Iterator<Property> getSubclassPropertyClosureIterator() {
|
||||
ArrayList<Iterator<Property>> iters = new ArrayList<>();
|
||||
iters.add( getPropertyClosureIterator() );
|
||||
iters.add( subclassProperties.iterator() );
|
||||
for ( int i = 0; i < subclassJoins.size(); i++ ) {
|
||||
Join join = subclassJoins.get( i );
|
||||
iters.add( join.getPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iters );
|
||||
return new JoinedIterator<>( iters );
|
||||
}
|
||||
|
||||
public Iterator getSubclassJoinClosureIterator() {
|
||||
return new JoinedIterator( getJoinClosureIterator(), subclassJoins.iterator() );
|
||||
public Iterator<Join> getSubclassJoinClosureIterator() {
|
||||
return new JoinedIterator<>( getJoinClosureIterator(), subclassJoins.iterator() );
|
||||
}
|
||||
|
||||
public Iterator getSubclassTableClosureIterator() {
|
||||
return new JoinedIterator( getTableClosureIterator(), subclassTables.iterator() );
|
||||
public Iterator<Table> getSubclassTableClosureIterator() {
|
||||
return new JoinedIterator<>( getTableClosureIterator(), subclassTables.iterator() );
|
||||
}
|
||||
|
||||
public boolean isClassOrSuperclassJoin(Join join) {
|
||||
|
@ -369,9 +370,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
public abstract boolean hasEmbeddedIdentifier();
|
||||
|
||||
public abstract Class getEntityPersisterClass();
|
||||
public abstract Class<? extends EntityPersister> getEntityPersisterClass();
|
||||
|
||||
public abstract void setEntityPersisterClass(Class classPersisterClass);
|
||||
public abstract void setEntityPersisterClass(Class<? extends EntityPersister> classPersisterClass);
|
||||
|
||||
public abstract Table getRootTable();
|
||||
|
||||
|
@ -424,7 +425,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
* @see #getReferencedProperty for a discussion of "referenceable"
|
||||
* @return The referenceable property iterator.
|
||||
*/
|
||||
public Iterator getReferenceablePropertyIterator() {
|
||||
public Iterator<Property> getReferenceablePropertyIterator() {
|
||||
return getPropertyClosureIterator();
|
||||
}
|
||||
|
||||
|
@ -462,7 +463,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
private Property getRecursiveProperty(String propertyPath, Iterator iter) throws MappingException {
|
||||
private Property getRecursiveProperty(String propertyPath, Iterator<Property> iter) throws MappingException {
|
||||
Property property = null;
|
||||
StringTokenizer st = new StringTokenizer( propertyPath, ".", false );
|
||||
try {
|
||||
|
@ -508,11 +509,11 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
return property;
|
||||
}
|
||||
|
||||
private Property getProperty(String propertyName, Iterator iterator) throws MappingException {
|
||||
private Property getProperty(String propertyName, Iterator<Property> iterator) throws MappingException {
|
||||
if ( iterator.hasNext() ) {
|
||||
String root = StringHelper.root( propertyName );
|
||||
while ( iterator.hasNext() ) {
|
||||
Property prop = (Property) iterator.next();
|
||||
Property prop = iterator.next();
|
||||
if ( prop.getName().equals( root )
|
||||
|| (prop instanceof Backref || prop instanceof IndexBackref)
|
||||
&& prop.getName().equals( propertyName ) ) {
|
||||
|
@ -524,7 +525,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
public Property getProperty(String propertyName) throws MappingException {
|
||||
Iterator iter = getPropertyClosureIterator();
|
||||
Iterator<Property> iter = getPropertyClosureIterator();
|
||||
Property identifierProperty = getIdentifierProperty();
|
||||
if ( identifierProperty != null
|
||||
&& identifierProperty.getName().equals( StringHelper.root( propertyName ) ) ) {
|
||||
|
@ -549,9 +550,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
return true;
|
||||
}
|
||||
|
||||
final Iterator itr = getPropertyClosureIterator();
|
||||
final Iterator<Property> itr = getPropertyClosureIterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final Property property = (Property) itr.next();
|
||||
final Property property = itr.next();
|
||||
if ( property.getName().equals( name ) ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -627,9 +628,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
public void validate(Mapping mapping) throws MappingException {
|
||||
Iterator iter = getPropertyIterator();
|
||||
Iterator<Property> iter = getPropertyIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
Property prop = iter.next();
|
||||
if ( !prop.isValid( mapping ) ) {
|
||||
throw new MappingException(
|
||||
"property mapping has wrong number of columns: " +
|
||||
|
@ -645,9 +646,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
private void checkPropertyDuplication() throws MappingException {
|
||||
HashSet<String> names = new HashSet<>();
|
||||
Iterator iter = getPropertyIterator();
|
||||
Iterator<Property> iter = getPropertyIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
Property prop = iter.next();
|
||||
if ( !names.add( prop.getName() ) ) {
|
||||
throw new MappingException( "Duplicate property mapping of " + prop.getName() + " found in " + getEntityName() );
|
||||
}
|
||||
|
@ -681,11 +682,11 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
return getClass().getName() + '(' + getEntityName() + ')';
|
||||
}
|
||||
|
||||
public Iterator getJoinIterator() {
|
||||
public Iterator<Join> getJoinIterator() {
|
||||
return joins.iterator();
|
||||
}
|
||||
|
||||
public Iterator getJoinClosureIterator() {
|
||||
public Iterator<Join> getJoinClosureIterator() {
|
||||
return joins.iterator();
|
||||
}
|
||||
|
||||
|
@ -708,9 +709,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
public int getJoinNumber(Property prop) {
|
||||
int result = 1;
|
||||
Iterator iter = getSubclassJoinClosureIterator();
|
||||
Iterator<Join> iter = getSubclassJoinClosureIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Join join = (Join) iter.next();
|
||||
Join join = iter.next();
|
||||
if ( join.containsProperty( prop ) ) {
|
||||
return result;
|
||||
}
|
||||
|
@ -732,14 +733,14 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
*
|
||||
* @return An iterator over the "normal" properties.
|
||||
*/
|
||||
public Iterator getPropertyIterator() {
|
||||
ArrayList iterators = new ArrayList();
|
||||
public Iterator<Property> getPropertyIterator() {
|
||||
ArrayList<Iterator<Property>> iterators = new ArrayList<>();
|
||||
iterators.add( properties.iterator() );
|
||||
for ( int i = 0; i < joins.size(); i++ ) {
|
||||
Join join = joins.get( i );
|
||||
iterators.add( join.getPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iterators );
|
||||
return new JoinedIterator<>( iterators );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -749,7 +750,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
*
|
||||
* @return An iterator over the non-joined "normal" properties.
|
||||
*/
|
||||
public Iterator getUnjoinedPropertyIterator() {
|
||||
public Iterator<Property> getUnjoinedPropertyIterator() {
|
||||
return properties.iterator();
|
||||
}
|
||||
|
||||
|
@ -825,7 +826,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
);
|
||||
}
|
||||
|
||||
public java.util.List getFilters() {
|
||||
public java.util.List<FilterConfiguration> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
@ -843,7 +844,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
this.loaderName = loaderName == null ? null : loaderName.intern();
|
||||
}
|
||||
|
||||
public abstract java.util.Set getSynchronizedTables();
|
||||
public abstract java.util.Set<String> getSynchronizedTables();
|
||||
|
||||
public void addSynchronizedTable(String table) {
|
||||
synchronizedTables.add( table );
|
||||
|
@ -857,10 +858,10 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
this.isAbstract = isAbstract;
|
||||
}
|
||||
|
||||
protected void checkColumnDuplication(Set distinctColumns, Iterator columns)
|
||||
protected void checkColumnDuplication(Set<String> distinctColumns, Iterator<Selectable> columns)
|
||||
throws MappingException {
|
||||
while ( columns.hasNext() ) {
|
||||
Selectable columnOrFormula = (Selectable) columns.next();
|
||||
Selectable columnOrFormula = columns.next();
|
||||
if ( !columnOrFormula.isFormula() ) {
|
||||
Column col = (Column) columnOrFormula;
|
||||
if ( !distinctColumns.add( col.getName() ) ) {
|
||||
|
@ -892,16 +893,16 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
protected Iterator getNonDuplicatedPropertyIterator() {
|
||||
protected Iterator<Property> getNonDuplicatedPropertyIterator() {
|
||||
return getUnjoinedPropertyIterator();
|
||||
}
|
||||
|
||||
protected Iterator getDiscriminatorColumnIterator() {
|
||||
protected Iterator<Selectable> getDiscriminatorColumnIterator() {
|
||||
return Collections.emptyIterator();
|
||||
}
|
||||
|
||||
protected void checkColumnDuplication() {
|
||||
HashSet cols = new HashSet();
|
||||
HashSet<String> cols = new HashSet<>();
|
||||
if ( getIdentifierMapper() == null ) {
|
||||
//an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator()
|
||||
//and checked later, so it needs to be excluded
|
||||
|
@ -909,10 +910,10 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
checkColumnDuplication( cols, getDiscriminatorColumnIterator() );
|
||||
checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() );
|
||||
Iterator iter = getJoinIterator();
|
||||
Iterator<Join> iter = getJoinIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
cols.clear();
|
||||
Join join = (Join) iter.next();
|
||||
Join join = iter.next();
|
||||
checkColumnDuplication( cols, join.getKey().getColumnIterator() );
|
||||
checkPropertyColumnDuplication( cols, join.getPropertyIterator() );
|
||||
}
|
||||
|
@ -991,7 +992,6 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
private boolean determineIfNaturalIdDefined() {
|
||||
//noinspection unchecked
|
||||
final Iterator<Property> props = getRootClass().getPropertyIterator();
|
||||
while ( props.hasNext() ) {
|
||||
if ( props.next().isNaturalIdentifier() ) {
|
||||
|
@ -1002,14 +1002,14 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
// The following methods are added to support @MappedSuperclass in the metamodel
|
||||
public Iterator getDeclaredPropertyIterator() {
|
||||
ArrayList iterators = new ArrayList();
|
||||
public Iterator<Property> getDeclaredPropertyIterator() {
|
||||
ArrayList<Iterator<Property>> iterators = new ArrayList<>();
|
||||
iterators.add( declaredProperties.iterator() );
|
||||
for ( int i = 0; i < joins.size(); i++ ) {
|
||||
Join join = joins.get( i );
|
||||
iterators.add( join.getDeclaredPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iterators );
|
||||
return new JoinedIterator<>( iterators );
|
||||
}
|
||||
|
||||
public void addMappedsuperclassProperty(Property p) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* The root class of an inheritance hierarchy
|
||||
|
@ -44,7 +45,7 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
private boolean mutable = true;
|
||||
private boolean embeddedIdentifier;
|
||||
private boolean explicitPolymorphism;
|
||||
private Class entityPersisterClass;
|
||||
private Class<? extends EntityPersister> entityPersisterClass;
|
||||
private boolean forceDiscriminator;
|
||||
private String where;
|
||||
private Table table;
|
||||
|
@ -125,18 +126,18 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iterator getPropertyClosureIterator() {
|
||||
public Iterator<Property> getPropertyClosureIterator() {
|
||||
return getPropertyIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getTableClosureIterator() {
|
||||
return new SingletonIterator( getTable() );
|
||||
public Iterator<Table> getTableClosureIterator() {
|
||||
return new SingletonIterator<>( getTable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator getKeyClosureIterator() {
|
||||
return new SingletonIterator( getKey() );
|
||||
public Iterator<KeyValue> getKeyClosureIterator() {
|
||||
return new SingletonIterator<>( getKey() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,7 +185,7 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class getEntityPersisterClass() {
|
||||
public Class<? extends EntityPersister> getEntityPersisterClass() {
|
||||
return entityPersisterClass;
|
||||
}
|
||||
|
||||
|
@ -194,7 +195,7 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setEntityPersisterClass(Class persister) {
|
||||
public void setEntityPersisterClass(Class<? extends EntityPersister> persister) {
|
||||
this.entityPersisterClass = persister;
|
||||
}
|
||||
|
||||
|
@ -333,7 +334,7 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
}
|
||||
|
||||
@Override
|
||||
public java.util.Set getSynchronizedTables() {
|
||||
public java.util.Set<String> getSynchronizedTables() {
|
||||
return synchronizedTables;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,14 @@ public class SingleTableSubclass extends Subclass {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Iterator getNonDuplicatedPropertyIterator() {
|
||||
return new JoinedIterator(
|
||||
protected Iterator<Property> getNonDuplicatedPropertyIterator() {
|
||||
return new JoinedIterator<>(
|
||||
getSuperclass().getUnjoinedPropertyIterator(),
|
||||
getUnjoinedPropertyIterator()
|
||||
);
|
||||
}
|
||||
|
||||
protected Iterator getDiscriminatorColumnIterator() {
|
||||
protected Iterator<Selectable> getDiscriminatorColumnIterator() {
|
||||
if ( isDiscriminatorInsertable() && !getDiscriminator().hasFormula() ) {
|
||||
return getDiscriminator().getColumnIterator();
|
||||
}
|
||||
|
|
|
@ -15,8 +15,10 @@ import org.hibernate.AssertionFailure;
|
|||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.engine.OptimisticLockStyle;
|
||||
import org.hibernate.internal.FilterConfiguration;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
* A subclass in a table-per-class-hierarchy mapping
|
||||
|
@ -24,7 +26,7 @@ import org.hibernate.internal.util.collections.SingletonIterator;
|
|||
*/
|
||||
public class Subclass extends PersistentClass {
|
||||
private PersistentClass superclass;
|
||||
private Class classPersisterClass;
|
||||
private Class<? extends EntityPersister> classPersisterClass;
|
||||
private final int subclassId;
|
||||
|
||||
public Subclass(PersistentClass superclass, MetadataBuildingContext metadataBuildingContext) {
|
||||
|
@ -100,22 +102,22 @@ public class Subclass extends PersistentClass {
|
|||
getSuperclass().addSubclassJoin(j);
|
||||
}
|
||||
|
||||
public Iterator getPropertyClosureIterator() {
|
||||
return new JoinedIterator(
|
||||
public Iterator<Property> getPropertyClosureIterator() {
|
||||
return new JoinedIterator<>(
|
||||
getSuperclass().getPropertyClosureIterator(),
|
||||
getPropertyIterator()
|
||||
);
|
||||
}
|
||||
public Iterator getTableClosureIterator() {
|
||||
return new JoinedIterator(
|
||||
public Iterator<Table> getTableClosureIterator() {
|
||||
return new JoinedIterator<>(
|
||||
getSuperclass().getTableClosureIterator(),
|
||||
new SingletonIterator( getTable() )
|
||||
new SingletonIterator<>( getTable() )
|
||||
);
|
||||
}
|
||||
public Iterator getKeyClosureIterator() {
|
||||
return new JoinedIterator(
|
||||
public Iterator<KeyValue> getKeyClosureIterator() {
|
||||
return new JoinedIterator<>(
|
||||
getSuperclass().getKeyClosureIterator(),
|
||||
new SingletonIterator( getKey() )
|
||||
new SingletonIterator<>( getKey() )
|
||||
);
|
||||
}
|
||||
protected void addSubclassProperty(Property p) {
|
||||
|
@ -146,7 +148,7 @@ public class Subclass extends PersistentClass {
|
|||
public boolean hasEmbeddedIdentifier() {
|
||||
return getSuperclass().hasEmbeddedIdentifier();
|
||||
}
|
||||
public Class getEntityPersisterClass() {
|
||||
public Class<? extends EntityPersister> getEntityPersisterClass() {
|
||||
if (classPersisterClass==null) {
|
||||
return getSuperclass().getEntityPersisterClass();
|
||||
}
|
||||
|
@ -186,7 +188,7 @@ public class Subclass extends PersistentClass {
|
|||
getKey().createForeignKeyOfEntity( getSuperclass().getEntityName() );
|
||||
}
|
||||
|
||||
public void setEntityPersisterClass(Class classPersisterClass) {
|
||||
public void setEntityPersisterClass(Class<? extends EntityPersister> classPersisterClass) {
|
||||
this.classPersisterClass = classPersisterClass;
|
||||
}
|
||||
|
||||
|
@ -198,8 +200,8 @@ public class Subclass extends PersistentClass {
|
|||
return getSuperclass().getPropertyClosureSpan() + super.getPropertyClosureSpan();
|
||||
}
|
||||
|
||||
public Iterator getJoinClosureIterator() {
|
||||
return new JoinedIterator(
|
||||
public Iterator<Join> getJoinClosureIterator() {
|
||||
return new JoinedIterator<>(
|
||||
getSuperclass().getJoinClosureIterator(),
|
||||
super.getJoinClosureIterator()
|
||||
);
|
||||
|
@ -225,8 +227,8 @@ public class Subclass extends PersistentClass {
|
|||
return getSuperclass().isDiscriminatorInsertable();
|
||||
}
|
||||
|
||||
public java.util.Set getSynchronizedTables() {
|
||||
HashSet result = new HashSet();
|
||||
public java.util.Set<String> getSynchronizedTables() {
|
||||
HashSet<String> result = new HashSet<>();
|
||||
result.addAll(synchronizedTables);
|
||||
result.addAll( getSuperclass().getSynchronizedTables() );
|
||||
return result;
|
||||
|
@ -236,8 +238,8 @@ public class Subclass extends PersistentClass {
|
|||
return mv.accept(this);
|
||||
}
|
||||
|
||||
public java.util.List getFilters() {
|
||||
java.util.List filters = new ArrayList(super.getFilters());
|
||||
public java.util.List<FilterConfiguration> getFilters() {
|
||||
java.util.List<FilterConfiguration> filters = new ArrayList<>(super.getFilters());
|
||||
filters.addAll(getSuperclass().getFilters());
|
||||
return filters;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ public class UnionSubclass extends Subclass implements TableOwner {
|
|||
getSuperclass().addSubclassTable(table);
|
||||
}
|
||||
|
||||
public java.util.Set getSynchronizedTables() {
|
||||
public java.util.Set<String> getSynchronizedTables() {
|
||||
return synchronizedTables;
|
||||
}
|
||||
|
||||
protected Iterator getNonDuplicatedPropertyIterator() {
|
||||
protected Iterator<Property> getNonDuplicatedPropertyIterator() {
|
||||
return getPropertyClosureIterator();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface EntityDiscriminatorMapping extends VirtualModelPart, BasicValue
|
|||
}
|
||||
|
||||
@Override
|
||||
default JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
default JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public interface EntityMappingType extends ManagedMappingType, EntityValuedModel
|
|||
}
|
||||
|
||||
@Override
|
||||
default JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
default JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
|||
*/
|
||||
public interface ManagedMappingType extends MappingType, FetchableContainer {
|
||||
@Override
|
||||
default JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
default JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,5 +14,5 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface MappingType {
|
||||
JavaTypeDescriptor getMappedJavaTypeDescriptor();
|
||||
JavaTypeDescriptor<?> getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
|
|||
public interface ModelPart extends MappingModelExpressable {
|
||||
MappingType getPartMappingType();
|
||||
|
||||
JavaTypeDescriptor getJavaTypeDescriptor();
|
||||
JavaTypeDescriptor<?> getJavaTypeDescriptor();
|
||||
|
||||
String getPartName();
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ public abstract class AbstractAttributeMapping implements AttributeMapping {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getMappedType().getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,14 +36,14 @@ public abstract class AbstractEntityDiscriminatorMapping implements EntityDiscri
|
|||
private final String mappedColumnExpression;
|
||||
private final boolean isFormula;
|
||||
|
||||
private final BasicType mappingType;
|
||||
private final BasicType<?> mappingType;
|
||||
|
||||
public AbstractEntityDiscriminatorMapping(
|
||||
EntityPersister entityDescriptor,
|
||||
String tableExpression,
|
||||
String mappedColumnExpression,
|
||||
boolean isFormula,
|
||||
BasicType mappingType) {
|
||||
BasicType<?> mappingType) {
|
||||
this.entityDescriptor = entityDescriptor;
|
||||
this.tableExpression = tableExpression;
|
||||
this.mappedColumnExpression = mappedColumnExpression;
|
||||
|
@ -146,7 +146,7 @@ public abstract class AbstractEntityDiscriminatorMapping implements EntityDiscri
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getMappedType().getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.mapping.IndexedConsumer;
|
|||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.SelectionConsumer;
|
||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
|
@ -59,7 +58,7 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
|
|||
private final String rootTable;
|
||||
private final String pkColumnName;
|
||||
|
||||
private final BasicType idType;
|
||||
private final BasicType<?> idType;
|
||||
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
|
|||
String attributeName,
|
||||
String rootTable,
|
||||
String pkColumnName,
|
||||
BasicType idType,
|
||||
BasicType<?> idType,
|
||||
MappingModelCreationProcess creationProcess) {
|
||||
assert attributeName != null;
|
||||
this.attributeName = attributeName;
|
||||
|
@ -162,7 +161,7 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getMappedType().getMappedJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
@ -179,7 +178,6 @@ public class BasicEntityIdentifierMappingImpl implements BasicEntityIdentifierMa
|
|||
DomainResultCreationState creationState) {
|
||||
final SqlSelection sqlSelection = resolveSqlSelection( navigablePath, tableGroup, creationState );
|
||||
|
||||
//noinspection unchecked
|
||||
return new BasicResult(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
|
|
|
@ -110,7 +110,7 @@ public class BasicValuedCollectionPart
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return selectionMapping.getJdbcMapping().getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ public class BasicValuedSingularAttributeMapping
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return domainTypeDescriptor;
|
||||
}
|
||||
|
||||
|
|
|
@ -458,7 +458,7 @@ public class DiscriminatedAssociationMapping implements MappingType, FetchOption
|
|||
@Override
|
||||
public JavaTypeDescriptor<T> getAssembledJavaTypeDescriptor() {
|
||||
//noinspection unchecked
|
||||
return fetchedPart.getJavaTypeDescriptor();
|
||||
return (JavaTypeDescriptor<T>) fetchedPart.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -341,7 +341,7 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor, Model
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return mappingType.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class EntityCollectionPart
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return getEntityMappingType().getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class EntityDiscriminatorMappingImpl extends AbstractEntityDiscriminatorM
|
|||
String tableExpression,
|
||||
String mappedColumnExpression,
|
||||
boolean isFormula,
|
||||
BasicType mappingType) {
|
||||
BasicType<?> mappingType) {
|
||||
super( entityDescriptor, tableExpression, mappedColumnExpression, isFormula, mappingType );
|
||||
this.navigableRole = entityDescriptor.getNavigableRole().append( EntityDiscriminatorMapping.ROLE_NAME );
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class EntityRowIdMappingImpl implements EntityRowIdMapping, SelectionMapp
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return JavaObjectType.INSTANCE.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class EntityRowIdMappingImpl implements EntityRowIdMapping, SelectionMapp
|
|||
sqlAstCreationState.getCreationContext().getDomainModel().getTypeConfiguration()
|
||||
);
|
||||
|
||||
return new BasicResult<T>(
|
||||
return new BasicResult(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
getJavaTypeDescriptor(),
|
||||
|
|
|
@ -109,7 +109,7 @@ public class EntityVersionMappingImpl implements EntityVersionMapping, FetchOpti
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return versionBasicType.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
@ -190,8 +190,7 @@ public class EntityVersionMappingImpl implements EntityVersionMapping, FetchOpti
|
|||
DomainResultCreationState creationState) {
|
||||
final SqlSelection sqlSelection = resolveSqlSelection( tableGroup, creationState );
|
||||
|
||||
//noinspection unchecked
|
||||
return new BasicResult<>(
|
||||
return new BasicResult(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
getJavaTypeDescriptor(),
|
||||
|
|
|
@ -38,7 +38,7 @@ public class JoinedSubclassDiscriminatorMappingImpl extends AbstractEntityDiscri
|
|||
boolean isFormula,
|
||||
CaseSearchedExpression caseSearchedExpression,
|
||||
List<ColumnReference> columnReferences,
|
||||
BasicType mappingType) {
|
||||
BasicType<?> mappingType) {
|
||||
super( entityDescriptor, tableExpression, mappedColumnExpression, isFormula, mappingType );
|
||||
|
||||
this.navigableRole = entityDescriptor.getNavigableRole().append( EntityDiscriminatorMapping.ROLE_NAME );
|
||||
|
|
|
@ -161,7 +161,7 @@ public class SimpleNaturalIdMapping extends AbstractNaturalIdMapping {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return attribute.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.hibernate.JDBCException;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.NotYetImplementedFor6Exception;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
|
@ -267,10 +266,10 @@ public abstract class AbstractEntityPersister
|
|||
private final String sqlAliasStem;
|
||||
private EntityMappingType rootEntityDescriptor;
|
||||
|
||||
private final SingleIdEntityLoader singleIdEntityLoader;
|
||||
private final MultiIdEntityLoader multiIdEntityLoader;
|
||||
private NaturalIdLoader naturalIdLoader;
|
||||
private MultiNaturalIdLoader multiNaturalIdLoader;
|
||||
private final SingleIdEntityLoader<?> singleIdEntityLoader;
|
||||
private final MultiIdEntityLoader<?> multiIdEntityLoader;
|
||||
private NaturalIdLoader<?> naturalIdLoader;
|
||||
private MultiNaturalIdLoader<?> multiNaturalIdLoader;
|
||||
|
||||
private SqmMultiTableMutationStrategy sqmMultiTableMutationStrategy;
|
||||
|
||||
|
@ -392,8 +391,8 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
private boolean[] tableHasColumns;
|
||||
|
||||
private final Map subclassPropertyAliases = new HashMap();
|
||||
private final Map subclassPropertyColumnNames = new HashMap();
|
||||
private final Map<String,String[]> subclassPropertyAliases = new HashMap<>();
|
||||
private final Map<String,String[]> subclassPropertyColumnNames = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Warning:
|
||||
|
@ -757,7 +756,7 @@ public abstract class AbstractEntityPersister
|
|||
if ( namedQueryMemento == null ) {
|
||||
throw new IllegalArgumentException( "Could not resolve named load-query [" + getEntityName() + "] : " + bootDescriptor.getLoaderName() );
|
||||
}
|
||||
singleIdEntityLoader = new SingleIdEntityLoaderProvidedQueryImpl(
|
||||
singleIdEntityLoader = new SingleIdEntityLoaderProvidedQueryImpl<>(
|
||||
this,
|
||||
namedQueryMemento
|
||||
);
|
||||
|
@ -766,19 +765,19 @@ public abstract class AbstractEntityPersister
|
|||
singleIdEntityLoader = createBatchingIdEntityLoader( this, batchSize, factory );
|
||||
}
|
||||
else {
|
||||
singleIdEntityLoader = new SingleIdEntityLoaderStandardImpl( this, factory );
|
||||
singleIdEntityLoader = new SingleIdEntityLoaderStandardImpl<>( this, factory );
|
||||
}
|
||||
|
||||
// todo (6.0) : allow a "max entities" to be passed (or determine based on Dialect?) indicating how many entities
|
||||
// to load at once. i.e. it limits the number of the generated IN-list JDBC-parameters in a given
|
||||
// PreparedStatement, opting to split the load into multiple JDBC operations to work around database
|
||||
// limits on number of parameters, number of IN-list values, etc
|
||||
multiIdEntityLoader = new MultiIdLoaderStandard( this, factory );
|
||||
multiIdEntityLoader = new MultiIdLoaderStandard<>( this, factory );
|
||||
|
||||
Iterator iter = bootDescriptor.getIdentifier().getColumnIterator();
|
||||
Iterator<Selectable> idColumns = bootDescriptor.getIdentifier().getColumnIterator();
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Column col = (Column) iter.next();
|
||||
while ( idColumns.hasNext() ) {
|
||||
Column col = (Column) idColumns.next();
|
||||
rootTableKeyColumnNames[i] = col.getQuotedName( dialect );
|
||||
rootTableKeyColumnReaders[i] = col.getReadExpr( dialect );
|
||||
rootTableKeyColumnReaderTemplates[i] = col.getTemplate(
|
||||
|
@ -813,8 +812,6 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
// PROPERTIES
|
||||
|
||||
final boolean lazyAvailable = isInstrumented();
|
||||
|
||||
int hydrateSpan = entityMetamodel.getPropertySpan();
|
||||
propertyColumnSpans = new int[hydrateSpan];
|
||||
propertySubclassNames = new String[hydrateSpan];
|
||||
|
@ -827,19 +824,19 @@ public abstract class AbstractEntityPersister
|
|||
propertySelectable = new boolean[hydrateSpan];
|
||||
propertyColumnUpdateable = new boolean[hydrateSpan][];
|
||||
propertyColumnInsertable = new boolean[hydrateSpan][];
|
||||
HashSet thisClassProperties = new HashSet();
|
||||
HashSet<Property> thisClassProperties = new HashSet<>();
|
||||
|
||||
ArrayList lazyNames = new ArrayList();
|
||||
ArrayList lazyNumbers = new ArrayList();
|
||||
ArrayList lazyTypes = new ArrayList();
|
||||
ArrayList lazyColAliases = new ArrayList();
|
||||
ArrayList<String> lazyNames = new ArrayList<>();
|
||||
ArrayList<Integer> lazyNumbers = new ArrayList<>();
|
||||
ArrayList<Type> lazyTypes = new ArrayList<>();
|
||||
ArrayList<String[]> lazyColAliases = new ArrayList<>();
|
||||
|
||||
final ArrayList<Integer> lobPropertiesLocalCollector = new ArrayList<>();
|
||||
iter = bootDescriptor.getPropertyClosureIterator();
|
||||
Iterator<Property> properties = bootDescriptor.getPropertyClosureIterator();
|
||||
i = 0;
|
||||
boolean foundFormula = false;
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
while ( properties.hasNext() ) {
|
||||
Property prop = properties.next();
|
||||
thisClassProperties.add( prop );
|
||||
|
||||
int span = prop.getColumnSpan();
|
||||
|
@ -850,10 +847,10 @@ public abstract class AbstractEntityPersister
|
|||
String[] colReaderTemplates = new String[span];
|
||||
String[] colWriters = new String[span];
|
||||
String[] formulaTemplates = new String[span];
|
||||
Iterator colIter = prop.getColumnIterator();
|
||||
Iterator<Selectable> colIter = prop.getColumnIterator();
|
||||
int k = 0;
|
||||
while ( colIter.hasNext() ) {
|
||||
Selectable thing = (Selectable) colIter.next();
|
||||
Selectable thing = colIter.next();
|
||||
colAliases[k] = thing.getAlias( dialect, prop.getValue().getTable() );
|
||||
if ( thing.isFormula() ) {
|
||||
foundFormula = true;
|
||||
|
@ -916,32 +913,32 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
// SUBCLASS PROPERTY CLOSURE
|
||||
|
||||
ArrayList columns = new ArrayList();
|
||||
ArrayList columnsLazy = new ArrayList();
|
||||
ArrayList columnReaderTemplates = new ArrayList();
|
||||
ArrayList aliases = new ArrayList();
|
||||
ArrayList formulas = new ArrayList();
|
||||
ArrayList formulaAliases = new ArrayList();
|
||||
ArrayList formulaTemplates = new ArrayList();
|
||||
ArrayList formulasLazy = new ArrayList();
|
||||
ArrayList types = new ArrayList();
|
||||
ArrayList names = new ArrayList();
|
||||
ArrayList classes = new ArrayList();
|
||||
ArrayList templates = new ArrayList();
|
||||
ArrayList propColumns = new ArrayList();
|
||||
ArrayList propColumnReaders = new ArrayList();
|
||||
ArrayList propColumnReaderTemplates = new ArrayList();
|
||||
ArrayList joinedFetchesList = new ArrayList();
|
||||
ArrayList cascades = new ArrayList();
|
||||
ArrayList definedBySubclass = new ArrayList();
|
||||
ArrayList propColumnNumbers = new ArrayList();
|
||||
ArrayList propFormulaNumbers = new ArrayList();
|
||||
ArrayList columnSelectables = new ArrayList();
|
||||
ArrayList propNullables = new ArrayList();
|
||||
ArrayList<String> columns = new ArrayList<>();
|
||||
ArrayList<Boolean> columnsLazy = new ArrayList<>();
|
||||
ArrayList<String> columnReaderTemplates = new ArrayList<>();
|
||||
ArrayList<String> aliases = new ArrayList<>();
|
||||
ArrayList<String> formulas = new ArrayList<>();
|
||||
ArrayList<String> formulaAliases = new ArrayList<>();
|
||||
ArrayList<String> formulaTemplates = new ArrayList<>();
|
||||
ArrayList<Boolean> formulasLazy = new ArrayList<>();
|
||||
ArrayList<Type> types = new ArrayList<>();
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
ArrayList<String> classes = new ArrayList<>();
|
||||
ArrayList<String[]> templates = new ArrayList<>();
|
||||
ArrayList<String[]> propColumns = new ArrayList<>();
|
||||
ArrayList<String[]> propColumnReaders = new ArrayList<>();
|
||||
ArrayList<String[]> propColumnReaderTemplates = new ArrayList<>();
|
||||
ArrayList<FetchMode> joinedFetchesList = new ArrayList<>();
|
||||
ArrayList<CascadeStyle> cascades = new ArrayList<>();
|
||||
ArrayList<Boolean> definedBySubclass = new ArrayList<>();
|
||||
ArrayList<int[]> propColumnNumbers = new ArrayList<>();
|
||||
ArrayList<int[]> propFormulaNumbers = new ArrayList<>();
|
||||
ArrayList<Boolean> columnSelectables = new ArrayList<>();
|
||||
ArrayList<Boolean> propNullables = new ArrayList<>();
|
||||
|
||||
iter = bootDescriptor.getSubclassPropertyClosureIterator();
|
||||
Iterator<Property> iter = bootDescriptor.getSubclassPropertyClosureIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
final Property prop = (Property) iter.next();
|
||||
final Property prop = iter.next();
|
||||
names.add( prop.getName() );
|
||||
classes.add( prop.getPersistentClass().getEntityName() );
|
||||
types.add( prop.getType() );
|
||||
|
@ -950,7 +947,7 @@ public abstract class AbstractEntityPersister
|
|||
definedBySubclass.add( Boolean.valueOf( isDefinedBySubclass ) );
|
||||
propNullables.add( Boolean.valueOf( prop.isOptional() || isDefinedBySubclass ) ); //TODO: is this completely correct?
|
||||
|
||||
final Iterator colIter = prop.getColumnIterator();
|
||||
final Iterator<Selectable> colIter = prop.getColumnIterator();
|
||||
String[] cols = new String[ prop.getColumnSpan() ];
|
||||
String[] readers = new String[ prop.getColumnSpan() ];
|
||||
String[] readerTemplates = new String[ prop.getColumnSpan() ];
|
||||
|
@ -971,7 +968,7 @@ public abstract class AbstractEntityPersister
|
|||
sessionFactoryOptions.isCollectionsInDefaultFetchGroupEnabled()
|
||||
);
|
||||
while ( colIter.hasNext() ) {
|
||||
final Selectable thing = (Selectable) colIter.next();
|
||||
final Selectable thing = colIter.next();
|
||||
if ( thing.isFormula() ) {
|
||||
String template = thing.getTemplate( dialect, factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
formnos[l] = formulaTemplates.size();
|
||||
|
@ -1033,24 +1030,17 @@ public abstract class AbstractEntityPersister
|
|||
subclassPropertyFormulaNumberClosure = ArrayHelper.to2DIntArray( propFormulaNumbers );
|
||||
|
||||
subclassPropertyCascadeStyleClosure = new CascadeStyle[cascades.size()];
|
||||
iter = cascades.iterator();
|
||||
int j = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
subclassPropertyCascadeStyleClosure[j++] = (CascadeStyle) iter.next();
|
||||
for (CascadeStyle cascade: cascades) {
|
||||
subclassPropertyCascadeStyleClosure[j++] = cascade;
|
||||
}
|
||||
subclassPropertyFetchModeClosure = new FetchMode[joinedFetchesList.size()];
|
||||
iter = joinedFetchesList.iterator();
|
||||
j = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
subclassPropertyFetchModeClosure[j++] = (FetchMode) iter.next();
|
||||
for (FetchMode fetchMode : joinedFetchesList) {
|
||||
subclassPropertyFetchModeClosure[j++] = fetchMode;
|
||||
}
|
||||
|
||||
propertyDefinedOnSubclass = new boolean[definedBySubclass.size()];
|
||||
iter = definedBySubclass.iterator();
|
||||
j = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
propertyDefinedOnSubclass[j++] = (Boolean) iter.next();
|
||||
}
|
||||
propertyDefinedOnSubclass = ArrayHelper.toBooleanArray( definedBySubclass );
|
||||
|
||||
// Handle any filters applied to the class level
|
||||
filterHelper = new FilterHelper( bootDescriptor.getFilters(), factory );
|
||||
|
@ -1088,11 +1078,11 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
}
|
||||
|
||||
private static SingleIdEntityLoader createBatchingIdEntityLoader(
|
||||
private static SingleIdEntityLoader<?> createBatchingIdEntityLoader(
|
||||
EntityMappingType entityDescriptor,
|
||||
int batchSize,
|
||||
SessionFactoryImplementor factory) {
|
||||
return new SingleIdEntityLoaderDynamicBatch( entityDescriptor, batchSize, factory );
|
||||
return new SingleIdEntityLoaderDynamicBatch<>( entityDescriptor, batchSize, factory );
|
||||
}
|
||||
|
||||
@SuppressWarnings("RedundantIfStatement")
|
||||
|
@ -1140,7 +1130,6 @@ public abstract class AbstractEntityPersister
|
|||
return persistentClass.isCached();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean determineCanReadFromCache(PersistentClass persistentClass, EntityDataAccess cacheAccessStrategy) {
|
||||
if ( cacheAccessStrategy == null ) {
|
||||
return false;
|
||||
|
@ -1184,7 +1173,7 @@ public abstract class AbstractEntityPersister
|
|||
protected static String getTemplateFromString(String string, SessionFactoryImplementor factory) {
|
||||
return string == null ?
|
||||
null :
|
||||
Template.renderWhereStringTemplate( string, factory.getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
Template.renderWhereStringTemplate( string, factory.getJdbcServices().getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
}
|
||||
|
||||
protected Map<String,String> generateLazySelectStringsByFetchGroup() {
|
||||
|
@ -1198,9 +1187,9 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
final LazyAttributesMetadata lazyAttributesMetadata = enhancementMetadata.getLazyAttributesMetadata();
|
||||
for ( String groupName : lazyAttributesMetadata.getFetchGroupNames() ) {
|
||||
HashSet tableNumbers = new HashSet();
|
||||
ArrayList columnNumbers = new ArrayList();
|
||||
ArrayList formulaNumbers = new ArrayList();
|
||||
HashSet<Integer> tableNumbers = new HashSet<>();
|
||||
ArrayList<Integer> columnNumbers = new ArrayList<>();
|
||||
ArrayList<Integer> formulaNumbers = new ArrayList<>();
|
||||
|
||||
for ( LazyAttributeDescriptor lazyAttributeDescriptor :
|
||||
lazyAttributesMetadata.getFetchGroupAttributeDescriptors( groupName ) ) {
|
||||
|
@ -1557,7 +1546,7 @@ public abstract class AbstractEntityPersister
|
|||
// see if there is already a collection instance associated with the session
|
||||
// NOTE : can this ever happen?
|
||||
final Object key = getCollectionKey( persister, entity, entry, session );
|
||||
PersistentCollection collection = persistenceContext.getCollection( new CollectionKey( persister, key ) );
|
||||
PersistentCollection<?> collection = persistenceContext.getCollection( new CollectionKey( persister, key ) );
|
||||
if ( collection == null ) {
|
||||
collection = collectionType.instantiate( session, persister, key );
|
||||
collection.setOwner( entity );
|
||||
|
@ -1993,7 +1982,7 @@ public abstract class AbstractEntityPersister
|
|||
* Generate the SQL that selects the version number by id
|
||||
*/
|
||||
public String generateSelectVersionString() {
|
||||
SimpleSelect select = new SimpleSelect( getFactory().getDialect() )
|
||||
SimpleSelect select = new SimpleSelect( getFactory().getJdbcServices().getDialect() )
|
||||
.setTableName( getVersionedTableName() );
|
||||
if ( isVersioned() ) {
|
||||
select.addColumn( versionColumnName );
|
||||
|
@ -2020,7 +2009,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
private String generateGeneratedValuesSelectString(final GenerationTiming generationTimingToMatch) {
|
||||
Select select = new Select( getFactory().getDialect() );
|
||||
Select select = new Select( getFactory().getJdbcServices().getDialect() );
|
||||
|
||||
if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
|
||||
select.setComment( "get generated state " + getEntityName() );
|
||||
|
@ -2096,7 +2085,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
//TODO: should we use SELECT .. FOR UPDATE?
|
||||
|
||||
Select select = new Select( getFactory().getDialect() );
|
||||
Select select = new Select( getFactory().getJdbcServices().getDialect() );
|
||||
|
||||
if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
|
||||
select.setComment( "get current state " + getEntityName() );
|
||||
|
@ -2144,7 +2133,7 @@ public abstract class AbstractEntityPersister
|
|||
throw new HibernateException( "LockMode.FORCE is currently not supported for generated version properties" );
|
||||
}
|
||||
|
||||
Object nextVersion = getVersionType().next( currentVersion, session );
|
||||
Object nextVersion = ((VersionType) getVersionType()).next( currentVersion, session );
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.trace(
|
||||
"Forcing version increment [" + MessageHelper.infoString( this, id, getFactory() ) + "; "
|
||||
|
@ -2243,7 +2232,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
protected LockingStrategy generateLocker(LockMode lockMode) {
|
||||
return factory.getDialect().getLockingStrategy( this, lockMode );
|
||||
return factory.getJdbcServices().getDialect().getLockingStrategy( this, lockMode );
|
||||
}
|
||||
|
||||
private LockingStrategy getLocker(LockMode lockMode) {
|
||||
|
@ -2619,7 +2608,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
|
||||
String[] rawAliases = (String[]) subclassPropertyAliases.get( propertyName );
|
||||
String[] rawAliases = subclassPropertyAliases.get( propertyName );
|
||||
|
||||
if ( rawAliases == null ) {
|
||||
return null;
|
||||
|
@ -2634,7 +2623,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
public String[] getSubclassPropertyColumnNames(String propertyName) {
|
||||
//TODO: should we allow suffixes on these ?
|
||||
return (String[]) subclassPropertyColumnNames.get( propertyName );
|
||||
return subclassPropertyColumnNames.get( propertyName );
|
||||
}
|
||||
|
||||
|
||||
|
@ -2705,25 +2694,26 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
}
|
||||
|
||||
private void internalInitSubclassPropertyAliasesMap(String path, Iterator propertyIterator) {
|
||||
private void internalInitSubclassPropertyAliasesMap(String path, Iterator<Property> propertyIterator) {
|
||||
while ( propertyIterator.hasNext() ) {
|
||||
|
||||
Property prop = (Property) propertyIterator.next();
|
||||
Property prop = propertyIterator.next();
|
||||
String propname = path == null ? prop.getName() : path + "." + prop.getName();
|
||||
if ( prop.isComposite() ) {
|
||||
Component component = (Component) prop.getValue();
|
||||
Iterator compProps = component.getPropertyIterator();
|
||||
Iterator<Property> compProps = component.getPropertyIterator();
|
||||
internalInitSubclassPropertyAliasesMap( propname, compProps );
|
||||
}
|
||||
else {
|
||||
String[] aliases = new String[prop.getColumnSpan()];
|
||||
String[] cols = new String[prop.getColumnSpan()];
|
||||
Iterator colIter = prop.getColumnIterator();
|
||||
Iterator<Selectable> colIter = prop.getColumnIterator();
|
||||
int l = 0;
|
||||
while ( colIter.hasNext() ) {
|
||||
Selectable thing = (Selectable) colIter.next();
|
||||
aliases[l] = thing.getAlias( getFactory().getDialect(), prop.getValue().getTable() );
|
||||
cols[l] = thing.getText( getFactory().getDialect() ); // TODO: skip formulas?
|
||||
Selectable thing = colIter.next();
|
||||
Dialect dialect = getFactory().getJdbcServices().getDialect();
|
||||
aliases[l] = thing.getAlias( dialect, prop.getValue().getTable() );
|
||||
cols[l] = thing.getText(dialect); // TODO: skip formulas?
|
||||
l++;
|
||||
}
|
||||
|
||||
|
@ -2767,7 +2757,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
private Map<SingularAttributeMapping, SingleUniqueKeyEntityLoader<?>> uniqueKeyLoadersNew;
|
||||
|
||||
protected SingleUniqueKeyEntityLoader getUniqueKeyLoader(String attributeName) {
|
||||
protected SingleUniqueKeyEntityLoader<?> getUniqueKeyLoader(String attributeName) {
|
||||
final SingularAttributeMapping attribute = (SingularAttributeMapping) findSubPart( attributeName );
|
||||
final SingleUniqueKeyEntityLoader<?> existing;
|
||||
if ( uniqueKeyLoadersNew == null ) {
|
||||
|
@ -2782,7 +2772,7 @@ public abstract class AbstractEntityPersister
|
|||
return existing;
|
||||
}
|
||||
|
||||
final SingleUniqueKeyEntityLoader loader = new SingleUniqueKeyEntityLoaderStandard( this, attribute );
|
||||
final SingleUniqueKeyEntityLoader<?> loader = new SingleUniqueKeyEntityLoaderStandard<>( this, attribute );
|
||||
uniqueKeyLoadersNew.put( attribute, loader );
|
||||
|
||||
return loader;
|
||||
|
@ -3087,7 +3077,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
// append the SQL to return the generated identifier
|
||||
if ( j == 0 && identityInsert && useInsertSelectIdentity() ) { //TODO: suck into Insert
|
||||
result = getFactory().getDialect().getIdentityColumnSupport().appendIdentitySelectToInsert( result );
|
||||
result = getFactory().getJdbcServices().getDialect().getIdentityColumnSupport().appendIdentitySelectToInsert( result );
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -3364,7 +3354,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
if ( sequentialResultSet != null ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( sequentialResultSet, sequentialSelect );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( sequentialResultSet, sequentialSelect );
|
||||
}
|
||||
|
||||
return values;
|
||||
|
@ -3372,14 +3362,15 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( sequentialSelect != null ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( sequentialSelect );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( sequentialSelect );
|
||||
session.getJdbcCoordinator().afterStatementExecution();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean useInsertSelectIdentity() {
|
||||
return !useGetGeneratedKeys() && getFactory().getDialect().getIdentityColumnSupport().supportsInsertSelectIdentity();
|
||||
return !useGetGeneratedKeys()
|
||||
&& getFactory().getJdbcServices().getDialect().getIdentityColumnSupport().supportsInsertSelectIdentity();
|
||||
}
|
||||
|
||||
public boolean useGetGeneratedKeys() {
|
||||
|
@ -3425,7 +3416,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
public String getIdentitySelectString() {
|
||||
//TODO: cache this in an instvar
|
||||
return getFactory().getDialect().getIdentityColumnSupport()
|
||||
return getFactory().getJdbcServices().getDialect().getIdentityColumnSupport()
|
||||
.getIdentitySelectString(
|
||||
getTableName( 0 ),
|
||||
getKeyColumns( 0 )[0],
|
||||
|
@ -3434,7 +3425,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
public String getSelectByUniqueKeyString(String propertyName) {
|
||||
return new SimpleSelect( getFactory().getDialect() )
|
||||
return new SimpleSelect( getFactory().getJdbcServices().getDialect() )
|
||||
.setTableName( getTableName( 0 ) )
|
||||
.addColumns( getKeyColumns( 0 ) )
|
||||
.addCondition( getPropertyColumnNames( propertyName ), "=?" )
|
||||
|
@ -3534,13 +3525,13 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( !useBatch ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( insert );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( insert );
|
||||
session.getJdbcCoordinator().afterStatementExecution();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw getFactory().getSQLExceptionHelper().convert(
|
||||
throw getFactory().getJdbcServices().getSqlExceptionHelper().convert(
|
||||
e,
|
||||
"could not insert: " + MessageHelper.infoString( this ),
|
||||
sql
|
||||
|
@ -3735,14 +3726,14 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( !useBatch ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( update );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( update );
|
||||
session.getJdbcCoordinator().afterStatementExecution();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw getFactory().getSQLExceptionHelper().convert(
|
||||
throw getFactory().getJdbcServices().getSqlExceptionHelper().convert(
|
||||
e,
|
||||
"could not update: " + MessageHelper.infoString( this, id, getFactory() ),
|
||||
sql
|
||||
|
@ -3861,14 +3852,14 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( !useBatch ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( delete );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( delete );
|
||||
session.getJdbcCoordinator().afterStatementExecution();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
throw getFactory().getSQLExceptionHelper().convert(
|
||||
throw getFactory().getJdbcServices().getSqlExceptionHelper().convert(
|
||||
sqle,
|
||||
"could not delete: " +
|
||||
MessageHelper.infoString( this, id, getFactory() ),
|
||||
|
@ -4287,7 +4278,7 @@ public abstract class AbstractEntityPersister
|
|||
Set<String> referencedTables) {
|
||||
// IMPL NOTE : all joins join to the pk of the driving table
|
||||
final String[] idCols = StringHelper.qualify( name, getIdentifierColumnNames() );
|
||||
final JoinFragment join = getFactory().getDialect().createOuterJoinFragment();
|
||||
final JoinFragment join = getFactory().getJdbcServices().getDialect().createOuterJoinFragment();
|
||||
final int tableSpan = getSubclassTableSpan();
|
||||
// IMPL NOTE : notice that we skip the first table; it is the driving table!
|
||||
for ( int j = 1; j < tableSpan; j++ ) {
|
||||
|
@ -4393,7 +4384,7 @@ public abstract class AbstractEntityPersister
|
|||
|
||||
protected JoinFragment createJoin(int[] tableNumbers, String drivingAlias) {
|
||||
final String[] keyCols = StringHelper.qualify( drivingAlias, getSubclassTableKeyColumns( tableNumbers[0] ) );
|
||||
final JoinFragment jf = getFactory().getDialect().createOuterJoinFragment();
|
||||
final JoinFragment jf = getFactory().getJdbcServices().getDialect().createOuterJoinFragment();
|
||||
// IMPL NOTE : notice that we skip the first table; it is the driving table!
|
||||
for ( int i = 1; i < tableNumbers.length; i++ ) {
|
||||
final int j = tableNumbers[i];
|
||||
|
@ -4478,7 +4469,7 @@ public abstract class AbstractEntityPersister
|
|||
SelectFragment selectFragment = createSelect( columnNumbers, formulaNumbers );
|
||||
|
||||
//now tie it all together
|
||||
Select select = new Select( getFactory().getDialect() );
|
||||
Select select = new Select( getFactory().getJdbcServices().getDialect() );
|
||||
select.setSelectClause( selectFragment.toFragmentString().substring( 2 ) );
|
||||
select.setFromClause( from );
|
||||
select.setWhereClause( where );
|
||||
|
@ -4556,7 +4547,11 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
if ( isIdentifierAssignedByInsert() ) {
|
||||
identityDelegate = ( (PostInsertIdentifierGenerator) getIdentifierGenerator() )
|
||||
.getInsertGeneratedIdentifierDelegate( this, getFactory().getDialect(), useGetGeneratedKeys() );
|
||||
.getInsertGeneratedIdentifierDelegate(
|
||||
this,
|
||||
getFactory().getJdbcServices().getDialect(),
|
||||
useGetGeneratedKeys()
|
||||
);
|
||||
sqlIdentityInsertString = customSQLInsert[0] == null
|
||||
? generateIdentityInsertString( getPropertyInsertability() )
|
||||
: substituteBrackets( customSQLInsert[0] );
|
||||
|
@ -4626,7 +4621,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
}
|
||||
|
||||
public SingleIdEntityLoader getSingleIdEntityLoader() {
|
||||
public SingleIdEntityLoader<?> getSingleIdEntityLoader() {
|
||||
return singleIdEntityLoader;
|
||||
}
|
||||
|
||||
|
@ -4930,7 +4925,7 @@ public abstract class AbstractEntityPersister
|
|||
return naturalIdRegionAccessStrategy;
|
||||
}
|
||||
|
||||
public Comparator getVersionComparator() {
|
||||
public Comparator<?> getVersionComparator() {
|
||||
return isVersioned() ? getVersionType().getComparator() : null;
|
||||
}
|
||||
|
||||
|
@ -4959,14 +4954,10 @@ public abstract class AbstractEntityPersister
|
|||
return !entityMetamodel.getIdentifierProperty().isVirtual();
|
||||
}
|
||||
|
||||
public VersionType getVersionType() {
|
||||
return (VersionType) locateVersionType();
|
||||
}
|
||||
|
||||
private Type locateVersionType() {
|
||||
return entityMetamodel.getVersionProperty() == null ?
|
||||
null :
|
||||
entityMetamodel.getVersionProperty().getType();
|
||||
public VersionType<?> getVersionType() {
|
||||
return entityMetamodel.getVersionProperty() == null
|
||||
? null
|
||||
: (VersionType<?>) entityMetamodel.getVersionProperty().getType();
|
||||
}
|
||||
|
||||
public int getVersionProperty() {
|
||||
|
@ -5144,14 +5135,6 @@ public abstract class AbstractEntityPersister
|
|||
return entityMetamodel.isExplicitPolymorphism();
|
||||
}
|
||||
|
||||
protected boolean useDynamicUpdate() {
|
||||
return entityMetamodel.isDynamicUpdate();
|
||||
}
|
||||
|
||||
protected boolean useDynamicInsert() {
|
||||
return entityMetamodel.isDynamicInsert();
|
||||
}
|
||||
|
||||
public boolean hasEmbeddedCompositeIdentifier() {
|
||||
return entityMetamodel.getIdentifierProperty().isEmbedded();
|
||||
}
|
||||
|
@ -5335,7 +5318,7 @@ public abstract class AbstractEntityPersister
|
|||
return entityMetamodel.getCascadeStyles();
|
||||
}
|
||||
|
||||
public final Class getMappedClass() {
|
||||
public final Class<?> getMappedClass() {
|
||||
return getMappedJavaTypeDescriptor().getJavaTypeClass();
|
||||
}
|
||||
|
||||
|
@ -5343,7 +5326,7 @@ public abstract class AbstractEntityPersister
|
|||
return Lifecycle.class.isAssignableFrom( getMappedClass() );
|
||||
}
|
||||
|
||||
public Class getConcreteProxyClass() {
|
||||
public Class<?> getConcreteProxyClass() {
|
||||
final JavaTypeDescriptor<?> proxyJavaTypeDescriptor = getRepresentationStrategy().getProxyJavaTypeDescriptor();
|
||||
return proxyJavaTypeDescriptor != null ? proxyJavaTypeDescriptor.getJavaTypeClass() : javaTypeDescriptor.getJavaTypeClass();
|
||||
}
|
||||
|
@ -5495,9 +5478,7 @@ public abstract class AbstractEntityPersister
|
|||
Object currentVersion,
|
||||
SharedSessionContractImplementor session) {
|
||||
final IdentifierProperty identifierProperty = entityMetamodel.getIdentifierProperty();
|
||||
if ( identifierProperty.getIdentifierGenerator() instanceof Assigned ) {
|
||||
}
|
||||
else {
|
||||
if ( !(identifierProperty.getIdentifierGenerator() instanceof Assigned) ) {
|
||||
//reset the id
|
||||
Object result = identifierProperty
|
||||
.getUnsavedValue()
|
||||
|
@ -5659,17 +5640,17 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( rs, ps );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( rs, ps );
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
session.getJdbcCoordinator().getResourceRegistry().release( ps );
|
||||
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( ps );
|
||||
session.getJdbcCoordinator().afterStatementExecution();
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw getFactory().getSQLExceptionHelper().convert(
|
||||
throw getFactory().getJdbcServices().getSqlExceptionHelper().convert(
|
||||
e,
|
||||
"unable to select generated column values",
|
||||
selectionSQL
|
||||
|
@ -5735,8 +5716,7 @@ public abstract class AbstractEntityPersister
|
|||
);
|
||||
}
|
||||
|
||||
final Object result = getNaturalIdLoader().resolveIdToNaturalId( id, session );
|
||||
return result;
|
||||
return getNaturalIdLoader().resolveIdToNaturalId( id, session );
|
||||
}
|
||||
|
||||
|
||||
|
@ -5944,8 +5924,8 @@ public abstract class AbstractEntityPersister
|
|||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// org.hibernate.metamodel.mapping.EntityMappingType
|
||||
|
||||
private JavaTypeDescriptor javaTypeDescriptor;
|
||||
private EntityRepresentationStrategy representationStrategy;
|
||||
private final JavaTypeDescriptor<?> javaTypeDescriptor;
|
||||
private final EntityRepresentationStrategy representationStrategy;
|
||||
|
||||
private EntityMappingType superMappingType;
|
||||
private SortedMap<String, EntityMappingType> subclassMappingTypes;
|
||||
|
@ -6226,7 +6206,7 @@ public abstract class AbstractEntityPersister
|
|||
getTableName(),
|
||||
discriminatorColumnExpression,
|
||||
getDiscriminatorFormulaTemplate() != null,
|
||||
(BasicType) getDiscriminatorType()
|
||||
(BasicType<?>) getDiscriminatorType()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -6270,7 +6250,7 @@ public abstract class AbstractEntityPersister
|
|||
public void linkWithSubType(EntityMappingType sub, MappingModelCreationProcess creationProcess) {
|
||||
if ( subclassMappingTypes == null ) {
|
||||
//noinspection unchecked
|
||||
subclassMappingTypes = new TreeMap();
|
||||
subclassMappingTypes = new TreeMap<>();
|
||||
}
|
||||
subclassMappingTypes.put( sub.getEntityName(), sub );
|
||||
}
|
||||
|
@ -6357,7 +6337,7 @@ public abstract class AbstractEntityPersister
|
|||
bootEntityDescriptor.getIdentifierProperty().getName(),
|
||||
getTableName(),
|
||||
rootTableKeyColumnNames[0],
|
||||
(BasicType) idType,
|
||||
(BasicType<?>) idType,
|
||||
creationProcess
|
||||
);
|
||||
}
|
||||
|
@ -6675,10 +6655,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
if ( superMappingType != null ) {
|
||||
final AttributeMapping fromSuperType = superMappingType.findAttributeMapping( name );
|
||||
if ( fromSuperType != null ) {
|
||||
return fromSuperType;
|
||||
}
|
||||
return superMappingType.findAttributeMapping( name );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -6755,10 +6732,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
if ( hasIdentifierProperty() ) {
|
||||
final String identifierPropertyName = getIdentifierPropertyName();
|
||||
if ( identifierPropertyName.equals( name ) ) {
|
||||
return true;
|
||||
}
|
||||
return getIdentifierPropertyName().equals( name );
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -6803,13 +6777,10 @@ public abstract class AbstractEntityPersister
|
|||
return;
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
attributeMappings.forEach( fetchableConsumer );
|
||||
|
||||
if ( treatTargetType.isTypeOrSuperType( this ) ) {
|
||||
visitSubTypeAttributeMappings(
|
||||
attributeMapping -> fetchableConsumer.accept( attributeMapping )
|
||||
);
|
||||
visitSubTypeAttributeMappings( fetchableConsumer::accept );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6860,7 +6831,7 @@ public abstract class AbstractEntityPersister
|
|||
// EntityDefinition impl (walking model - deprecated)
|
||||
|
||||
private EntityIdentifierDefinition entityIdentifierDefinition;
|
||||
private SortedSet<AttributeDefinition> attributeDefinitions = new TreeSet<>(
|
||||
private final SortedSet<AttributeDefinition> attributeDefinitions = new TreeSet<>(
|
||||
Comparator.comparing( AttributeDefinition::getName )
|
||||
);
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ public interface EntityPersister
|
|||
*
|
||||
* @return The type of the version property; or null, if not versioned.
|
||||
*/
|
||||
VersionType getVersionType();
|
||||
VersionType<?> getVersionType();
|
||||
|
||||
/**
|
||||
* If {@link #isVersioned()}, then what is the index of the property
|
||||
|
@ -433,7 +433,7 @@ public interface EntityPersister
|
|||
*/
|
||||
boolean hasLazyProperties();
|
||||
|
||||
default NaturalIdLoader getNaturalIdLoader() {
|
||||
default NaturalIdLoader<?> getNaturalIdLoader() {
|
||||
throw new UnsupportedOperationException(
|
||||
"EntityPersister implementation `" + getClass().getName() + "` does not support `NaturalIdLoader`"
|
||||
);
|
||||
|
@ -447,7 +447,6 @@ public interface EntityPersister
|
|||
|
||||
/**
|
||||
* Load the id for the entity based on the natural id.
|
||||
* @return
|
||||
*/
|
||||
Object loadEntityIdByNaturalId(
|
||||
Object[] naturalIdValues,
|
||||
|
@ -763,7 +762,7 @@ public interface EntityPersister
|
|||
/**
|
||||
* The persistent class, or null
|
||||
*/
|
||||
Class getMappedClass();
|
||||
Class<?> getMappedClass();
|
||||
|
||||
/**
|
||||
* Does the class implement the {@link org.hibernate.classic.Lifecycle} interface.
|
||||
|
@ -774,7 +773,7 @@ public interface EntityPersister
|
|||
* Get the proxy interface that instances of <em>this</em> concrete class will be
|
||||
* cast to (optional operation).
|
||||
*/
|
||||
Class getConcreteProxyClass();
|
||||
Class<?> getConcreteProxyClass();
|
||||
|
||||
/**
|
||||
* Set the given values to the mapped properties of the given object
|
||||
|
|
|
@ -8,19 +8,15 @@ package org.hibernate.persister.entity;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.boot.model.relational.Database;
|
||||
|
@ -61,18 +57,12 @@ import org.hibernate.sql.CaseFragment;
|
|||
import org.hibernate.sql.InFragment;
|
||||
import org.hibernate.sql.Insert;
|
||||
import org.hibernate.sql.SelectFragment;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBase;
|
||||
import org.hibernate.sql.ast.spi.SqlAliasBaseGenerator;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationContext;
|
||||
import org.hibernate.sql.ast.spi.SqlExpressionResolver;
|
||||
import org.hibernate.sql.ast.tree.expression.CaseSearchedExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||
import org.hibernate.sql.ast.tree.expression.QueryLiteral;
|
||||
import org.hibernate.sql.ast.tree.from.StandardTableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.ast.tree.from.TableReference;
|
||||
import org.hibernate.sql.ast.tree.from.TableReferenceJoin;
|
||||
import org.hibernate.sql.ast.tree.predicate.NullnessPredicate;
|
||||
import org.hibernate.sql.ast.tree.predicate.Predicate;
|
||||
import org.hibernate.sql.results.graph.DomainResult;
|
||||
|
@ -86,6 +76,8 @@ import org.hibernate.type.Type;
|
|||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
/**
|
||||
* An <tt>EntityPersister</tt> implementing the normalized "table-per-subclass"
|
||||
* mapping strategy
|
||||
|
@ -98,8 +90,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
private static final String IMPLICIT_DISCRIMINATOR_ALIAS = "clazz_";
|
||||
private static final Object NULL_DISCRIMINATOR = new MarkerObject("<null discriminator>");
|
||||
private static final Object NOT_NULL_DISCRIMINATOR = new MarkerObject("<not null discriminator>");
|
||||
private static final String NULL_STRING = "null";
|
||||
private static final String NOT_NULL_STRING = "not null";
|
||||
|
||||
// the class hierarchy structure
|
||||
private final int tableSpan;
|
||||
|
@ -142,7 +132,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
// subclass discrimination works by assigning particular
|
||||
// values to certain combinations of null primary key
|
||||
// values in the outer join using an SQL CASE
|
||||
private final Map subclassesByDiscriminatorValue = new HashMap();
|
||||
private final Map<Object,String> subclassesByDiscriminatorValue = new HashMap<>();
|
||||
private final String[] discriminatorValues;
|
||||
private final String[] notNullColumnNames;
|
||||
private final int[] notNullColumnTableNumbers;
|
||||
|
@ -152,7 +142,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
private final Object discriminatorValue;
|
||||
private final String discriminatorSQLString;
|
||||
private final DiscriminatorType discriminatorType;
|
||||
private final DiscriminatorType<?> discriminatorType;
|
||||
private final String explicitDiscriminatorColumnName;
|
||||
private final String discriminatorAlias;
|
||||
|
||||
|
@ -188,7 +178,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
log.debug( "Encountered explicit discriminator mapping for joined inheritance" );
|
||||
|
||||
final Selectable selectable = discriminatorMapping.getColumnIterator().next();
|
||||
if ( Formula.class.isInstance( selectable ) ) {
|
||||
if ( selectable instanceof Formula ) {
|
||||
throw new MappingException( "Discriminator formulas on joined inheritance hierarchies not supported at this time" );
|
||||
}
|
||||
else {
|
||||
|
@ -196,7 +186,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() );
|
||||
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
|
||||
}
|
||||
discriminatorType = (DiscriminatorType) persistentClass.getDiscriminator().getType();
|
||||
discriminatorType = (DiscriminatorType<?>) persistentClass.getDiscriminator().getType();
|
||||
if ( persistentClass.isDiscriminatorValueNull() ) {
|
||||
discriminatorValue = NULL_DISCRIMINATOR;
|
||||
discriminatorSQLString = InFragment.NULL;
|
||||
|
@ -208,7 +198,10 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
else {
|
||||
try {
|
||||
discriminatorValue = discriminatorType.stringToObject( persistentClass.getDiscriminatorValue() );
|
||||
discriminatorSQLString = discriminatorType.objectToSQLString( discriminatorValue, factory.getDialect() );
|
||||
discriminatorSQLString = ((DiscriminatorType) discriminatorType).objectToSQLString(
|
||||
discriminatorValue,
|
||||
factory.getJdbcServices().getDialect()
|
||||
);
|
||||
}
|
||||
catch (ClassCastException cce) {
|
||||
throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
|
||||
|
@ -252,27 +245,27 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
ArrayList<String[]> keyColumnReaders = new ArrayList<>();
|
||||
ArrayList<String[]> keyColumnReaderTemplates = new ArrayList<>();
|
||||
ArrayList<Boolean> cascadeDeletes = new ArrayList<>();
|
||||
Iterator tItr = persistentClass.getTableClosureIterator();
|
||||
Iterator kItr = persistentClass.getKeyClosureIterator();
|
||||
Iterator<Table> tItr = persistentClass.getTableClosureIterator();
|
||||
Iterator<KeyValue> kItr = persistentClass.getKeyClosureIterator();
|
||||
while ( tItr.hasNext() ) {
|
||||
final Table table = (Table) tItr.next();
|
||||
final KeyValue key = (KeyValue) kItr.next();
|
||||
final Table table = tItr.next();
|
||||
final KeyValue key = kItr.next();
|
||||
final String tableName = determineTableName( table, jdbcEnvironment );
|
||||
tableNames.add( tableName );
|
||||
String[] keyCols = new String[idColumnSpan];
|
||||
String[] keyColReaders = new String[idColumnSpan];
|
||||
String[] keyColReaderTemplates = new String[idColumnSpan];
|
||||
Iterator cItr = key.getColumnIterator();
|
||||
Iterator<Selectable> cItr = key.getColumnIterator();
|
||||
for ( int k = 0; k < idColumnSpan; k++ ) {
|
||||
Column column = (Column) cItr.next();
|
||||
keyCols[k] = column.getQuotedName( factory.getDialect() );
|
||||
keyColReaders[k] = column.getReadExpr( factory.getDialect() );
|
||||
keyColReaderTemplates[k] = column.getTemplate( factory.getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
keyCols[k] = column.getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
keyColReaders[k] = column.getReadExpr( factory.getJdbcServices().getDialect() );
|
||||
keyColReaderTemplates[k] = column.getTemplate( factory.getJdbcServices().getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
}
|
||||
keyColumns.add( keyCols );
|
||||
keyColumnReaders.add( keyColReaders );
|
||||
keyColumnReaderTemplates.add( keyColReaderTemplates );
|
||||
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() );
|
||||
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getJdbcServices().getDialect().supportsCascadeDelete() );
|
||||
}
|
||||
|
||||
//Span of the tableNames directly mapped by this entity and super-classes, if any
|
||||
|
@ -282,9 +275,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
isNullableTable = new boolean[tableSpan];
|
||||
isInverseTable = new boolean[tableSpan];
|
||||
|
||||
Iterator joinItr = persistentClass.getJoinClosureIterator();
|
||||
Iterator<Join> joinItr = persistentClass.getJoinClosureIterator();
|
||||
for ( int tableIndex = 0; joinItr.hasNext(); tableIndex++ ) {
|
||||
Join join = (Join) joinItr.next();
|
||||
Join join = joinItr.next();
|
||||
|
||||
isNullableTable[tableIndex] = join.isOptional();
|
||||
isInverseTable[tableIndex] = join.isInverse();
|
||||
|
@ -300,18 +293,17 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
String[] keyColReaders = new String[joinIdColumnSpan];
|
||||
String[] keyColReaderTemplates = new String[joinIdColumnSpan];
|
||||
|
||||
Iterator cItr = key.getColumnIterator();
|
||||
|
||||
Iterator<Selectable> cItr = key.getColumnIterator();
|
||||
for ( int k = 0; k < joinIdColumnSpan; k++ ) {
|
||||
Column column = (Column) cItr.next();
|
||||
keyCols[k] = column.getQuotedName( factory.getDialect() );
|
||||
keyColReaders[k] = column.getReadExpr( factory.getDialect() );
|
||||
keyColReaderTemplates[k] = column.getTemplate( factory.getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
keyCols[k] = column.getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
keyColReaders[k] = column.getReadExpr( factory.getJdbcServices().getDialect() );
|
||||
keyColReaderTemplates[k] = column.getTemplate( factory.getJdbcServices().getDialect(), factory.getQueryEngine().getSqmFunctionRegistry() );
|
||||
}
|
||||
keyColumns.add( keyCols );
|
||||
keyColumnReaders.add( keyColReaders );
|
||||
keyColumnReaderTemplates.add( keyColReaderTemplates );
|
||||
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getDialect().supportsCascadeDelete() );
|
||||
cascadeDeletes.add( key.isCascadeDeleteEnabled() && factory.getJdbcServices().getDialect().supportsCascadeDelete() );
|
||||
}
|
||||
|
||||
naturalOrderTableNames = ArrayHelper.toStringArray( tableNames );
|
||||
|
@ -330,7 +322,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
keyColumns = new ArrayList<>();
|
||||
tItr = persistentClass.getSubclassTableClosureIterator();
|
||||
while ( tItr.hasNext() ) {
|
||||
Table tab = (Table) tItr.next();
|
||||
Table tab = tItr.next();
|
||||
isConcretes.add( persistentClass.isClassOrSuperclassTable( tab ) );
|
||||
isDeferreds.add( Boolean.FALSE );
|
||||
isLazies.add( Boolean.FALSE );
|
||||
|
@ -339,9 +331,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
final String tableName = determineTableName( tab, jdbcEnvironment );
|
||||
subclassTableNames.add( tableName );
|
||||
String[] key = new String[idColumnSpan];
|
||||
Iterator cItr = tab.getPrimaryKey().getColumnIterator();
|
||||
Iterator<Column> cItr = tab.getPrimaryKey().getColumnIterator();
|
||||
for ( int k = 0; k < idColumnSpan; k++ ) {
|
||||
key[k] = ( (Column) cItr.next() ).getQuotedName( factory.getDialect() );
|
||||
key[k] = cItr.next().getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
keyColumns.add( key );
|
||||
}
|
||||
|
@ -349,7 +341,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
//Add joins
|
||||
joinItr = persistentClass.getSubclassJoinClosureIterator();
|
||||
while ( joinItr.hasNext() ) {
|
||||
final Join join = (Join) joinItr.next();
|
||||
final Join join = joinItr.next();
|
||||
final Table joinTable = join.getTable();
|
||||
|
||||
isConcretes.add( persistentClass.isClassOrSuperclassTable( joinTable ) );
|
||||
|
@ -361,9 +353,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
String joinTableName = determineTableName( joinTable, jdbcEnvironment );
|
||||
subclassTableNames.add( joinTableName );
|
||||
String[] key = new String[idColumnSpan];
|
||||
Iterator citer = joinTable.getPrimaryKey().getColumnIterator();
|
||||
Iterator<Column> citer = joinTable.getPrimaryKey().getColumnIterator();
|
||||
for ( int k = 0; k < idColumnSpan; k++ ) {
|
||||
key[k] = ( (Column) citer.next() ).getQuotedName( factory.getDialect() );
|
||||
key[k] = citer.next().getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
keyColumns.add( key );
|
||||
}
|
||||
|
@ -384,7 +376,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
constraintOrderedKeyColumnNames[currentPosition] = naturalOrderSubclassTableKeyColumnClosure[i];
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Suppose an entity Client extends Person, mapped to the tableNames CLIENT and PERSON respectively.
|
||||
* For the Client entity:
|
||||
* naturalOrderTableNames -> PERSON, CLIENT; this reflects the sequence in which the tableNames are
|
||||
|
@ -450,7 +442,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
joinItr = persistentClass.getJoinClosureIterator();
|
||||
int j = coreTableSpan;
|
||||
while ( joinItr.hasNext() ) {
|
||||
Join join = (Join) joinItr.next();
|
||||
Join join = joinItr.next();
|
||||
|
||||
isInverseTable[j] = join.isInverse();
|
||||
isNullableTable[j] = join.isOptional();
|
||||
|
@ -477,12 +469,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
int hydrateSpan = getPropertySpan();
|
||||
naturalOrderPropertyTableNumbers = new int[hydrateSpan];
|
||||
propertyTableNumbers = new int[hydrateSpan];
|
||||
Iterator iter = persistentClass.getPropertyClosureIterator();
|
||||
Iterator<Property> iter = persistentClass.getPropertyClosureIterator();
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
Property prop = iter.next();
|
||||
String tabname = prop.getValue().getTable().getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
);
|
||||
|
@ -495,25 +487,25 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
//TODO: code duplication with SingleTableEntityPersister
|
||||
|
||||
ArrayList columnTableNumbers = new ArrayList();
|
||||
ArrayList formulaTableNumbers = new ArrayList();
|
||||
ArrayList propTableNumbers = new ArrayList();
|
||||
ArrayList<Integer> columnTableNumbers = new ArrayList<>();
|
||||
ArrayList<Integer> formulaTableNumbers = new ArrayList<>();
|
||||
ArrayList<Integer> propTableNumbers = new ArrayList<>();
|
||||
|
||||
iter = persistentClass.getSubclassPropertyClosureIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
Property prop = iter.next();
|
||||
Table tab = prop.getValue().getTable();
|
||||
String tabname = tab.getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
);
|
||||
Integer tabnum = getTableId( tabname, subclassTableNameClosure );
|
||||
propTableNumbers.add( tabnum );
|
||||
|
||||
Iterator citer = prop.getColumnIterator();
|
||||
Iterator<Selectable> citer = prop.getColumnIterator();
|
||||
while ( citer.hasNext() ) {
|
||||
Selectable thing = (Selectable) citer.next();
|
||||
Selectable thing = citer.next();
|
||||
if ( thing.isFormula() ) {
|
||||
formulaTableNumbers.add( tabnum );
|
||||
}
|
||||
|
@ -552,7 +544,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
notNullColumnTableNumbers = new int[subclassSpan];
|
||||
final int id = getTableId(
|
||||
table.getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
),
|
||||
|
@ -574,18 +566,18 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
}
|
||||
else {
|
||||
subclassNameByTableName = Collections.EMPTY_MAP;
|
||||
discriminatorValuesByTableName = Collections.EMPTY_MAP;
|
||||
discriminatorColumnNameByTableName = Collections.EMPTY_MAP;
|
||||
subclassNameByTableName = emptyMap();
|
||||
discriminatorValuesByTableName = emptyMap();
|
||||
discriminatorColumnNameByTableName = emptyMap();
|
||||
discriminatorValues = null;
|
||||
notNullColumnTableNumbers = null;
|
||||
notNullColumnNames = null;
|
||||
}
|
||||
|
||||
iter = persistentClass.getSubclassIterator();
|
||||
Iterator<Subclass> siter = persistentClass.getSubclassIterator();
|
||||
int k = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Subclass sc = (Subclass) iter.next();
|
||||
while ( siter.hasNext() ) {
|
||||
Subclass sc = siter.next();
|
||||
subclassClosure[k] = sc.getEntityName();
|
||||
final Table table = sc.getTable();
|
||||
subclassNameByTableName.put( table.getName(), sc.getClassName() );
|
||||
|
@ -621,7 +613,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
subclassesByDiscriminatorValue.put( discriminatorValue, sc.getEntityName() );
|
||||
int id = getTableId(
|
||||
table.getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
),
|
||||
|
@ -652,7 +644,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
Table table,
|
||||
Object discriminatorValue) {
|
||||
final String tableName = determineTableName( table, jdbcEnvironment );
|
||||
final String columnName = table.getPrimaryKey().getColumn( 0 ).getQuotedName( factory.getDialect() );
|
||||
final String columnName = table.getPrimaryKey().getColumn( 0 ).getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
discriminatorValuesByTableName.put( tableName, discriminatorValue );
|
||||
discriminatorColumnNameByTableName.put( tableName, columnName );
|
||||
discriminatorValues[k] = discriminatorValue.toString();
|
||||
|
@ -698,8 +690,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
* Essentially we are building a mapping that we can later use to determine whether a given "subclass table"
|
||||
* should be included in joins when JPA TREAT-AS is used.
|
||||
*
|
||||
* @param persistentClass
|
||||
* @param factory
|
||||
* @return subclassNamesBySubclassTable
|
||||
*/
|
||||
private String[][] buildSubclassNamesBySubclassTableMapping(PersistentClass persistentClass, SessionFactoryImplementor factory) {
|
||||
|
@ -725,9 +715,9 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
// included when one of the collected class names is used in TREAT
|
||||
final Set<String> classNames = new HashSet<>();
|
||||
|
||||
final Iterator itr = persistentClass.getDirectSubclasses();
|
||||
final Iterator<Subclass> itr = persistentClass.getDirectSubclasses();
|
||||
while ( itr.hasNext() ) {
|
||||
final Subclass subclass = (Subclass) itr.next();
|
||||
final Subclass subclass = itr.next();
|
||||
final Set<String> subclassSubclassNames = processPersistentClassHierarchy(
|
||||
subclass,
|
||||
false,
|
||||
|
@ -759,18 +749,18 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
SessionFactoryImplementor factory) {
|
||||
|
||||
final String tableName = persistentClass.getTable().getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
);
|
||||
|
||||
associateSubclassNamesToSubclassTableIndex( tableName, classNames, mapping );
|
||||
|
||||
Iterator itr = persistentClass.getJoinIterator();
|
||||
Iterator<Join> itr = persistentClass.getJoinIterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final Join join = (Join) itr.next();
|
||||
final Join join = itr.next();
|
||||
final String secondaryTableName = join.getTable().getQualifiedName(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getSettings().getDefaultCatalogName(),
|
||||
factory.getSettings().getDefaultSchemaName()
|
||||
);
|
||||
|
@ -798,7 +788,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
)
|
||||
);
|
||||
}
|
||||
mapping[index] = classNames.toArray( new String[ classNames.size() ] );
|
||||
mapping[index] = ArrayHelper.toStringArray( classNames );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -881,7 +871,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
return (String) subclassesByDiscriminatorValue.get( value );
|
||||
return subclassesByDiscriminatorValue.get( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -915,9 +905,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
/**
|
||||
* Reverse the first n elements of the incoming array
|
||||
*
|
||||
* @param objects
|
||||
* @param n
|
||||
*
|
||||
* @return New array with the first n elements in reversed order
|
||||
*/
|
||||
private static String[] reverse(String[] objects, int n) {
|
||||
|
@ -939,9 +926,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
/**
|
||||
* Reverse the first n elements of the incoming array
|
||||
*
|
||||
* @param objects
|
||||
* @param n
|
||||
*
|
||||
* @return New array with the first n elements in reversed order
|
||||
*/
|
||||
private static String[][] reverse(String[][] objects, int n) {
|
||||
|
@ -991,7 +975,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
|
||||
private CaseFragment discriminatorFragment(String alias) {
|
||||
CaseFragment cases = getFactory().getDialect().createCaseFragment();
|
||||
CaseFragment cases = getFactory().getJdbcServices().getDialect().createCaseFragment();
|
||||
|
||||
for ( int i = 0; i < discriminatorValues.length; i++ ) {
|
||||
cases.addWhenColumnNotNull(
|
||||
|
@ -1270,7 +1254,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
bootEntityDescriptor.getIdentifierProperty().getName(),
|
||||
getTableName(),
|
||||
tableKeyColumns[0][0],
|
||||
(BasicType) idType,
|
||||
(BasicType<?>) idType,
|
||||
creationProcess
|
||||
);
|
||||
}
|
||||
|
@ -1336,7 +1320,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
getDiscriminatorFormulaTemplate() != null,
|
||||
info.caseSearchedExpression,
|
||||
info.columnReferences,
|
||||
(BasicType) getDiscriminatorType()
|
||||
(BasicType<?>) getDiscriminatorType()
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -1354,9 +1338,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
consumer.consume(
|
||||
tableName,
|
||||
() -> columnConsumer -> {
|
||||
columnConsumer.accept(tableName, constraintOrderedKeyColumnNames[tablePosition]);
|
||||
}
|
||||
() -> columnConsumer -> columnConsumer.accept( tableName, constraintOrderedKeyColumnNames[tablePosition] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1370,10 +1352,10 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
CaseSearchedExpressionInfo info = new CaseSearchedExpressionInfo();
|
||||
|
||||
final TableReference primaryTableReference = entityTableGroup.getPrimaryTableReference();
|
||||
final BasicType discriminatorType = (BasicType) getDiscriminatorType();
|
||||
final BasicType<?> discriminatorType = (BasicType<?>) getDiscriminatorType();
|
||||
final CaseSearchedExpression caseSearchedExpression = new CaseSearchedExpression( discriminatorType );
|
||||
|
||||
Boolean addPrimaryTableCaseAsLastCaseExpression = false;
|
||||
boolean addPrimaryTableCaseAsLastCaseExpression = false;
|
||||
for ( String tableName : discriminatorValuesByTableName.keySet() ) {
|
||||
if ( !primaryTableReference.getTableExpression().equals( tableName ) ) {
|
||||
TableReference tableReference = entityTableGroup.getTableReference( tableName );
|
||||
|
@ -1414,7 +1396,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
|||
CaseSearchedExpression caseSearchedExpression,
|
||||
TableReference table,
|
||||
ColumnReference identifierColumnReference,
|
||||
BasicType resultType) {
|
||||
BasicType<?> resultType) {
|
||||
final Predicate predicate = new NullnessPredicate( identifierColumnReference, true );
|
||||
final Expression expression = new QueryLiteral<>(
|
||||
discriminatorValuesByTableName.get( table.getTableExpression() ),
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.persister.entity;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -61,6 +60,8 @@ import org.hibernate.type.BasicType;
|
|||
import org.hibernate.type.DiscriminatorType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
/**
|
||||
* The default implementation of the <tt>EntityPersister</tt> interface.
|
||||
* Implements the "table-per-class-hierarchy" or "roll-up" mapping strategy
|
||||
|
@ -113,7 +114,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
private final String discriminatorFormula;
|
||||
private final String discriminatorFormulaTemplate;
|
||||
private final String discriminatorAlias;
|
||||
private final Type discriminatorType;
|
||||
private final DiscriminatorType<?> discriminatorType;
|
||||
private final Object discriminatorValue;
|
||||
private final String discriminatorSQLValue;
|
||||
private final boolean discriminatorInsertable;
|
||||
|
@ -129,8 +130,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
private static final Object NULL_DISCRIMINATOR = new MarkerObject( "<null discriminator>" );
|
||||
private static final Object NOT_NULL_DISCRIMINATOR = new MarkerObject( "<not null discriminator>" );
|
||||
private static final String NULL_STRING = "null";
|
||||
private static final String NOT_NULL_STRING = "not null";
|
||||
|
||||
//INITIALIZATION:
|
||||
|
||||
|
@ -191,15 +190,15 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
// JOINS
|
||||
|
||||
Iterator joinIter = persistentClass.getJoinClosureIterator();
|
||||
Iterator<Join> joinIter = persistentClass.getJoinClosureIterator();
|
||||
int j = 1;
|
||||
while ( joinIter.hasNext() ) {
|
||||
Join join = (Join) joinIter.next();
|
||||
Join join = joinIter.next();
|
||||
qualifiedTableNames[j] = determineTableName( join.getTable(), jdbcEnvironment );
|
||||
isInverseTable[j] = join.isInverse();
|
||||
isNullableTable[j] = join.isOptional();
|
||||
cascadeDeleteEnabled[j] = join.getKey().isCascadeDeleteEnabled() &&
|
||||
factory.getDialect().supportsCascadeDelete();
|
||||
factory.getJdbcServices().getDialect().supportsCascadeDelete();
|
||||
|
||||
customSQLInsert[j] = join.getCustomSQLInsert();
|
||||
insertCallable[j] = customSQLInsert[j] != null && join.isCustomInsertCallable();
|
||||
|
@ -217,12 +216,12 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[j], deleteCallable[j] )
|
||||
: join.getCustomSQLDeleteCheckStyle();
|
||||
|
||||
Iterator iter = join.getKey().getColumnIterator();
|
||||
Iterator<Selectable> iter = join.getKey().getColumnIterator();
|
||||
keyColumnNames[j] = new String[join.getKey().getColumnSpan()];
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Column col = (Column) iter.next();
|
||||
keyColumnNames[j][i++] = col.getQuotedName( factory.getDialect() );
|
||||
keyColumnNames[j][i++] = col.getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
|
||||
j++;
|
||||
|
@ -261,7 +260,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
isLazies.add( Boolean.FALSE );
|
||||
joinIter = persistentClass.getSubclassJoinClosureIterator();
|
||||
while ( joinIter.hasNext() ) {
|
||||
Join join = (Join) joinIter.next();
|
||||
Join join = joinIter.next();
|
||||
isConcretes.add( persistentClass.isClassOrSuperclassTable( join.getTable() ) );
|
||||
isClassOrSuperclassJoins.add( persistentClass.isClassOrSuperclassJoin( join ) );
|
||||
isInverses.add( join.isInverse() );
|
||||
|
@ -275,12 +274,12 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
String joinTableName = determineTableName( join.getTable(), jdbcEnvironment );
|
||||
subclassTables.add( joinTableName );
|
||||
|
||||
Iterator iter = join.getKey().getColumnIterator();
|
||||
Iterator<Selectable> iter = join.getKey().getColumnIterator();
|
||||
String[] keyCols = new String[join.getKey().getColumnSpan()];
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Column col = (Column) iter.next();
|
||||
keyCols[i++] = col.getQuotedName( factory.getDialect() );
|
||||
keyCols[i++] = col.getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
joinKeyColumns.add( keyCols );
|
||||
}
|
||||
|
@ -295,7 +294,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
isNullableSubclassTable = ArrayHelper.toBooleanArray( isNullables );
|
||||
hasSequentialSelects = hasDeferred;
|
||||
|
||||
this.sequentialSelectStringsByEntityName = hasSequentialSelects ? new HashMap<>() : Collections.EMPTY_MAP;
|
||||
sequentialSelectStringsByEntityName = hasSequentialSelects ? new HashMap<>() : emptyMap();
|
||||
|
||||
// DISCRIMINATOR
|
||||
|
||||
|
@ -310,7 +309,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
Formula formula = (Formula) selectable;
|
||||
discriminatorFormula = formula.getFormula();
|
||||
discriminatorFormulaTemplate = formula.getTemplate(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getQueryEngine().getSqmFunctionRegistry()
|
||||
);
|
||||
discriminatorColumnName = null;
|
||||
|
@ -320,17 +319,17 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
else {
|
||||
Column column = (Column) selectable;
|
||||
discriminatorColumnName = column.getQuotedName( factory.getDialect() );
|
||||
discriminatorColumnReaders = column.getReadExpr( factory.getDialect() );
|
||||
discriminatorColumnName = column.getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
discriminatorColumnReaders = column.getReadExpr( factory.getJdbcServices().getDialect() );
|
||||
discriminatorColumnReaderTemplate = column.getTemplate(
|
||||
factory.getDialect(),
|
||||
factory.getJdbcServices().getDialect(),
|
||||
factory.getQueryEngine().getSqmFunctionRegistry()
|
||||
);
|
||||
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
|
||||
discriminatorAlias = column.getAlias( factory.getJdbcServices().getDialect(), persistentClass.getRootTable() );
|
||||
discriminatorFormula = null;
|
||||
discriminatorFormulaTemplate = null;
|
||||
}
|
||||
discriminatorType = persistentClass.getDiscriminator().getType();
|
||||
discriminatorType = (DiscriminatorType<?>) persistentClass.getDiscriminator().getType();
|
||||
if ( persistentClass.isDiscriminatorValueNull() ) {
|
||||
discriminatorValue = NULL_DISCRIMINATOR;
|
||||
discriminatorSQLValue = InFragment.NULL;
|
||||
|
@ -344,9 +343,8 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
else {
|
||||
discriminatorInsertable = persistentClass.isDiscriminatorInsertable() && !discrimValue.hasFormula();
|
||||
try {
|
||||
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
|
||||
discriminatorValue = dtype.stringToObject( persistentClass.getDiscriminatorValue() );
|
||||
discriminatorSQLValue = dtype.objectToSQLString( discriminatorValue, factory.getDialect() );
|
||||
discriminatorValue = discriminatorType.stringToObject( persistentClass.getDiscriminatorValue() );
|
||||
discriminatorSQLValue = ((DiscriminatorType) discriminatorType).objectToSQLString( discriminatorValue, factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
catch (ClassCastException cce) {
|
||||
throw new MappingException( "Illegal discriminator type: " + discriminatorType.getName() );
|
||||
|
@ -373,10 +371,10 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
// PROPERTIES
|
||||
|
||||
propertyTableNumbers = new int[getPropertySpan()];
|
||||
Iterator iter = persistentClass.getPropertyClosureIterator();
|
||||
Iterator<Property> props = persistentClass.getPropertyClosureIterator();
|
||||
int i = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
while ( props.hasNext() ) {
|
||||
Property prop = props.next();
|
||||
propertyTableNumbers[i++] = persistentClass.getJoinNumber( prop );
|
||||
|
||||
}
|
||||
|
@ -390,9 +388,9 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
final HashMap<String, Integer> propertyTableNumbersByNameAndSubclassLocal = new HashMap<>();
|
||||
final Map<Object, String> subclassesByDiscriminatorValueLocal = new HashMap<>();
|
||||
|
||||
iter = persistentClass.getSubclassPropertyClosureIterator();
|
||||
Iterator<Property> iter = persistentClass.getSubclassPropertyClosureIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
Property prop = iter.next();
|
||||
Integer join = persistentClass.getJoinNumber( prop );
|
||||
propertyJoinNumbers.add( join );
|
||||
|
||||
|
@ -402,9 +400,9 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
join
|
||||
);
|
||||
|
||||
Iterator citer = prop.getColumnIterator();
|
||||
Iterator<Selectable> citer = prop.getColumnIterator();
|
||||
while ( citer.hasNext() ) {
|
||||
Selectable thing = (Selectable) citer.next();
|
||||
Selectable thing = citer.next();
|
||||
if ( thing.isFormula() ) {
|
||||
formulaJoinedNumbers.add( join );
|
||||
}
|
||||
|
@ -429,10 +427,10 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
// SUBCLASSES
|
||||
if ( persistentClass.isPolymorphic() ) {
|
||||
iter = persistentClass.getSubclassIterator();
|
||||
Iterator<Subclass> subclasses = persistentClass.getSubclassIterator();
|
||||
int k = 1;
|
||||
while ( iter.hasNext() ) {
|
||||
Subclass sc = (Subclass) iter.next();
|
||||
while ( subclasses.hasNext() ) {
|
||||
Subclass sc = subclasses.next();
|
||||
subclassClosure[k++] = sc.getEntityName();
|
||||
if ( sc.isDiscriminatorValueNull() ) {
|
||||
addSubclassByDiscriminatorValue( subclassesByDiscriminatorValueLocal, NULL_DISCRIMINATOR, sc.getEntityName() );
|
||||
|
@ -442,10 +440,9 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
}
|
||||
else {
|
||||
try {
|
||||
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
|
||||
addSubclassByDiscriminatorValue(
|
||||
subclassesByDiscriminatorValueLocal,
|
||||
dtype.stringToObject( sc.getDiscriminatorValue() ),
|
||||
discriminatorType.stringToObject( sc.getDiscriminatorValue() ),
|
||||
sc.getEntityName()
|
||||
);
|
||||
}
|
||||
|
@ -652,7 +649,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
private String[] decodeTreatAsRequests(Set<String> treatAsDeclarations) {
|
||||
final List<String> values = new ArrayList<>();
|
||||
for ( String subclass : treatAsDeclarations ) {
|
||||
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
|
||||
final Queryable queryable = (Queryable) getFactory().getMetamodel().entityPersister( subclass );
|
||||
if ( !queryable.isAbstract() ) {
|
||||
values.add( queryable.getDiscriminatorSQLValue() );
|
||||
}
|
||||
|
@ -665,14 +662,14 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
continue;
|
||||
}
|
||||
|
||||
Queryable actualQueryable = (Queryable) getFactory().getEntityPersister( actualSubClass );
|
||||
Queryable actualQueryable = (Queryable) getFactory().getMetamodel().entityPersister( actualSubClass );
|
||||
if ( !actualQueryable.hasSubclasses() ) {
|
||||
values.add( actualQueryable.getDiscriminatorSQLValue() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return values.toArray( new String[values.size()] );
|
||||
return ArrayHelper.toStringArray( values );
|
||||
}
|
||||
|
||||
private String[] fullDiscriminatorValues;
|
||||
|
@ -682,12 +679,12 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
// first access; build it
|
||||
final List<String> values = new ArrayList<>();
|
||||
for ( String subclass : getSubclassClosure() ) {
|
||||
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
|
||||
final Queryable queryable = (Queryable) getFactory().getMetamodel().entityPersister( subclass );
|
||||
if ( !queryable.isAbstract() ) {
|
||||
values.add( queryable.getDiscriminatorSQLValue() );
|
||||
}
|
||||
}
|
||||
fullDiscriminatorValues = values.toArray( new String[values.size()] );
|
||||
fullDiscriminatorValues = ArrayHelper.toStringArray( values );
|
||||
}
|
||||
|
||||
return fullDiscriminatorValues;
|
||||
|
@ -870,7 +867,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
if ( hasSequentialSelects ) {
|
||||
String[] entityNames = getSubclassClosure();
|
||||
for ( int i = 1; i < entityNames.length; i++ ) {
|
||||
Loadable loadable = (Loadable) getFactory().getEntityPersister( entityNames[i] );
|
||||
Loadable loadable = (Loadable) getFactory().getMetamodel().entityPersister( entityNames[i] );
|
||||
if ( !loadable.isAbstract() ) { //perhaps not really necessary...
|
||||
String sequentialSelect = generateSequentialSelect( loadable );
|
||||
sequentialSelectStringsByEntityName.put( entityNames[i], sequentialSelect );
|
||||
|
@ -980,9 +977,7 @@ public class SingleTableEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
consumer.consume(
|
||||
tableName,
|
||||
() -> columnConsumer -> {
|
||||
columnConsumer.accept(tableName, constraintOrderedKeyColumnNames[tablePosition]);
|
||||
}
|
||||
() -> columnConsumer -> columnConsumer.accept( tableName, constraintOrderedKeyColumnNames[tablePosition] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
private final String[] subclassSpaces;
|
||||
private final Object discriminatorValue;
|
||||
private final String discriminatorSQLValue;
|
||||
private final Map subclassByDiscriminatorValue = new HashMap();
|
||||
private final Map<Object,String> subclassByDiscriminatorValue = new HashMap<>();
|
||||
|
||||
private final String[] constraintOrderedTableNames;
|
||||
private final String[][] constraintOrderedKeyColumnNames;
|
||||
|
@ -145,8 +145,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
// PROPERTIES
|
||||
|
||||
int subclassSpan = persistentClass.getSubclassSpan() + 1;
|
||||
|
||||
// SUBCLASSES
|
||||
subclassByDiscriminatorValue.put(
|
||||
persistentClass.getSubclassId(),
|
||||
|
@ -172,7 +170,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
spaces[i] = iter.next();
|
||||
}
|
||||
|
||||
HashSet<String> subclassTables = new HashSet();
|
||||
HashSet<String> subclassTables = new HashSet<>();
|
||||
Iterator<Table> subclassTableIter = persistentClass.getSubclassTableClosureIterator();
|
||||
while ( subclassTableIter.hasNext() ) {
|
||||
subclassTables.add( determineTableName( subclassTableIter.next(), jdbcEnvironment ) );
|
||||
|
@ -194,7 +192,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
String[] key = new String[idColumnSpan];
|
||||
Iterator<Column> citer = tab.getPrimaryKey().getColumnIterator();
|
||||
for ( int k = 0; k < idColumnSpan; k++ ) {
|
||||
key[k] = citer.next().getQuotedName( factory.getDialect() );
|
||||
key[k] = citer.next().getQuotedName( factory.getJdbcServices().getDialect() );
|
||||
}
|
||||
keyColumns.add( key );
|
||||
}
|
||||
|
@ -285,7 +283,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
@Override
|
||||
public String getSubclassForDiscriminatorValue(Object value) {
|
||||
return (String) subclassByDiscriminatorValue.get( value );
|
||||
return subclassByDiscriminatorValue.get( value );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -383,9 +381,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
consumer.consume(
|
||||
tableName,
|
||||
() -> columnConsumer -> {
|
||||
columnConsumer.accept(tableName, constraintOrderedKeyColumnNames[tablePosition]);
|
||||
}
|
||||
() -> columnConsumer -> columnConsumer.accept( tableName, constraintOrderedKeyColumnNames[tablePosition] )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -424,7 +420,7 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
|
||||
protected String generateSubquery(PersistentClass model, Mapping mapping) {
|
||||
|
||||
Dialect dialect = getFactory().getDialect();
|
||||
Dialect dialect = getFactory().getJdbcServices().getDialect();
|
||||
Settings settings = getFactory().getSettings();
|
||||
|
||||
if ( !model.hasSubclasses() ) {
|
||||
|
@ -435,12 +431,12 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
);
|
||||
}
|
||||
|
||||
HashSet columns = new LinkedHashSet();
|
||||
Iterator titer = model.getSubclassTableClosureIterator();
|
||||
HashSet<Column> columns = new LinkedHashSet<>();
|
||||
Iterator<Table> titer = model.getSubclassTableClosureIterator();
|
||||
while ( titer.hasNext() ) {
|
||||
Table table = (Table) titer.next();
|
||||
Table table = titer.next();
|
||||
if ( !table.isAbstractUnionTable() ) {
|
||||
Iterator citer = table.getColumnIterator();
|
||||
Iterator<Column> citer = table.getColumnIterator();
|
||||
while ( citer.hasNext() ) {
|
||||
columns.add( citer.next() );
|
||||
}
|
||||
|
@ -450,27 +446,25 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
|||
StringBuilder buf = new StringBuilder()
|
||||
.append( "( " );
|
||||
|
||||
Iterator siter = new JoinedIterator(
|
||||
new SingletonIterator( model ),
|
||||
Iterator<PersistentClass> siter = new JoinedIterator<>(
|
||||
new SingletonIterator<>( model ),
|
||||
model.getSubclassIterator()
|
||||
);
|
||||
|
||||
while ( siter.hasNext() ) {
|
||||
PersistentClass clazz = (PersistentClass) siter.next();
|
||||
PersistentClass clazz = siter.next();
|
||||
Table table = clazz.getTable();
|
||||
if ( !table.isAbstractUnionTable() ) {
|
||||
//TODO: move to .sql package!!
|
||||
buf.append( "select " );
|
||||
Iterator citer = columns.iterator();
|
||||
while ( citer.hasNext() ) {
|
||||
Column col = (Column) citer.next();
|
||||
if ( !table.containsColumn( col ) ) {
|
||||
int sqlType = col.getSqlTypeCode( mapping );
|
||||
buf.append( dialect.getSelectClauseNullString( sqlType ) )
|
||||
.append( " as " );
|
||||
for ( Column col : columns ) {
|
||||
if ( !table.containsColumn(col) ) {
|
||||
int sqlType = col.getSqlTypeCode(mapping);
|
||||
buf.append( dialect.getSelectClauseNullString(sqlType) )
|
||||
.append(" as ");
|
||||
}
|
||||
buf.append( col.getQuotedName( dialect ) );
|
||||
buf.append( ", " );
|
||||
buf.append(col.getQuotedName(dialect));
|
||||
buf.append(", ");
|
||||
}
|
||||
buf.append( clazz.getSubclassId() )
|
||||
.append( " as clazz_" );
|
||||
|
|
|
@ -69,8 +69,7 @@ public abstract class AbstractLiteral<T>
|
|||
.getTypeConfiguration()
|
||||
);
|
||||
|
||||
//noinspection unchecked
|
||||
return new BasicResult<>(
|
||||
return new BasicResult(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
type.getMappedType().getMappedJavaTypeDescriptor()
|
||||
|
|
|
@ -73,8 +73,7 @@ public class QueryLiteral<T> implements Literal, DomainResultProducer<T> {
|
|||
.getTypeConfiguration()
|
||||
);
|
||||
|
||||
//noinspection unchecked
|
||||
return new BasicResult<>(
|
||||
return new BasicResult(
|
||||
sqlSelection.getValuesArrayPosition(),
|
||||
resultVariable,
|
||||
type.getMappedType().getMappedJavaTypeDescriptor()
|
||||
|
|
|
@ -135,7 +135,7 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return fetchable.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public class CircularFetchImpl implements BiDirectionalFetch, Association {
|
|||
}
|
||||
|
||||
@Override
|
||||
public JavaTypeDescriptor getJavaTypeDescriptor() {
|
||||
public JavaTypeDescriptor<?> getJavaTypeDescriptor() {
|
||||
return fetchable.getJavaTypeDescriptor();
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class EntityMetamodel implements Serializable {
|
|||
private final boolean explicitPolymorphism;
|
||||
private final boolean inherited;
|
||||
private final boolean hasSubclasses;
|
||||
private final Set subclassEntityNames;
|
||||
private final Set<String> subclassEntityNames;
|
||||
private final Map<Class,String> entityNameByInheritenceClassMap;
|
||||
|
||||
private final BytecodeEnhancementMetadata bytecodeEnhancementMetadata;
|
||||
|
@ -154,7 +154,6 @@ public class EntityMetamodel implements Serializable {
|
|||
if ( identifierMapperComponent != null ) {
|
||||
nonAggregatedCidMapper = (CompositeType) identifierMapperComponent.getType();
|
||||
idAttributeNames = new HashSet<>( );
|
||||
//noinspection unchecked
|
||||
final Iterator<Property> propertyItr = identifierMapperComponent.getPropertyIterator();
|
||||
while ( propertyItr.hasNext() ) {
|
||||
idAttributeNames.add( propertyItr.next().getName() );
|
||||
|
@ -205,7 +204,7 @@ public class EntityMetamodel implements Serializable {
|
|||
boolean foundPostUpdateGeneratedValues = false;
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Iterator iter = persistentClass.getPropertyClosureIterator();
|
||||
Iterator<Property> props = persistentClass.getPropertyClosureIterator();
|
||||
int i = 0;
|
||||
int tempVersionProperty = NO_VERSION_INDX;
|
||||
boolean foundCascade = false;
|
||||
|
@ -214,8 +213,8 @@ public class EntityMetamodel implements Serializable {
|
|||
boolean foundNonIdentifierPropertyNamedId = false;
|
||||
boolean foundUpdateableNaturalIdProperty = false;
|
||||
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = ( Property ) iter.next();
|
||||
while ( props.hasNext() ) {
|
||||
Property prop = props.next();
|
||||
|
||||
if ( prop == persistentClass.getVersion() ) {
|
||||
tempVersionProperty = i;
|
||||
|
@ -404,7 +403,7 @@ public class EntityMetamodel implements Serializable {
|
|||
hasCollections = foundCollection;
|
||||
mutablePropertiesIndexes = mutableIndexes;
|
||||
|
||||
iter = persistentClass.getSubclassIterator();
|
||||
Iterator iter = persistentClass.getSubclassIterator();
|
||||
final Set<String> subclassEntityNamesLocal = new HashSet<>();
|
||||
while ( iter.hasNext() ) {
|
||||
subclassEntityNamesLocal.add( ( (PersistentClass) iter.next() ).getEntityName() );
|
||||
|
@ -803,7 +802,7 @@ public class EntityMetamodel implements Serializable {
|
|||
return hasImmutableNaturalId;
|
||||
}
|
||||
|
||||
public Set getSubclassEntityNames() {
|
||||
public Set<String> getSubclassEntityNames() {
|
||||
return subclassEntityNames;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,27 +38,24 @@ public class PersistentClassGraphDefiner implements GraphDefiner<PersistentClass
|
|||
return metadata.getEntityBinding( entityName );
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private void addNeighbours(List<PersistentClass> neighbours, Iterator<PersistentClass> subclassIterator) {
|
||||
private void addNeighbours(List<PersistentClass> neighbours, Iterator<? extends PersistentClass> subclassIterator) {
|
||||
while ( subclassIterator.hasNext() ) {
|
||||
final PersistentClass subclass = subclassIterator.next();
|
||||
neighbours.add( subclass );
|
||||
addNeighbours( neighbours, (Iterator<PersistentClass>) subclass.getSubclassIterator() );
|
||||
addNeighbours( neighbours, subclass.getSubclassIterator() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public List<PersistentClass> getNeighbours(PersistentClass pc) {
|
||||
final List<PersistentClass> neighbours = new ArrayList<>();
|
||||
|
||||
addNeighbours( neighbours, (Iterator<PersistentClass>) pc.getSubclassIterator() );
|
||||
addNeighbours( neighbours, pc.getSubclassIterator() );
|
||||
|
||||
return neighbours;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public List<PersistentClass> getValues() {
|
||||
return Tools.collectionToList( metadata.getEntityBindings() );
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import org.hibernate.envers.internal.tools.Tools;
|
|||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.IndexedCollection;
|
||||
import org.hibernate.mapping.KeyValue;
|
||||
import org.hibernate.mapping.ManyToOne;
|
||||
import org.hibernate.mapping.OneToMany;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
|
@ -1012,9 +1013,8 @@ public final class CollectionMetadataGenerator {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
private String searchMappedByKey(PersistentClass referencedClass, Collection collectionValue) {
|
||||
final Iterator<Value> assocIdClassProps = referencedClass.getKeyClosureIterator();
|
||||
final Iterator<KeyValue> assocIdClassProps = referencedClass.getKeyClosureIterator();
|
||||
while ( assocIdClassProps.hasNext() ) {
|
||||
final Value value = assocIdClassProps.next();
|
||||
// make sure its a 'Component' because IdClass is registered as this type.
|
||||
|
|
Loading…
Reference in New Issue