HHH-5248 - Introduce CompositeType interface (to replace AbstractComponentType interface)
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19572 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
5aa6ad61ca
commit
78c8c6fb6a
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.cfg.beanvalidation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
|
@ -11,9 +34,9 @@ import org.hibernate.persister.entity.EntityPersister;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.annotations.common.AssertionFailure;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
|
||||
/**
|
||||
* Use Hibernate metadata to ignore cascade on entities.
|
||||
|
@ -56,7 +79,7 @@ public class HibernateTraversableResolver implements TraversableResolver {
|
|||
else if ( type.isEntityType() || type.isAnyType() ) {
|
||||
associations.add( prefix + name );
|
||||
} else if ( type.isComponentType() ) {
|
||||
AbstractComponentType componentType = (AbstractComponentType) type;
|
||||
CompositeType componentType = (CompositeType) type;
|
||||
addAssociationsToTheSetForAllProperties(
|
||||
componentType.getPropertyNames(),
|
||||
componentType.getSubtypes(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.criterion;
|
||||
|
||||
|
@ -35,7 +34,7 @@ import org.hibernate.EntityMode;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.TypedValue;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.StringHelper;
|
||||
|
||||
|
@ -218,7 +217,7 @@ public class Example implements Criterion {
|
|||
appendComponentCondition(
|
||||
propertyName,
|
||||
propertyValue,
|
||||
(AbstractComponentType) propertyTypes[i],
|
||||
(CompositeType) propertyTypes[i],
|
||||
criteria,
|
||||
criteriaQuery,
|
||||
buf
|
||||
|
@ -261,7 +260,7 @@ public class Example implements Criterion {
|
|||
|
||||
if (isPropertyIncluded) {
|
||||
if ( propertyTypes[i].isComponentType() ) {
|
||||
addComponentTypedValues(name, value, (AbstractComponentType) type, list, criteria, criteriaQuery);
|
||||
addComponentTypedValues(name, value, (CompositeType) type, list, criteria, criteriaQuery);
|
||||
}
|
||||
else {
|
||||
addPropertyTypedValue(value, type, list);
|
||||
|
@ -296,7 +295,7 @@ public class Example implements Criterion {
|
|||
protected void addComponentTypedValues(
|
||||
String path,
|
||||
Object component,
|
||||
AbstractComponentType type,
|
||||
CompositeType type,
|
||||
List list,
|
||||
Criteria criteria,
|
||||
CriteriaQuery criteriaQuery)
|
||||
|
@ -312,7 +311,7 @@ public class Example implements Criterion {
|
|||
String subpath = StringHelper.qualify( path, propertyNames[i] );
|
||||
if ( isPropertyIncluded(value, subpath, subtype) ) {
|
||||
if ( subtype.isComponentType() ) {
|
||||
addComponentTypedValues(subpath, value, (AbstractComponentType) subtype, list, criteria, criteriaQuery);
|
||||
addComponentTypedValues(subpath, value, (CompositeType) subtype, list, criteria, criteriaQuery);
|
||||
}
|
||||
else {
|
||||
addPropertyTypedValue(value, subtype, list);
|
||||
|
@ -356,7 +355,7 @@ public class Example implements Criterion {
|
|||
protected void appendComponentCondition(
|
||||
String path,
|
||||
Object component,
|
||||
AbstractComponentType type,
|
||||
CompositeType type,
|
||||
Criteria criteria,
|
||||
CriteriaQuery criteriaQuery,
|
||||
StringBuffer buf)
|
||||
|
@ -375,7 +374,7 @@ public class Example implements Criterion {
|
|||
appendComponentCondition(
|
||||
subpath,
|
||||
value,
|
||||
(AbstractComponentType) subtype,
|
||||
(CompositeType) subtype,
|
||||
criteria,
|
||||
criteriaQuery,
|
||||
buf
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.criterion;
|
||||
|
||||
|
@ -29,10 +28,8 @@ import java.util.ArrayList;
|
|||
import org.hibernate.Criteria;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
import org.hibernate.engine.TypedValue;
|
||||
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.StringHelper;
|
||||
|
||||
|
@ -84,7 +81,7 @@ public class InExpression implements Criterion {
|
|||
ArrayList list = new ArrayList();
|
||||
Type type = criteriaQuery.getTypeUsingProjection(criteria, propertyName);
|
||||
if ( type.isComponentType() ) {
|
||||
AbstractComponentType actype = (AbstractComponentType) type;
|
||||
CompositeType actype = (CompositeType) type;
|
||||
Type[] types = actype.getSubtypes();
|
||||
for ( int j=0; j<values.length; j++ ) {
|
||||
for ( int i=0; i<types.length; i++ ) {
|
||||
|
|
|
@ -38,9 +38,9 @@ import org.hibernate.event.EventSource;
|
|||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.CollectionHelper;
|
||||
|
@ -212,7 +212,7 @@ public final class Cascade {
|
|||
}
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
cascadeComponent( parent, child, (AbstractComponentType) type, propertyName, anything );
|
||||
cascadeComponent( parent, child, (CompositeType) type, propertyName, anything );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -300,7 +300,7 @@ public final class Cascade {
|
|||
private void cascadeComponent(
|
||||
final Object parent,
|
||||
final Object child,
|
||||
final AbstractComponentType componentType,
|
||||
final CompositeType componentType,
|
||||
final String componentPropertyName,
|
||||
final Object anything) {
|
||||
componentPathStack.push( componentPropertyName );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
|
@ -32,7 +31,7 @@ import org.hibernate.intercept.LazyPropertyInitializer;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -96,7 +95,7 @@ public final class ForeignKeys {
|
|||
return isNullifiable(null, value) ? null : value;
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
AbstractComponentType actype = (AbstractComponentType) type;
|
||||
CompositeType actype = (CompositeType) type;
|
||||
Object[] subvalues = actype.getPropertyValues(value, session);
|
||||
Type[] subtypes = actype.getSubtypes();
|
||||
boolean substitute = false;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
|
@ -30,8 +29,8 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.PropertyValueException;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -138,7 +137,7 @@ public final class Nullability {
|
|||
throws HibernateException {
|
||||
//for non null args, check for components and elements containing components
|
||||
if ( propertyType.isComponentType() ) {
|
||||
return checkComponentNullability( value, (AbstractComponentType) propertyType );
|
||||
return checkComponentNullability( value, (CompositeType) propertyType );
|
||||
}
|
||||
else if ( propertyType.isCollectionType() ) {
|
||||
|
||||
|
@ -148,7 +147,7 @@ public final class Nullability {
|
|||
if ( collectionElementType.isComponentType() ) {
|
||||
//check for all components values in the collection
|
||||
|
||||
AbstractComponentType componentType = (AbstractComponentType) collectionElementType;
|
||||
CompositeType componentType = (CompositeType) collectionElementType;
|
||||
Iterator iter = CascadingAction.getLoadedElementsIterator(session, collectionType, value);
|
||||
while ( iter.hasNext() ) {
|
||||
Object compValue = iter.next();
|
||||
|
@ -171,7 +170,7 @@ public final class Nullability {
|
|||
* @return property path
|
||||
* @throws HibernateException error while getting subcomponent values
|
||||
*/
|
||||
private String checkComponentNullability(final Object value, final AbstractComponentType compType)
|
||||
private String checkComponentNullability(final Object value, final CompositeType compType)
|
||||
throws HibernateException {
|
||||
/* will check current level if some of them are not null
|
||||
* or sublevels if they exist
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -28,8 +27,8 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -99,8 +98,7 @@ public abstract class AbstractVisitor {
|
|||
* @param componentType
|
||||
* @throws HibernateException
|
||||
*/
|
||||
Object processComponent(Object component, AbstractComponentType componentType)
|
||||
throws HibernateException {
|
||||
Object processComponent(Object component, CompositeType componentType) throws HibernateException {
|
||||
if (component!=null) {
|
||||
processValues(
|
||||
componentType.getPropertyValues(component, session),
|
||||
|
@ -127,7 +125,7 @@ public abstract class AbstractVisitor {
|
|||
return processEntity( value, (EntityType) type );
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
return processComponent( value, (AbstractComponentType) type );
|
||||
return processComponent( value, (CompositeType) type );
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -29,6 +28,7 @@ import java.util.Map;
|
|||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.PersistentObjectException;
|
||||
import org.hibernate.UnresolvableObjectException;
|
||||
|
@ -43,8 +43,8 @@ import org.hibernate.event.RefreshEvent;
|
|||
import org.hibernate.event.RefreshEventListener;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.IdentityMap;
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class DefaultRefreshEventListener implements RefreshEventListener {
|
|||
factory.evictCollection( ( (CollectionType) types[i] ).getRole(), id );
|
||||
}
|
||||
else if ( types[i].isComponentType() ) {
|
||||
AbstractComponentType actype = (AbstractComponentType) types[i];
|
||||
CompositeType actype = (CompositeType) types[i];
|
||||
evictCachedCollections( actype.getSubtypes(), id, factory );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -33,7 +32,7 @@ import org.hibernate.action.CollectionRemoveAction;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +74,7 @@ public abstract class ReattachVisitor extends ProxyVisitor {
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
Object processComponent(Object component, AbstractComponentType componentType) throws HibernateException {
|
||||
Object processComponent(Object component, CompositeType componentType) throws HibernateException {
|
||||
Type[] types = componentType.getSubtypes();
|
||||
if ( component == null ) {
|
||||
processValues( new Object[types.length], types );
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -34,8 +33,8 @@ import org.hibernate.engine.SessionImplementor;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -125,7 +124,7 @@ public class WrapVisitor extends ProxyVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
Object processComponent(Object component, AbstractComponentType componentType)
|
||||
Object processComponent(Object component, CompositeType componentType)
|
||||
throws HibernateException {
|
||||
|
||||
if (component!=null) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.loader;
|
||||
|
||||
|
@ -50,8 +49,8 @@ import org.hibernate.sql.ConditionFragment;
|
|||
import org.hibernate.sql.DisjunctionFragment;
|
||||
import org.hibernate.sql.InFragment;
|
||||
import org.hibernate.sql.JoinFragment;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.ForeignKeyDirection;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -348,7 +347,7 @@ public class JoinWalker {
|
|||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
walkCompositeElementTree(
|
||||
(AbstractComponentType) type,
|
||||
(CompositeType) type,
|
||||
persister.getElementColumnNames(),
|
||||
persister,
|
||||
alias,
|
||||
|
@ -525,7 +524,7 @@ public class JoinWalker {
|
|||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
walkComponentTree(
|
||||
( AbstractComponentType ) type,
|
||||
( CompositeType ) type,
|
||||
i,
|
||||
0,
|
||||
persister,
|
||||
|
@ -552,7 +551,7 @@ public class JoinWalker {
|
|||
* @throws org.hibernate.MappingException ???
|
||||
*/
|
||||
private void walkComponentTree(
|
||||
final AbstractComponentType componentType,
|
||||
final CompositeType componentType,
|
||||
final int propertyNumber,
|
||||
int begin,
|
||||
final OuterJoinLoadable persister,
|
||||
|
@ -599,7 +598,7 @@ public class JoinWalker {
|
|||
else if ( types[i].isComponentType() ) {
|
||||
final PropertyPath subPath = path.append( propertyNames[i] );
|
||||
walkComponentTree(
|
||||
( AbstractComponentType ) types[i],
|
||||
( CompositeType ) types[i],
|
||||
propertyNumber,
|
||||
begin,
|
||||
persister,
|
||||
|
@ -617,7 +616,7 @@ public class JoinWalker {
|
|||
* For a composite element, add to a list of associations to be fetched by outerjoin
|
||||
*/
|
||||
private void walkCompositeElementTree(
|
||||
final AbstractComponentType compositeType,
|
||||
final CompositeType compositeType,
|
||||
final String[] cols,
|
||||
final QueryableCollection persister,
|
||||
final String alias,
|
||||
|
@ -662,7 +661,7 @@ public class JoinWalker {
|
|||
else if ( types[i].isComponentType() ) {
|
||||
final PropertyPath subPath = path.append( propertyNames[i] );
|
||||
walkCompositeElementTree(
|
||||
(AbstractComponentType) types[i],
|
||||
(CompositeType) types[i],
|
||||
lhsColumns,
|
||||
persister,
|
||||
alias,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.loader.entity;
|
||||
|
||||
|
@ -42,7 +41,7 @@ import org.hibernate.persister.collection.QueryableCollection;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.OuterJoinLoadable;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.ComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -160,21 +159,19 @@ public class EntityJoinWalker extends AbstractEntityJoinWalker {
|
|||
if ( entityPersister != null
|
||||
&& entityPersister.getIdentifierType().isComponentType()
|
||||
&& ! entityPersister.getEntityMetamodel().getIdentifierProperty().isEmbedded()
|
||||
&& hasAssociation( (ComponentType) entityPersister.getIdentifierType() ) ) {
|
||||
&& hasAssociation( (CompositeType) entityPersister.getIdentifierType() ) ) {
|
||||
aliasesForAssociationsWithCompositesIds.add( oja.getRhsAlias() );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasAssociation(ComponentType componentType) {
|
||||
int i = 0;
|
||||
private boolean hasAssociation(CompositeType componentType) {
|
||||
for ( Type subType : componentType.getSubtypes() ) {
|
||||
if ( subType.isEntityType() ) {
|
||||
return true;
|
||||
}
|
||||
else if ( subType.isComponentType() && hasAssociation( ( (ComponentType) subType ) ) ) {
|
||||
else if ( subType.isComponentType() && hasAssociation( ( (CompositeType) subType ) ) ) {
|
||||
return true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -197,7 +194,7 @@ public class EntityJoinWalker extends AbstractEntityJoinWalker {
|
|||
findKeyManyToOneTargetIndices(
|
||||
keyManyToOneTargetIndices,
|
||||
joinWithCompositeId,
|
||||
(ComponentType) entityPersister.getIdentifierType()
|
||||
(CompositeType) entityPersister.getIdentifierType()
|
||||
);
|
||||
|
||||
if ( ! keyManyToOneTargetIndices.isEmpty() ) {
|
||||
|
@ -219,7 +216,7 @@ public class EntityJoinWalker extends AbstractEntityJoinWalker {
|
|||
private void findKeyManyToOneTargetIndices(
|
||||
ArrayList<Integer> keyManyToOneTargetIndices,
|
||||
OuterJoinableAssociation joinWithCompositeId,
|
||||
ComponentType componentType) {
|
||||
CompositeType componentType) {
|
||||
for ( Type subType : componentType.getSubtypes() ) {
|
||||
if ( subType.isEntityType() ) {
|
||||
Integer index = locateKeyManyToOneTargetIndex( joinWithCompositeId, (EntityType) subType );
|
||||
|
@ -231,7 +228,7 @@ public class EntityJoinWalker extends AbstractEntityJoinWalker {
|
|||
findKeyManyToOneTargetIndices(
|
||||
keyManyToOneTargetIndices,
|
||||
joinWithCompositeId,
|
||||
(ComponentType) subType
|
||||
(CompositeType) subType
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,16 +27,16 @@ import java.io.Serializable;
|
|||
import java.util.Iterator;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.PropertyNotFoundException;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.engine.CascadeStyle;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.property.Getter;
|
||||
import org.hibernate.property.PropertyAccessor;
|
||||
import org.hibernate.property.PropertyAccessorFactory;
|
||||
import org.hibernate.property.Setter;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class Property implements Serializable, MetaAttributable {
|
|||
public CascadeStyle getCascadeStyle() throws MappingException {
|
||||
Type type = value.getType();
|
||||
if ( type.isComponentType() && !type.isAnyType() ) {
|
||||
AbstractComponentType actype = (AbstractComponentType) type;
|
||||
CompositeType actype = (CompositeType) type;
|
||||
int length = actype.getSubtypes().length;
|
||||
for ( int i=0; i<length; i++ ) {
|
||||
if ( actype.getCascadeStyle(i)!=CascadeStyle.NONE ) return CascadeStyle.ALL;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
|
@ -79,8 +78,8 @@ import org.hibernate.sql.SelectFragment;
|
|||
import org.hibernate.sql.SimpleSelect;
|
||||
import org.hibernate.sql.Template;
|
||||
import org.hibernate.sql.ordering.antlr.ColumnMapper;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
|
@ -525,7 +524,7 @@ public abstract class AbstractCollectionPersister
|
|||
elementColumnReaders,
|
||||
elementColumnReaderTemplates,
|
||||
elementFormulaTemplates,
|
||||
(AbstractComponentType) elementType,
|
||||
(CompositeType) elementType,
|
||||
factory
|
||||
);
|
||||
}
|
||||
|
@ -1729,7 +1728,7 @@ public abstract class AbstractCollectionPersister
|
|||
collectionPropertyColumnNames.put(aliasName, columnNames);
|
||||
|
||||
if( type.isComponentType() ) {
|
||||
AbstractComponentType ct = (AbstractComponentType) type;
|
||||
CompositeType ct = (CompositeType) type;
|
||||
String[] propertyNames = ct.getPropertyNames();
|
||||
for (int i = 0; i < propertyNames.length; i++) {
|
||||
String name = propertyNames[i];
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,14 +20,13 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.persister.entity.AbstractPropertyMapping;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -35,14 +34,14 @@ import org.hibernate.type.Type;
|
|||
*/
|
||||
public class CompositeElementPropertyMapping extends AbstractPropertyMapping {
|
||||
|
||||
private final AbstractComponentType compositeType;
|
||||
private final CompositeType compositeType;
|
||||
|
||||
public CompositeElementPropertyMapping(
|
||||
String[] elementColumns,
|
||||
String[] elementColumnReaders,
|
||||
String[] elementColumnReaderTemplates,
|
||||
String[] elementFormulaTemplates,
|
||||
AbstractComponentType compositeType,
|
||||
CompositeType compositeType,
|
||||
Mapping factory)
|
||||
throws MappingException {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.persister.entity;
|
||||
|
||||
|
@ -37,16 +36,19 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.StaleStateException;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
import org.hibernate.cache.entry.CacheEntry;
|
||||
|
@ -63,7 +65,6 @@ import org.hibernate.engine.LoadQueryInfluencers;
|
|||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.engine.Status;
|
||||
import org.hibernate.engine.ValueInclusion;
|
||||
import org.hibernate.engine.Versioning;
|
||||
import org.hibernate.exception.JDBCExceptionHelper;
|
||||
|
@ -88,7 +89,6 @@ import org.hibernate.mapping.PersistentClass;
|
|||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.Selectable;
|
||||
import org.hibernate.metadata.ClassMetadata;
|
||||
import org.hibernate.persister.entity.DiscriminatorMetadata;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.property.BackrefPropertyAccessor;
|
||||
import org.hibernate.sql.Alias;
|
||||
|
@ -103,8 +103,8 @@ import org.hibernate.sql.Update;
|
|||
import org.hibernate.tuple.Tuplizer;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.tuple.entity.EntityTuplizer;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
@ -112,8 +112,6 @@ import org.hibernate.type.VersionType;
|
|||
import org.hibernate.util.ArrayHelper;
|
||||
import org.hibernate.util.FilterHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Basic functionality for persisting an entity via JDBC
|
||||
|
@ -1699,7 +1697,7 @@ public abstract class AbstractEntityPersister
|
|||
// aliases for composite-id's
|
||||
if ( getIdentifierType().isComponentType() ) {
|
||||
// Fetch embedded identifiers propertynames from the "virtual" identifier component
|
||||
AbstractComponentType componentId = ( AbstractComponentType ) getIdentifierType();
|
||||
CompositeType componentId = ( CompositeType ) getIdentifierType();
|
||||
String[] idPropertyNames = componentId.getPropertyNames();
|
||||
String[] idAliases = getIdentifierAliases();
|
||||
String[] idColumnNames = getIdentifierColumnNames();
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.sql.Template;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
|
@ -206,7 +206,7 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
if (path!=null) addPropertyPath(path, type, columns, columnReaders, columnReaderTemplates, formulaTemplates);
|
||||
|
||||
if ( type.isComponentType() ) {
|
||||
AbstractComponentType actype = (AbstractComponentType) type;
|
||||
CompositeType actype = (CompositeType) type;
|
||||
initComponentPropertyPaths( path, actype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
|
||||
if ( actype.isEmbedded() ) {
|
||||
initComponentPropertyPaths(
|
||||
|
@ -266,12 +266,11 @@ public abstract class AbstractPropertyMapping implements PropertyMapping {
|
|||
|
||||
protected void initComponentPropertyPaths(
|
||||
final String path,
|
||||
final AbstractComponentType type,
|
||||
final CompositeType type,
|
||||
final String[] columns,
|
||||
final String[] columnReaders,
|
||||
final String[] columnReaderTemplates,
|
||||
String[] formulaTemplates, final Mapping factory)
|
||||
throws MappingException {
|
||||
String[] formulaTemplates, final Mapping factory) throws MappingException {
|
||||
|
||||
Type[] types = type.getSubtypes();
|
||||
String[] properties = type.getPropertyNames();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy;
|
||||
|
||||
|
@ -30,7 +29,7 @@ import java.util.Set;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* Contract for run-time, proxy-based lazy initialization proxies.
|
||||
|
@ -42,7 +41,7 @@ public interface ProxyFactory {
|
|||
/**
|
||||
* Called immediately after instantiation of this factory.
|
||||
* <p/>
|
||||
* Essentially equivalent to contructor injection, but contracted
|
||||
* Essentially equivalent to constructor injection, but contracted
|
||||
* here via interface.
|
||||
*
|
||||
* @param entityName The name of the entity for which this factory should
|
||||
|
@ -69,7 +68,7 @@ public interface ProxyFactory {
|
|||
Set interfaces,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType) throws HibernateException;
|
||||
CompositeType componentIdType) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Create a new proxy instance
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,19 +20,18 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.dom4j;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
import java.util.Set;
|
||||
import java.lang.reflect.Method;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* Builds proxies for "dom4j" entity representations.
|
||||
|
@ -52,7 +51,7 @@ public class Dom4jProxyFactory implements ProxyFactory {
|
|||
Set interfaces,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType) throws HibernateException {
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.map;
|
||||
|
||||
|
@ -32,7 +31,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
|
@ -42,23 +41,19 @@ public class MapProxyFactory implements ProxyFactory {
|
|||
private String entityName;
|
||||
|
||||
public void postInstantiate(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Set interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType)
|
||||
throws HibernateException {
|
||||
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Set interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
this.entityName = entityName;
|
||||
|
||||
}
|
||||
|
||||
public HibernateProxy getProxy(
|
||||
final Serializable id,
|
||||
final SessionImplementor session)
|
||||
throws HibernateException {
|
||||
return new MapProxy( new MapLazyInitializer(entityName, id, session) );
|
||||
public HibernateProxy getProxy(final Serializable id, final SessionImplementor session)
|
||||
throws HibernateException {
|
||||
return new MapProxy( new MapLazyInitializer( entityName, id, session ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo;
|
||||
|
||||
|
@ -29,7 +28,7 @@ import java.lang.reflect.Method;
|
|||
|
||||
import org.hibernate.engine.EntityKey;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.util.MarkerObject;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.proxy.AbstractLazyInitializer;
|
||||
|
@ -48,7 +47,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
protected Method setIdentifierMethod;
|
||||
protected boolean overridesEquals;
|
||||
private Object replacement;
|
||||
protected AbstractComponentType componentIdType;
|
||||
protected CompositeType componentIdType;
|
||||
|
||||
protected BasicLazyInitializer(
|
||||
String entityName,
|
||||
|
@ -56,7 +55,7 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
Serializable id,
|
||||
Method getIdentifierMethod,
|
||||
Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType,
|
||||
CompositeType componentIdType,
|
||||
SessionImplementor session) {
|
||||
super(entityName, id, session);
|
||||
this.persistentClass = persistentClass;
|
||||
|
@ -68,30 +67,26 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
|
||||
protected abstract Object serializableProxy();
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing" })
|
||||
protected final Object invoke(Method method, Object[] args, Object proxy) throws Throwable {
|
||||
|
||||
String methodName = method.getName();
|
||||
int params = args.length;
|
||||
|
||||
if ( params==0 ) {
|
||||
|
||||
if ( "writeReplace".equals(methodName) ) {
|
||||
return getReplacement();
|
||||
}
|
||||
else if ( !overridesEquals && "hashCode".equals(methodName) ) {
|
||||
return new Integer( System.identityHashCode(proxy) );
|
||||
return Integer.valueOf( System.identityHashCode(proxy) );
|
||||
}
|
||||
else if ( isUninitialized() && method.equals(getIdentifierMethod) ) {
|
||||
return getIdentifier();
|
||||
}
|
||||
|
||||
else if ( "getHibernateLazyInitializer".equals(methodName) ) {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
else if ( params==1 ) {
|
||||
|
||||
if ( !overridesEquals && "equals".equals(methodName) ) {
|
||||
return args[0]==proxy ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
@ -100,7 +95,6 @@ public abstract class BasicLazyInitializer extends AbstractLazyInitializer {
|
|||
setIdentifier( (Serializable) args[0] );
|
||||
return INVOKE_IMPLEMENTATION;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if it is a property of an embedded component, invoke on the "identifier"
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hibernate.LazyInitializationException;
|
|||
import org.hibernate.proxy.pojo.BasicLazyInitializer;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -63,10 +63,15 @@ public final class CGLIBLazyInitializer extends BasicLazyInitializer implements
|
|||
private Class[] interfaces;
|
||||
private boolean constructed = false;
|
||||
|
||||
static HibernateProxy getProxy(final String entityName, final Class persistentClass,
|
||||
final Class[] interfaces, final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod, AbstractComponentType componentIdType,
|
||||
final Serializable id, final SessionImplementor session) throws HibernateException {
|
||||
static HibernateProxy getProxy(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
CompositeType componentIdType,
|
||||
final Serializable id,
|
||||
final SessionImplementor session) throws HibernateException {
|
||||
// note: interfaces is assumed to already contain HibernateProxy.class
|
||||
|
||||
try {
|
||||
|
@ -94,12 +99,16 @@ public final class CGLIBLazyInitializer extends BasicLazyInitializer implements
|
|||
}
|
||||
}
|
||||
|
||||
public static HibernateProxy getProxy(final Class factory, final String entityName,
|
||||
final Class persistentClass, final Class[] interfaces,
|
||||
final Method getIdentifierMethod, final Method setIdentifierMethod,
|
||||
final AbstractComponentType componentIdType, final Serializable id,
|
||||
public static HibernateProxy getProxy(
|
||||
final Class factory,
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
final CompositeType componentIdType,
|
||||
final Serializable id,
|
||||
final SessionImplementor session) throws HibernateException {
|
||||
|
||||
final CGLIBLazyInitializer instance = new CGLIBLazyInitializer(
|
||||
entityName,
|
||||
persistentClass,
|
||||
|
@ -150,9 +159,14 @@ public final class CGLIBLazyInitializer extends BasicLazyInitializer implements
|
|||
return e.createClass();
|
||||
}
|
||||
|
||||
private CGLIBLazyInitializer(final String entityName, final Class persistentClass,
|
||||
final Class[] interfaces, final Serializable id, final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod, final AbstractComponentType componentIdType,
|
||||
private CGLIBLazyInitializer(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Serializable id,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
final CompositeType componentIdType,
|
||||
final SessionImplementor session) {
|
||||
super(
|
||||
entityName,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo.cglib;
|
||||
|
||||
|
@ -32,7 +31,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
|
@ -46,7 +45,7 @@ public class CGLIBProxyFactory implements ProxyFactory {
|
|||
private Class[] interfaces;
|
||||
private Method getIdentifierMethod;
|
||||
private Method setIdentifierMethod;
|
||||
private AbstractComponentType componentIdType;
|
||||
private CompositeType componentIdType;
|
||||
private Class factory;
|
||||
|
||||
public void postInstantiate(
|
||||
|
@ -55,7 +54,7 @@ public class CGLIBProxyFactory implements ProxyFactory {
|
|||
final Set interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType)
|
||||
CompositeType componentIdType)
|
||||
throws HibernateException {
|
||||
this.entityName = entityName;
|
||||
this.persistentClass = persistentClass;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo.cglib;
|
||||
|
||||
|
@ -30,7 +29,7 @@ import java.lang.reflect.Method;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.proxy.AbstractSerializableProxy;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* Serializable placeholder for <tt>CGLIB</tt> proxies
|
||||
|
@ -44,20 +43,20 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
private String getIdentifierMethodName;
|
||||
private String setIdentifierMethodName;
|
||||
private Class[] setIdentifierMethodParams;
|
||||
private AbstractComponentType componentIdType;
|
||||
private CompositeType componentIdType;
|
||||
|
||||
public SerializableProxy() {}
|
||||
public SerializableProxy() {
|
||||
}
|
||||
|
||||
public SerializableProxy(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Serializable id,
|
||||
final Boolean readOnly,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType
|
||||
) {
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Serializable id,
|
||||
final Boolean readOnly,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
CompositeType componentIdType) {
|
||||
super( entityName, id, readOnly );
|
||||
this.persistentClass = persistentClass;
|
||||
this.interfaces = interfaces;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo.javassist;
|
||||
|
||||
|
@ -39,7 +38,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.proxy.pojo.BasicLazyInitializer;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +65,7 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
|||
final Serializable id,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
final AbstractComponentType componentIdType,
|
||||
final CompositeType componentIdType,
|
||||
final SessionImplementor session) {
|
||||
super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session );
|
||||
this.interfaces = interfaces;
|
||||
|
@ -78,7 +77,7 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
|||
final Class[] interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType,
|
||||
CompositeType componentIdType,
|
||||
final Serializable id,
|
||||
final SessionImplementor session) throws HibernateException {
|
||||
// note: interface is assumed to already contain HibernateProxy.class
|
||||
|
@ -121,7 +120,7 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
|||
final Class[] interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
final AbstractComponentType componentIdType,
|
||||
final CompositeType componentIdType,
|
||||
final Serializable id,
|
||||
final SessionImplementor session) throws HibernateException {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo.javassist;
|
||||
|
||||
|
@ -32,7 +31,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* A {@link ProxyFactory} implementation for producing Javassist-based proxies.
|
||||
|
@ -47,7 +46,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
|||
private Class[] interfaces;
|
||||
private Method getIdentifierMethod;
|
||||
private Method setIdentifierMethod;
|
||||
private AbstractComponentType componentIdType;
|
||||
private CompositeType componentIdType;
|
||||
private Class factory;
|
||||
|
||||
public void postInstantiate(
|
||||
|
@ -56,7 +55,7 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
|||
final Set interfaces,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType) throws HibernateException {
|
||||
CompositeType componentIdType) throws HibernateException {
|
||||
this.entityName = entityName;
|
||||
this.persistentClass = persistentClass;
|
||||
this.interfaces = (Class[]) interfaces.toArray(NO_CLASSES);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.proxy.pojo.javassist;
|
||||
|
||||
|
@ -30,7 +29,7 @@ import java.lang.reflect.Method;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.proxy.AbstractSerializableProxy;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* Serializable placeholder for Javassist proxies
|
||||
|
@ -44,20 +43,20 @@ public final class SerializableProxy extends AbstractSerializableProxy {
|
|||
private String getIdentifierMethodName;
|
||||
private String setIdentifierMethodName;
|
||||
private Class[] setIdentifierMethodParams;
|
||||
private AbstractComponentType componentIdType;
|
||||
private CompositeType componentIdType;
|
||||
|
||||
public SerializableProxy() {}
|
||||
public SerializableProxy() {
|
||||
}
|
||||
|
||||
public SerializableProxy(
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Serializable id,
|
||||
final Boolean readOnly,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
AbstractComponentType componentIdType
|
||||
) {
|
||||
final String entityName,
|
||||
final Class persistentClass,
|
||||
final Class[] interfaces,
|
||||
final Serializable id,
|
||||
final Boolean readOnly,
|
||||
final Method getIdentifierMethod,
|
||||
final Method setIdentifierMethod,
|
||||
CompositeType componentIdType) {
|
||||
super( entityName, id, readOnly );
|
||||
this.persistentClass = persistentClass;
|
||||
this.interfaces = interfaces;
|
||||
|
|
|
@ -34,20 +34,17 @@ import org.slf4j.LoggerFactory;
|
|||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.Cascade;
|
||||
import org.hibernate.engine.EntityEntry;
|
||||
import org.hibernate.engine.EntityKey;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.event.PersistEvent;
|
||||
import org.hibernate.event.SaveOrUpdateEvent;
|
||||
import org.hibernate.id.Assigned;
|
||||
import org.hibernate.intercept.LazyPropertyInitializer;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.property.Getter;
|
||||
import org.hibernate.property.Setter;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
@ -55,8 +52,8 @@ import org.hibernate.proxy.ProxyFactory;
|
|||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.tuple.VersionProperty;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.type.ComponentType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -84,7 +81,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
protected final boolean hasCustomAccessors;
|
||||
private final Instantiator instantiator;
|
||||
private final ProxyFactory proxyFactory;
|
||||
private final AbstractComponentType identifierMapperType;
|
||||
private final CompositeType identifierMapperType;
|
||||
|
||||
public Type getIdentifierMapperType() {
|
||||
return identifierMapperType;
|
||||
|
@ -182,7 +179,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
mappedIdentifierValueMarshaller = null;
|
||||
}
|
||||
else {
|
||||
identifierMapperType = (AbstractComponentType) mapper.getType();
|
||||
identifierMapperType = (CompositeType) mapper.getType();
|
||||
mappedIdentifierValueMarshaller = buildMappedIdentifierValueMarshaller(
|
||||
(ComponentType) entityMetamodel.getIdentifierProperty().getType(),
|
||||
(ComponentType) identifierMapperType
|
||||
|
@ -262,7 +259,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
public void setIdentifier(Object entity, Serializable id, SessionImplementor session) {
|
||||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||
if ( entity != id ) {
|
||||
AbstractComponentType copier = (AbstractComponentType) entityMetamodel.getIdentifierProperty().getType();
|
||||
CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType();
|
||||
copier.setPropertyValues( entity, copier.getPropertyValues( id, getEntityMode() ), getEntityMode() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,36 +20,36 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.dom4j.Dom4jProxyFactory;
|
||||
import org.hibernate.property.PropertyAccessor;
|
||||
import org.hibernate.property.PropertyAccessorFactory;
|
||||
import org.hibernate.property.Getter;
|
||||
import org.hibernate.property.Setter;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.tuple.Dom4jInstantiator;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dom4j.Element;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.property.Getter;
|
||||
import org.hibernate.property.PropertyAccessor;
|
||||
import org.hibernate.property.PropertyAccessorFactory;
|
||||
import org.hibernate.property.Setter;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.proxy.dom4j.Dom4jProxyFactory;
|
||||
import org.hibernate.tuple.Dom4jInstantiator;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* An {@link EntityTuplizer} specific to the dom4j entity mode.
|
||||
|
@ -151,7 +151,7 @@ public class Dom4jEntityTuplizer extends AbstractEntityTuplizer {
|
|||
null,
|
||||
null,
|
||||
mappingInfo.hasEmbeddedIdentifier() ?
|
||||
(AbstractComponentType) mappingInfo.getIdentifier().getType() :
|
||||
(CompositeType) mappingInfo.getIdentifier().getType() :
|
||||
null
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
|
||||
|
@ -35,27 +34,27 @@ import java.util.Set;
|
|||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.tuple.IdentifierProperty;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.tuple.PropertyFactory;
|
||||
import org.hibernate.tuple.VersionProperty;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.engine.CascadeStyle;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.Versioning;
|
||||
import org.hibernate.engine.ValueInclusion;
|
||||
import org.hibernate.engine.Versioning;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.PropertyGeneration;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.tuple.IdentifierProperty;
|
||||
import org.hibernate.tuple.PropertyFactory;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.tuple.VersionProperty;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
|
||||
|
@ -430,7 +429,7 @@ public class EntityMetamodel implements Serializable {
|
|||
return true;
|
||||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
Type[] subtypes = ( ( AbstractComponentType ) type ).getSubtypes();
|
||||
Type[] subtypes = ( (CompositeType) type ).getSubtypes();
|
||||
for ( int i = 0; i < subtypes.length; i++ ) {
|
||||
if ( indicatesCollection( subtypes[i] ) ) {
|
||||
return true;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
|
||||
|
@ -33,20 +32,19 @@ import java.util.Set;
|
|||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.tuple.PojoInstantiator;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.classic.Validatable;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.intercept.FieldInterceptionHelper;
|
||||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.Subclass;
|
||||
|
@ -54,7 +52,9 @@ import org.hibernate.property.Getter;
|
|||
import org.hibernate.property.Setter;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.type.AbstractComponentType;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
import org.hibernate.tuple.PojoInstantiator;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
|
||||
/**
|
||||
|
@ -191,7 +191,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
|||
proxyGetIdentifierMethod,
|
||||
proxySetIdentifierMethod,
|
||||
persistentClass.hasEmbeddedIdentifier() ?
|
||||
(AbstractComponentType) persistentClass.getIdentifier().getType() :
|
||||
(CompositeType) persistentClass.getIdentifier().getType() :
|
||||
null
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,52 +23,14 @@
|
|||
*/
|
||||
package org.hibernate.type;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.CascadeStyle;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
/**
|
||||
* Enables other Component-like types to hold collections and have cascades, etc.
|
||||
*
|
||||
* @see ComponentType
|
||||
* @see AnyType
|
||||
* @author Gavin King
|
||||
*
|
||||
* @deprecated in favor of {@link org.hibernate.type.CompositeType}
|
||||
*/
|
||||
public interface AbstractComponentType extends Type {
|
||||
/**
|
||||
* Get the types of the component properties
|
||||
*/
|
||||
public Type[] getSubtypes();
|
||||
/**
|
||||
* Get the names of the component properties
|
||||
*/
|
||||
public String[] getPropertyNames();
|
||||
/**
|
||||
* Optional operation
|
||||
* @return nullability of component properties
|
||||
*/
|
||||
public boolean[] getPropertyNullability();
|
||||
/**
|
||||
* Get the values of the component properties of
|
||||
* a component instance
|
||||
*/
|
||||
public Object[] getPropertyValues(Object component, SessionImplementor session) throws HibernateException;
|
||||
/**
|
||||
* Optional operation
|
||||
*/
|
||||
public Object[] getPropertyValues(Object component, EntityMode entityMode) throws HibernateException;
|
||||
/**
|
||||
* Optional operation
|
||||
*/
|
||||
public void setPropertyValues(Object component, Object[] values, EntityMode entityMode) throws HibernateException;
|
||||
public Object getPropertyValue(Object component, int i, SessionImplementor session) throws HibernateException;
|
||||
//public Object instantiate(Object parent, SessionImplementor session) throws HibernateException;
|
||||
public CascadeStyle getCascadeStyle(int i);
|
||||
public FetchMode getFetchMode(int i);
|
||||
public boolean isMethodOf(Method method);
|
||||
public boolean isEmbedded();
|
||||
public interface AbstractComponentType extends CompositeType {
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.hibernate.util.ArrayHelper;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class AnyType extends AbstractType implements AbstractComponentType, AssociationType {
|
||||
public class AnyType extends AbstractType implements CompositeType, AssociationType {
|
||||
private final Type identifierType;
|
||||
private final Type metaType;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.hibernate.util.StringHelper;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class ComponentType extends AbstractType implements AbstractComponentType {
|
||||
public class ComponentType extends AbstractType implements CompositeType {
|
||||
|
||||
private final TypeFactory.TypeScope typeScope;
|
||||
private final String[] propertyNames;
|
||||
|
|
|
@ -47,7 +47,7 @@ import org.hibernate.usertype.CompositeUserType;
|
|||
* Adapts <tt>CompositeUserType</tt> to <tt>Type</tt> interface
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class CompositeCustomType extends AbstractType implements AbstractComponentType {
|
||||
public class CompositeCustomType extends AbstractType implements CompositeType {
|
||||
private final CompositeUserType userType;
|
||||
private final String name;
|
||||
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.type;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.CascadeStyle;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
||||
/**
|
||||
* Contract for value types to hold collections and have cascades, etc. The notion is that of composition. JPA terms
|
||||
* this an embeddable.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface CompositeType extends Type {
|
||||
/**
|
||||
* Get the types of the component properties
|
||||
*
|
||||
* @return The component property types.
|
||||
*/
|
||||
public Type[] getSubtypes();
|
||||
|
||||
/**
|
||||
* Get the names of the component properties
|
||||
*
|
||||
* @return The component property names
|
||||
*/
|
||||
public String[] getPropertyNames();
|
||||
|
||||
/**
|
||||
* Retrieve the indicators regarding which component properties are nullable.
|
||||
* <p/>
|
||||
* An optional operation
|
||||
*
|
||||
* @return nullability of component properties
|
||||
*/
|
||||
public boolean[] getPropertyNullability();
|
||||
|
||||
/**
|
||||
* Extract the values of the component properties from the given component instance
|
||||
*
|
||||
* @param component The component instance
|
||||
* @param session The session from which the request originates
|
||||
*
|
||||
* @return The property values
|
||||
*
|
||||
* @throws HibernateException Indicates a problem access the property values.
|
||||
*/
|
||||
public Object[] getPropertyValues(Object component, SessionImplementor session) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Extract the values of the component properties from the given component instance without access to the
|
||||
* session.
|
||||
* <p/>
|
||||
* An optional operation
|
||||
*
|
||||
* @param component The component instance
|
||||
* @param entityMode The entity mode
|
||||
*
|
||||
* @return The property values
|
||||
*
|
||||
* @throws HibernateException Indicates a problem access the property values.
|
||||
*/
|
||||
public Object[] getPropertyValues(Object component, EntityMode entityMode) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Extract a particular component property value indicated by index.
|
||||
*
|
||||
* @param component The component instance
|
||||
* @param index The index of the property whose value is to be extracted
|
||||
* @param session The session from which the request originates.
|
||||
*
|
||||
* @return The extracted component property value
|
||||
*
|
||||
* @throws HibernateException Indicates a problem access the property value.
|
||||
*/
|
||||
public Object getPropertyValue(Object component, int index, SessionImplementor session) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Inject property values onto the given component instance
|
||||
* <p/>
|
||||
* An optional operation
|
||||
*
|
||||
* @param component The component instance
|
||||
* @param values The values to inject
|
||||
* @param entityMode The entity mode
|
||||
*
|
||||
* @throws HibernateException Indicates an issue performing the injection
|
||||
*/
|
||||
public void setPropertyValues(Object component, Object[] values, EntityMode entityMode) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Retrieve the cascade style of the indicated component property.
|
||||
*
|
||||
* @param index The property index,
|
||||
*
|
||||
* @return The cascade style.
|
||||
*/
|
||||
public CascadeStyle getCascadeStyle(int index);
|
||||
|
||||
/**
|
||||
* Retrieve the fetch mode of the indicated component property.
|
||||
*
|
||||
* @param index The property index,
|
||||
*
|
||||
* @return The fetch mode
|
||||
*/
|
||||
public FetchMode getFetchMode(int index);
|
||||
|
||||
/**
|
||||
* Is the given method a member of this component's class?
|
||||
*
|
||||
* @param method The method to check
|
||||
*
|
||||
* @return True if the method is a member; false otherwise.
|
||||
*/
|
||||
public boolean isMethodOf(Method method);
|
||||
|
||||
/**
|
||||
* Is this component embedded? "embedded" indicates that the component is "virtual", that its properties are
|
||||
* "flattened" onto its owner
|
||||
*
|
||||
* @return True if this component is embedded; false otherwise.
|
||||
*/
|
||||
public boolean isEmbedded();
|
||||
}
|
|
@ -96,11 +96,11 @@ public interface Type extends Serializable {
|
|||
public boolean isAnyType();
|
||||
|
||||
/**
|
||||
* Return true if the implementation is castable to {@link AbstractComponentType}. Essentially a polymorphic
|
||||
* version of {@code (type instanceof AbstractComponentType.class)}. A component type may own collections or
|
||||
* Return true if the implementation is castable to {@link CompositeType}. Essentially a polymorphic
|
||||
* version of {@code (type instanceof CompositeType.class)}. A component type may own collections or
|
||||
* associations and hence must provide certain extra functionality.
|
||||
*
|
||||
* @return True if this type is also an {@link CollectionType} implementor; false otherwise.
|
||||
* @return True if this type is also an {@link CompositeType} implementor; false otherwise.
|
||||
*/
|
||||
public boolean isComponentType();
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ public class TypeHelper {
|
|||
}
|
||||
else if ( types[i].isComponentType() ) {
|
||||
// need to extract the component values and check for subtype replacements...
|
||||
AbstractComponentType componentType = ( AbstractComponentType ) types[i];
|
||||
CompositeType componentType = ( CompositeType ) types[i];
|
||||
Type[] subtypes = componentType.getSubtypes();
|
||||
Object[] origComponentValues = original[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( original[i], session );
|
||||
Object[] targetComponentValues = target[i] == null ? new Object[subtypes.length] : componentType.getPropertyValues( target[i], session );
|
||||
|
|
Loading…
Reference in New Issue