remove Serializable id from the Tuplizer stuff
This commit is contained in:
parent
d4aa643630
commit
b3aa7d0794
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id$
|
||||
package org.hibernate.userguide.proxy.tuplizer;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
@ -30,7 +30,7 @@ public final class DataProxyHandler implements InvocationHandler {
|
|||
|
||||
private Map<String, Object> data = new HashMap<>();
|
||||
|
||||
public DataProxyHandler(String entityName, Serializable id) {
|
||||
public DataProxyHandler(String entityName, Object id) {
|
||||
this.entityName = entityName;
|
||||
data.put( "Id", id );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DynamicInstantiator
|
|||
}
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
return ProxyHelper.newProxy( targetClass, id );
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id$
|
||||
package org.hibernate.userguide.proxy.tuplizer;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import java.lang.reflect.Proxy;
|
|||
|
||||
public class ProxyHelper {
|
||||
|
||||
public static <T> T newProxy(Class<T> targetClass, Serializable id) {
|
||||
public static <T> T newProxy(Class<T> targetClass, Object id) {
|
||||
return ( T ) Proxy.newProxyInstance(
|
||||
targetClass.getClassLoader(),
|
||||
new Class[] {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.tuple;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -37,7 +36,7 @@ public class DynamicMapInstantiator implements Instantiator {
|
|||
}
|
||||
}
|
||||
|
||||
public final Object instantiate(Serializable id) {
|
||||
public final Object instantiate(Object id) {
|
||||
return instantiate();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface Instantiator extends Serializable {
|
|||
* @param id The id of the entity to be instantiated.
|
||||
* @return An appropriately instantiated entity.
|
||||
*/
|
||||
Object instantiate(Serializable id);
|
||||
Object instantiate(Object id);
|
||||
|
||||
/**
|
||||
* Perform the requested instantiation.
|
||||
|
|
|
@ -97,7 +97,7 @@ public class PojoInstantiator implements Instantiator, Serializable {
|
|||
return entity;
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
final boolean useEmbeddedIdentifierInstanceAsEntity = embeddedIdentifier &&
|
||||
id != null &&
|
||||
id.getClass().equals(mappedClass);
|
||||
|
|
|
@ -166,7 +166,7 @@ public class PojoComponentTuplizer extends AbstractComponentTuplizer {
|
|||
}
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
throw new AssertionFailure( "ProxiedInstantiator can only be used to instantiate component" );
|
||||
}
|
||||
|
||||
|
|
|
@ -203,12 +203,12 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity) throws HibernateException {
|
||||
public Object getIdentifier(Object entity) throws HibernateException {
|
||||
return getIdentifier( entity, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
final Object id;
|
||||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||
id = entity;
|
||||
|
@ -231,7 +231,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
try {
|
||||
return (Serializable) id;
|
||||
return id;
|
||||
}
|
||||
catch (ClassCastException cce) {
|
||||
StringBuilder msg = new StringBuilder( "Identifier classes must be serializable. " );
|
||||
|
@ -246,14 +246,14 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id) throws HibernateException {
|
||||
public void setIdentifier(Object entity, Object id) throws HibernateException {
|
||||
// 99% of the time the session is not needed. It's only needed for certain brain-dead
|
||||
// interpretations of JPA 2 "derived identity" support
|
||||
setIdentifier( entity, id, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||
if ( entity != id ) {
|
||||
CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType();
|
||||
|
@ -271,7 +271,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
private static interface MappedIdentifierValueMarshaller {
|
||||
public Object getIdentifier(Object entity, EntityMode entityMode, SharedSessionContractImplementor session);
|
||||
|
||||
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SharedSessionContractImplementor session);
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session);
|
||||
}
|
||||
|
||||
private final MappedIdentifierValueMarshaller mappedIdentifierValueMarshaller;
|
||||
|
@ -334,7 +334,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
virtualIdComponent.setPropertyValues(
|
||||
entity,
|
||||
mappedIdentifierType.getPropertyValues( id, session ),
|
||||
|
@ -398,7 +398,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id, entityMode );
|
||||
final Object[] injectionValues = new Object[extractedValues.length];
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||
|
@ -503,7 +503,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) {
|
||||
public void resetIdentifier(Object entity, Object currentId, Object currentVersion) {
|
||||
// 99% of the time the session is not needed. It's only needed for certain brain-dead
|
||||
// interpretations of JPA 2 "derived identity" support
|
||||
resetIdentifier( entity, currentId, currentVersion, null );
|
||||
|
@ -524,7 +524,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
Object result = identifierProperty
|
||||
.getUnsavedValue()
|
||||
.getDefaultValue( currentId );
|
||||
setIdentifier( entity, (Serializable) result, session );
|
||||
setIdentifier( entity, result, session );
|
||||
//reset the version
|
||||
VersionProperty versionProperty = entityMetamodel.getVersionProperty();
|
||||
if ( entityMetamodel.isVersioned() ) {
|
||||
|
@ -693,14 +693,14 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final Object instantiate(Serializable id) throws HibernateException {
|
||||
public final Object instantiate(Object id) throws HibernateException {
|
||||
// 99% of the time the session is not needed. It's only needed for certain brain-dead
|
||||
// interpretations of JPA 2 "derived identity" support
|
||||
return instantiate( id, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object instantiate(Serializable id, SharedSessionContractImplementor session) {
|
||||
public final Object instantiate(Object id, SharedSessionContractImplementor session) {
|
||||
Object result = getInstantiator().instantiate( id );
|
||||
linkToSession( result, session );
|
||||
if ( id != null ) {
|
||||
|
@ -741,7 +741,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final Object createProxy(Serializable id, SharedSessionContractImplementor session) {
|
||||
public final Object createProxy(Object id, SharedSessionContractImplementor session) {
|
||||
return getProxyFactory().getProxy( id, session );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
|
@ -47,11 +46,11 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
* @return The instantiated entity.
|
||||
* @throws HibernateException
|
||||
*
|
||||
* @deprecated Use {@link #instantiate(Serializable, SharedSessionContractImplementor)} instead.
|
||||
* @deprecated Use {@link #instantiate(Object, SharedSessionContractImplementor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings( {"JavaDoc"})
|
||||
Object instantiate(Serializable id) throws HibernateException;
|
||||
Object instantiate(Object id) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Create an entity instance initialized with the given identifier.
|
||||
|
@ -61,7 +60,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
*
|
||||
* @return The instantiated entity.
|
||||
*/
|
||||
Object instantiate(Serializable id, SharedSessionContractImplementor session);
|
||||
Object instantiate(Object id, SharedSessionContractImplementor session);
|
||||
|
||||
/**
|
||||
* Extract the identifier value from the given entity.
|
||||
|
@ -76,7 +75,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
* @deprecated Use {@link #getIdentifier(Object,SharedSessionContractImplementor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Serializable getIdentifier(Object entity) throws HibernateException;
|
||||
Object getIdentifier(Object entity) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Extract the identifier value from the given entity.
|
||||
|
@ -86,7 +85,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
*
|
||||
* @return The identifier value.
|
||||
*/
|
||||
Serializable getIdentifier(Object entity, SharedSessionContractImplementor session);
|
||||
Object getIdentifier(Object entity, SharedSessionContractImplementor session);
|
||||
|
||||
/**
|
||||
* Inject the identifier value into the given entity.
|
||||
|
@ -96,11 +95,11 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
* @param entity The entity to inject with the identifier value.
|
||||
* @param id The value to be injected as the identifier.
|
||||
*
|
||||
* @deprecated Use {@link #setIdentifier(Object, Serializable, SharedSessionContractImplementor)} instead.
|
||||
* @deprecated Use {@link #setIdentifier(Object, Object, SharedSessionContractImplementor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings( {"JavaDoc"})
|
||||
void setIdentifier(Object entity, Serializable id) throws HibernateException;
|
||||
void setIdentifier(Object entity, Object id) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Inject the identifier value into the given entity.
|
||||
|
@ -111,7 +110,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
* @param id The value to be injected as the identifier.
|
||||
* @param session The session from which is requests originates
|
||||
*/
|
||||
void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session);
|
||||
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session);
|
||||
|
||||
/**
|
||||
* Inject the given identifier and version into the entity, in order to
|
||||
|
@ -125,7 +124,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
void resetIdentifier(Object entity, Serializable currentId, Object currentVersion);
|
||||
void resetIdentifier(Object entity, Object currentId, Object currentVersion);
|
||||
|
||||
/**
|
||||
* Inject the given identifier and version into the entity, in order to
|
||||
|
@ -212,7 +211,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
* @return The generate proxies.
|
||||
* @throws HibernateException Indicates an error generating the proxy.
|
||||
*/
|
||||
Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException;
|
||||
Object createProxy(Object id, SharedSessionContractImplementor session) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Does the {@link #getMappedClass() class} managed by this tuplizer implement
|
||||
|
|
|
@ -40,7 +40,7 @@ public class GetIdentifierTest {
|
|||
ModernEntity modernEntity = new ModernEntity();
|
||||
modernEntity.setFoo( 2 );
|
||||
|
||||
Serializable simpleEntityId = (Serializable) entityManager.getEntityManagerFactory()
|
||||
Object simpleEntityId = entityManager.getEntityManagerFactory()
|
||||
.getPersistenceUnitUtil().getIdentifier( modernEntity );
|
||||
}
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id$
|
||||
package org.hibernate.test.annotations.tuplizer;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
@ -25,7 +25,7 @@ public final class DataProxyHandler implements InvocationHandler {
|
|||
private String entityName;
|
||||
private HashMap data = new HashMap();
|
||||
|
||||
public DataProxyHandler(String entityName, Serializable id) {
|
||||
public DataProxyHandler(String entityName, Object id) {
|
||||
this.entityName = entityName;
|
||||
data.put( "Id", id );
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
//$Id$
|
||||
package org.hibernate.test.annotations.tuplizer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
@ -26,7 +25,7 @@ public class DynamicInstantiator implements Instantiator {
|
|||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
if ( Cuisine.class.getName().equals( entityName ) ) {
|
||||
return ProxyHelper.newCuisineProxy( id );
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id$
|
||||
package org.hibernate.test.annotations.tuplizer;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class ProxyHelper {
|
|||
return newCountryProxy( null );
|
||||
}
|
||||
|
||||
public static Country newCountryProxy(Serializable id) {
|
||||
public static Country newCountryProxy(Object id) {
|
||||
return ( Country ) Proxy.newProxyInstance(
|
||||
Country.class.getClassLoader(),
|
||||
new Class[] {Country.class},
|
||||
|
@ -32,7 +32,7 @@ public class ProxyHelper {
|
|||
return newCuisineProxy( null );
|
||||
}
|
||||
|
||||
public static Cuisine newCuisineProxy(Serializable id) {
|
||||
public static Cuisine newCuisineProxy(Object id) {
|
||||
return ( Cuisine ) Proxy.newProxyInstance(
|
||||
Cuisine.class.getClassLoader(),
|
||||
new Class[] {Cuisine.class},
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.test.annotations.tuplizer.bytebuddysubclass;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.tuple.Instantiator;
|
||||
|
||||
|
@ -28,7 +26,7 @@ public class MyEntityInstantiator implements Instantiator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
return instantiate();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.test.bytecode.enhancement.lazy.proxy;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
|
@ -304,38 +303,38 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatefulTest extends BaseNonC
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(Serializable id) throws HibernateException {
|
||||
public Object instantiate(Object id) throws HibernateException {
|
||||
return pojoEntityTuplizer.instantiate( id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(Serializable id, SharedSessionContractImplementor session) {
|
||||
public Object instantiate(Object id, SharedSessionContractImplementor session) {
|
||||
return pojoEntityTuplizer.instantiate( id, session );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity) throws HibernateException {
|
||||
public Object getIdentifier(Object entity) throws HibernateException {
|
||||
return pojoEntityTuplizer.getIdentifier( entity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
return pojoEntityTuplizer.getIdentifier( entity, session );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id) throws HibernateException {
|
||||
public void setIdentifier(Object entity, Object id) throws HibernateException {
|
||||
pojoEntityTuplizer.setIdentifier( entity, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||
pojoEntityTuplizer.setIdentifier( entity, id, session );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) {
|
||||
public void resetIdentifier(Object entity, Object currentId, Object currentVersion) {
|
||||
pojoEntityTuplizer.resetIdentifier( entity, currentId, currentVersion );
|
||||
}
|
||||
|
||||
|
@ -388,7 +387,7 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatefulTest extends BaseNonC
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException {
|
||||
public Object createProxy(Object id, SharedSessionContractImplementor session) throws HibernateException {
|
||||
return pojoEntityTuplizer.createProxy( id, session );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.test.bytecode.enhancement.lazy.proxy;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
|
@ -305,38 +304,38 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatelessTest extends BaseNon
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(Serializable id) throws HibernateException {
|
||||
public Object instantiate(Object id) throws HibernateException {
|
||||
return pojoEntityTuplizer.instantiate( id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiate(Serializable id, SharedSessionContractImplementor session) {
|
||||
public Object instantiate(Object id, SharedSessionContractImplementor session) {
|
||||
return pojoEntityTuplizer.instantiate( id, session );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity) throws HibernateException {
|
||||
public Object getIdentifier(Object entity) throws HibernateException {
|
||||
return pojoEntityTuplizer.getIdentifier( entity );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
return pojoEntityTuplizer.getIdentifier( entity, session );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id) throws HibernateException {
|
||||
public void setIdentifier(Object entity, Object id) throws HibernateException {
|
||||
pojoEntityTuplizer.setIdentifier( entity, id );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||
pojoEntityTuplizer.setIdentifier( entity, id, session );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) {
|
||||
public void resetIdentifier(Object entity, Object currentId, Object currentVersion) {
|
||||
pojoEntityTuplizer.resetIdentifier( entity, currentId, currentVersion );
|
||||
}
|
||||
|
||||
|
@ -389,7 +388,7 @@ public class LazyToOnesNoProxyFactoryWithSubclassesStatelessTest extends BaseNon
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object createProxy(Serializable id, SharedSessionContractImplementor session) throws HibernateException {
|
||||
public Object createProxy(Object id, SharedSessionContractImplementor session) throws HibernateException {
|
||||
return pojoEntityTuplizer.createProxy( id, session );
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.test.dynamicentity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
@ -23,7 +23,7 @@ public final class DataProxyHandler implements InvocationHandler {
|
|||
private String entityName;
|
||||
private HashMap data = new HashMap();
|
||||
|
||||
public DataProxyHandler(String entityName, Serializable id) {
|
||||
public DataProxyHandler(String entityName, Object id) {
|
||||
this.entityName = entityName;
|
||||
data.put( "Id", id );
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.test.dynamicentity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class ProxyHelper {
|
|||
return newPersonProxy( null );
|
||||
}
|
||||
|
||||
public static Person newPersonProxy(Serializable id) {
|
||||
public static Person newPersonProxy(Object id) {
|
||||
return ( Person ) Proxy.newProxyInstance(
|
||||
Person.class.getClassLoader(),
|
||||
new Class[] {Person.class},
|
||||
|
@ -30,7 +30,7 @@ public class ProxyHelper {
|
|||
return newCustomerProxy( null );
|
||||
}
|
||||
|
||||
public static Customer newCustomerProxy(Serializable id) {
|
||||
public static Customer newCustomerProxy(Object id) {
|
||||
return ( Customer ) Proxy.newProxyInstance(
|
||||
Customer.class.getClassLoader(),
|
||||
new Class[] {Customer.class},
|
||||
|
@ -42,7 +42,7 @@ public class ProxyHelper {
|
|||
return newCompanyProxy( null );
|
||||
}
|
||||
|
||||
public static Company newCompanyProxy(Serializable id) {
|
||||
public static Company newCompanyProxy(Object id) {
|
||||
return ( Company ) Proxy.newProxyInstance(
|
||||
Company.class.getClassLoader(),
|
||||
new Class[] {Company.class},
|
||||
|
@ -54,7 +54,7 @@ public class ProxyHelper {
|
|||
return newAddressProxy( null );
|
||||
}
|
||||
|
||||
public static Address newAddressProxy(Serializable id) {
|
||||
public static Address newAddressProxy(Object id) {
|
||||
return ( Address ) Proxy.newProxyInstance(
|
||||
Address.class.getClassLoader(),
|
||||
new Class[] {Address.class},
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.test.dynamicentity.tuplizer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
|
@ -31,7 +30,7 @@ public class MyEntityInstantiator implements Instantiator {
|
|||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
if ( Person.class.getName().equals( entityName ) ) {
|
||||
return ProxyHelper.newPersonProxy( id );
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.test.dynamicentity.tuplizer2;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.test.dynamicentity.Address;
|
||||
|
@ -27,7 +25,7 @@ public class MyEntityInstantiator implements Instantiator {
|
|||
this.entityName = entityName;
|
||||
}
|
||||
|
||||
public Object instantiate(Serializable id) {
|
||||
public Object instantiate(Object id) {
|
||||
if ( Person.class.getName().equals( entityName ) ) {
|
||||
return ProxyHelper.newPersonProxy( id );
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public final class ToOneEntityLoader {
|
|||
}
|
||||
else {
|
||||
// Not audited relation, look up entity with Hibernate.
|
||||
return versionsReader.getSessionImplementor().immediateLoad( entityName, (Serializable) entityId );
|
||||
return versionsReader.getSessionImplementor().immediateLoad( entityName, entityId );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public final class ToOneEntityLoader {
|
|||
.getMetamodel()
|
||||
.entityPersister( entityName );
|
||||
return persister.createProxy(
|
||||
(Serializable) entityId,
|
||||
entityId,
|
||||
new ToOneDelegateSessionImplementor( versionsReader, entityClass, entityId, revision, removed, enversService )
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue