Index: topia2/src/java/org/codelutin/topia/persistence/hibernate/FlatFilePersister.java diff -u topia2/src/java/org/codelutin/topia/persistence/hibernate/FlatFilePersister.java:1.3 topia2/src/java/org/codelutin/topia/persistence/hibernate/FlatFilePersister.java:1.4 --- topia2/src/java/org/codelutin/topia/persistence/hibernate/FlatFilePersister.java:1.3 Tue Jun 6 16:07:49 2006 +++ topia2/src/java/org/codelutin/topia/persistence/hibernate/FlatFilePersister.java Fri Nov 9 09:18:16 2007 @@ -1,4 +1,4 @@ -//$Id: FlatFilePersister.java,v 1.3 2006-06-06 16:07:49 thimel Exp $ +//$Id: FlatFilePersister.java,v 1.4 2007-11-09 09:18:16 chatellier Exp $ package org.codelutin.topia.persistence.hibernate; import java.io.Serializable; @@ -20,33 +20,35 @@ import org.hibernate.engine.Mapping; import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionImplementor; +import org.hibernate.engine.ValueInclusion; import org.hibernate.id.IdentifierGenerator; import org.hibernate.mapping.PersistentClass; import org.hibernate.metadata.ClassMetadata; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.sql.QuerySelect; import org.hibernate.sql.Select; -import org.hibernate.tuple.EntityMetamodel; -import org.hibernate.tuple.EntityTuplizer; import org.hibernate.tuple.Tuplizer; +import org.hibernate.tuple.entity.EntityMetamodel; +import org.hibernate.tuple.entity.EntityTuplizer; import org.hibernate.type.Type; import org.hibernate.type.VersionType; import org.hibernate.util.EqualsHelper; /** - * L'idee pour pouvoir indiquer dans quelle repertoire sauver les fichiers - * est de prendre comme repertoire de base la propriete - * System.getProperty("topia.flatfile.directory." + ObjectUtils.identityToString(factory)) - * Il faudra donc creer cette propriete lorsque l'on creer la factory + * L'idee pour pouvoir indiquer dans quelle repertoire sauver les fichiers est + * de prendre comme repertoire de base la propriete + * System.getProperty("topia.flatfile.directory." + + * ObjectUtils.identityToString(factory)) Il faudra donc creer cette propriete + * lorsque l'on creer la factory * * Ensuite un sous repertoire est creer en fonction du nom de table dans le * fichier de mapping * * @author poussin - * + * */ public class FlatFilePersister implements EntityPersister { - + private static final Hashtable INSTANCES = new Hashtable(); protected EntityMetamodel entityMetamodel; @@ -56,125 +58,135 @@ protected Mapping mapping; protected Map entityNameBySubclass = new HashMap(); - public FlatFilePersister( - PersistentClass model, - CacheConcurrencyStrategy cache, - SessionFactoryImplementor factory, - Mapping mapping) { + public FlatFilePersister(PersistentClass model, + CacheConcurrencyStrategy cache, SessionFactoryImplementor factory, + Mapping mapping) { this.model = model; this.cache = cache; - this.factory = factory; + this.factory = factory; this.mapping = mapping; - + entityMetamodel = new EntityMetamodel(model, factory); - - if ( model.hasPojoRepresentation() ) { - //TODO: this is currently specific to pojos, but need to be available for all entity-modes + + if (model.hasPojoRepresentation()) { + // TODO: this is currently specific to pojos, but need to be + // available for all entity-modes Iterator iter = model.getSubclassIterator(); - while ( iter.hasNext() ) { - PersistentClass pc = ( PersistentClass ) iter.next(); - entityNameBySubclass.put( pc.getMappedClass(), pc.getEntityName() ); + while (iter.hasNext()) { + PersistentClass pc = (PersistentClass) iter.next(); + entityNameBySubclass.put(pc.getMappedClass(), pc + .getEntityName()); } } - } + } + + /* + * (non-Javadoc) + * + * @see org.hibernate.persister.entity.EntityPersister#getEntityMetamodel() + */ + public EntityMetamodel getEntityMetamodel() { + return entityMetamodel; + } + + public boolean hasLazyProperties() { + return false; + } + + private void checkEntityMode(EntityMode entityMode) { + if (EntityMode.POJO != entityMode) { + throw new IllegalArgumentException("Unhandled EntityMode : " + + entityMode); + } + } + + public boolean isInherited() { + return false; + } - public boolean hasLazyProperties() { - return false; - } - - private void checkEntityMode(EntityMode entityMode) { - if ( EntityMode.POJO != entityMode ) { - throw new IllegalArgumentException( "Unhandled EntityMode : " + entityMode ); - } - } - - public boolean isInherited() { - return false; - } - - public SessionFactoryImplementor getFactory() { - return factory; - } + public SessionFactoryImplementor getFactory() { + return factory; + } public Class getMappedClass(EntityMode entityMode) { - checkEntityMode( entityMode ); + checkEntityMode(entityMode); Tuplizer tup = entityMetamodel.getTuplizerOrNull(entityMode); - return tup==null ? null : tup.getMappedClass(); + return tup == null ? null : tup.getMappedClass(); } - public void postInstantiate() throws MappingException {} + public void postInstantiate() throws MappingException { + } public String getEntityName() { return entityMetamodel.getName(); } - - public boolean isSubclassEntityName(String entityName) { + + public boolean isSubclassEntityName(String entityName) { return entityMetamodel.getSubclassEntityNames().contains(entityName); - } + } - public boolean hasProxy() { - return false; - } - - public boolean hasCollections() { - return false; - } - - public boolean hasCascades() { - return false; - } - - public boolean isMutable() { - return true; - } - - public boolean isSelectBeforeUpdateRequired() { - return false; - } - - public boolean isIdentifierAssignedByInsert() { - return false; - } + public boolean hasProxy() { + return false; + } - public Boolean isTransient(Object entity, SessionImplementor session) throws HibernateException { + public boolean hasCollections() { + return false; + } + + public boolean hasCascades() { + return false; + } + + public boolean isMutable() { + return true; + } + + public boolean isSelectBeforeUpdateRequired() { + return false; + } + + public boolean isIdentifierAssignedByInsert() { + return false; + } + + public Boolean isTransient(Object entity, SessionImplementor session) + throws HibernateException { final Serializable id; - if ( hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) { - id = getIdentifier( entity, session.getEntityMode() ); - } - else { + if (hasIdentifierPropertyOrEmbeddedCompositeIdentifier()) { + id = getIdentifier(entity, session.getEntityMode()); + } else { id = null; } // we *always* assume an instance with a null // identifier or no identifier property is unsaved! - if ( id == null ) return Boolean.TRUE; + if (id == null) + return Boolean.TRUE; // check the version unsaved-value, if appropriate - final Object version = getVersion( entity, session.getEntityMode() ); - if ( isVersioned() ) { + final Object version = getVersion(entity, session.getEntityMode()); + if (isVersioned()) { // let this take precedence if defined, since it works for // assigned identifiers Boolean result = entityMetamodel.getVersionProperty() - .getUnsavedValue().isUnsaved( version ); - if ( result != null ) return result; + .getUnsavedValue().isUnsaved(version); + if (result != null) + return result; } // check the id unsaved-value Boolean result = entityMetamodel.getIdentifierProperty() - .getUnsavedValue().isUnsaved( id ); - if ( result != null ) return result; + .getUnsavedValue().isUnsaved(id); + if (result != null) + return result; // check to see if it is in the second-level cache - if ( hasCache() ) { - CacheKey ck = new CacheKey( - id, - getIdentifierType(), - getRootEntityName(), - session.getEntityMode(), - session.getFactory() - ); - if ( getCache().get( ck, session.getTimestamp() ) != null ) { + if (hasCache()) { + CacheKey ck = new CacheKey(id, getIdentifierType(), + getRootEntityName(), session.getEntityMode(), session + .getFactory()); + if (getCache().get(ck, session.getTimestamp()) != null) { return Boolean.FALSE; } } @@ -182,288 +194,273 @@ return null; } - public Object[] getPropertyValuesToInsert(Object object, Map mergeMap, SessionImplementor session) - throws HibernateException { - return getPropertyValues( object, session.getEntityMode() ); - } - - public void processInsertGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session) { - } - - public void processUpdateGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session) { - } - - public void retrieveGeneratedProperties(Serializable id, Object entity, Object[] state, SessionImplementor session) { - throw new UnsupportedOperationException(); - } - - public boolean implementsLifecycle(EntityMode entityMode) { - checkEntityMode( entityMode ); - return false; - } - - public boolean implementsValidatable(EntityMode entityMode) { - checkEntityMode( entityMode ); - return false; - } + public Object[] getPropertyValuesToInsert(Object object, Map mergeMap, + SessionImplementor session) throws HibernateException { + return getPropertyValues(object, session.getEntityMode()); + } + + public void processInsertGeneratedProperties(Serializable id, + Object entity, Object[] state, SessionImplementor session) { + } + + public void processUpdateGeneratedProperties(Serializable id, + Object entity, Object[] state, SessionImplementor session) { + } + + public void retrieveGeneratedProperties(Serializable id, Object entity, + Object[] state, SessionImplementor session) { + throw new UnsupportedOperationException(); + } + + public boolean implementsLifecycle(EntityMode entityMode) { + checkEntityMode(entityMode); + return false; + } + + public boolean implementsValidatable(EntityMode entityMode) { + checkEntityMode(entityMode); + return false; + } protected EntityTuplizer getTuplizer(EntityMode entityMode) { - checkEntityMode( entityMode ); - return entityMetamodel.getTuplizer( entityMode ); + checkEntityMode(entityMode); + return entityMetamodel.getTuplizer(entityMode); } - public Class getConcreteProxyClass(EntityMode entityMode) { - return getTuplizer( entityMode ).getConcreteProxyClass(); - } + public Class getConcreteProxyClass(EntityMode entityMode) { + return getTuplizer(entityMode).getConcreteProxyClass(); + } - public void setPropertyValues(Object object, Object[] values, EntityMode entityMode) throws HibernateException { - getTuplizer( entityMode ).setPropertyValues( object, values ); - } + public void setPropertyValues(Object object, Object[] values, + EntityMode entityMode) throws HibernateException { + getTuplizer(entityMode).setPropertyValues(object, values); + } - public void setPropertyValue(Object object, int i, Object value, EntityMode entityMode) throws HibernateException { - getTuplizer( entityMode ).setPropertyValue( object, i, value ); - } + public void setPropertyValue(Object object, int i, Object value, + EntityMode entityMode) throws HibernateException { + getTuplizer(entityMode).setPropertyValue(object, i, value); + } - public Object[] getPropertyValues(Object object, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).getPropertyValues( object ); - } + public Object[] getPropertyValues(Object object, EntityMode entityMode) + throws HibernateException { + return getTuplizer(entityMode).getPropertyValues(object); + } - public Object getPropertyValue(Object object, int i, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).getPropertyValue( object , i ); - } + public Object getPropertyValue(Object object, int i, EntityMode entityMode) + throws HibernateException { + return getTuplizer(entityMode).getPropertyValue(object, i); + } - public Object getPropertyValue(Object object, String propertyName, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).getPropertyValue( object, propertyName ); - } + public Object getPropertyValue(Object object, String propertyName, + EntityMode entityMode) throws HibernateException { + return getTuplizer(entityMode).getPropertyValue(object, propertyName); + } - public Serializable getIdentifier(Object object, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).getIdentifier( object ); - } + public Serializable getIdentifier(Object object, EntityMode entityMode) + throws HibernateException { + return getTuplizer(entityMode).getIdentifier(object); + } - public void setIdentifier(Object object, Serializable id, EntityMode entityMode) throws HibernateException { - getTuplizer( entityMode ).setIdentifier( object, id ); - } + public void setIdentifier(Object object, Serializable id, + EntityMode entityMode) throws HibernateException { + getTuplizer(entityMode).setIdentifier(object, id); + } - public Object getVersion(Object object, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).getVersion( object ); - } + public Object getVersion(Object object, EntityMode entityMode) + throws HibernateException { + return getTuplizer(entityMode).getVersion(object); + } - public Object instantiate(Serializable id, EntityMode entityMode) throws HibernateException { - return getTuplizer( entityMode ).instantiate( id ); - } + public Object instantiate(Serializable id, EntityMode entityMode) + throws HibernateException { + return getTuplizer(entityMode).instantiate(id); + } - public boolean isInstance(Object object, EntityMode entityMode) { - return getTuplizer( entityMode ).isInstance( object ); - } + public boolean isInstance(Object object, EntityMode entityMode) { + return getTuplizer(entityMode).isInstance(object); + } - public boolean hasUninitializedLazyProperties(Object object, EntityMode entityMode) { - return getTuplizer( entityMode ).hasUninitializedLazyProperties( object ); - } + public boolean hasUninitializedLazyProperties(Object object, + EntityMode entityMode) { + return getTuplizer(entityMode).hasUninitializedLazyProperties(object); + } - public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion, EntityMode entityMode) { - getTuplizer( entityMode ).resetIdentifier( entity, currentId, currentVersion ); - } + public void resetIdentifier(Object entity, Serializable currentId, + Object currentVersion, EntityMode entityMode) { + getTuplizer(entityMode).resetIdentifier(entity, currentId, + currentVersion); + } public boolean hasSubclasses() { return entityMetamodel.hasSubclasses(); } - + private String getSubclassEntityName(Class clazz) { - return entityNameBySubclass.get( clazz ); + return entityNameBySubclass.get(clazz); } - public EntityPersister getSubclassEntityPersister(Object instance, SessionFactoryImplementor factory, EntityMode entityMode) { - if ( !hasSubclasses() ) { + public EntityPersister getSubclassEntityPersister(Object instance, + SessionFactoryImplementor factory, EntityMode entityMode) { + if (!hasSubclasses()) { return this; - } - else { + } else { // TODO : really need a way to do something like : - // getTuplizer(entityMode).determineConcreteSubclassEntityName(instance) + // getTuplizer(entityMode).determineConcreteSubclassEntityName(instance) Class clazz = instance.getClass(); - if ( clazz == getMappedClass( entityMode ) ) { + if (clazz == getMappedClass(entityMode)) { return this; - } - else { - String subclassEntityName = getSubclassEntityName( clazz ); - if ( subclassEntityName == null ) { - throw new HibernateException( "instance not of expected entity type: " + getEntityName() ); - } - else { - return factory.getEntityPersister( subclassEntityName ); + } else { + String subclassEntityName = getSubclassEntityName(clazz); + if (subclassEntityName == null) { + throw new HibernateException( + "instance not of expected entity type: " + + getEntityName()); + } else { + return factory.getEntityPersister(subclassEntityName); } } } - } + } - public int[] findDirty( - Object[] x, - Object[] y, - Object owner, - SessionImplementor session - ) throws HibernateException { - if ( !EqualsHelper.equals( x[0], y[0] ) ) { - return new int[] { 0 }; - } - else { - return null; - } - } - - public int[] findModified( - Object[] x, - Object[] y, - Object owner, - SessionImplementor session - ) throws HibernateException { - if ( !EqualsHelper.equals( x[0], y[0] ) ) { - return new int[] { 0 }; - } - else { - return null; - } - } - - /** - * @see EntityPersister#hasIdentifierProperty() - */ - public boolean hasIdentifierProperty() { - return true; - } - - /** - * @see EntityPersister#isVersioned() - */ - public boolean isVersioned() { - return false; - } - - /** - * @see EntityPersister#getVersionType() - */ - public VersionType getVersionType() { - return null; - } - - /** - * @see EntityPersister#getVersionProperty() - */ - public int getVersionProperty() { - return 0; - } - - /** - * @see EntityPersister#getIdentifierGenerator() - */ - public IdentifierGenerator getIdentifierGenerator() - throws HibernateException { + public int[] findDirty(Object[] x, Object[] y, Object owner, + SessionImplementor session) throws HibernateException { + if (!EqualsHelper.equals(x[0], y[0])) { + return new int[] { 0 }; + } else { + return null; + } + } + + public int[] findModified(Object[] x, Object[] y, Object owner, + SessionImplementor session) throws HibernateException { + if (!EqualsHelper.equals(x[0], y[0])) { + return new int[] { 0 }; + } else { + return null; + } + } + + /** + * @see EntityPersister#hasIdentifierProperty() + */ + public boolean hasIdentifierProperty() { + return true; + } + + /** + * @see EntityPersister#isVersioned() + */ + public boolean isVersioned() { + return false; + } + + /** + * @see EntityPersister#getVersionType() + */ + public VersionType getVersionType() { + return null; + } + + /** + * @see EntityPersister#getVersionProperty() + */ + public int getVersionProperty() { + return 0; + } + + /** + * @see EntityPersister#getIdentifierGenerator() + */ + public IdentifierGenerator getIdentifierGenerator() + throws HibernateException { return entityMetamodel.getIdentifierProperty().getIdentifierGenerator(); - } + } - /** - * @see EntityPersister#load(Serializable, Object, LockMode, SessionImplementor) - */ - public Object load( - Serializable id, - Object optionalObject, - LockMode lockMode, - SessionImplementor session - ) throws HibernateException { -// FIXME a faire - - // fails when optional object is supplied - - Object clone = null; -// Object obj = INSTANCES.get(id); -// if (obj!=null) { -// clone = obj.clone(); -// TwoPhaseLoad.addUninitializedEntity( -// new EntityKey( id, this, session.getEntityMode() ), -// clone, -// this, -// LockMode.NONE, -// false, -// session -// ); -// TwoPhaseLoad.postHydrate( -// this, id, -// new String[] { obj.getName() }, -// null, -// clone, -// LockMode.NONE, -// false, -// session -// ); -// TwoPhaseLoad.initializeEntity( -// clone, -// false, -// session, -// new PreLoadEvent( (EventSource) session ), -// new PostLoadEvent( (EventSource) session ) -// ); -// } - return clone; - } - - /** - * @see EntityPersister#lock(Serializable, Object, Object, LockMode, SessionImplementor) - */ - public void lock( - Serializable id, - Object version, - Object object, - LockMode lockMode, - SessionImplementor session - ) throws HibernateException { - - throw new UnsupportedOperationException(); - } - - public void insert( - Serializable id, - Object[] fields, - Object object, - SessionImplementor session - ) throws HibernateException { -// FIXME a faire -// INSTANCES.put(id, ( (Custom) object ).clone() ); - } - - public Serializable insert(Object[] fields, Object object, SessionImplementor session) - throws HibernateException { - - throw new UnsupportedOperationException(); - } - - public void delete( - Serializable id, - Object version, - Object object, - SessionImplementor session - ) throws HibernateException { -// FIXME a faire - - INSTANCES.remove(id); - } - - /** - * @see EntityPersister - */ - public void update( - Serializable id, - Object[] fields, - int[] dirtyFields, - boolean hasDirtyCollection, - Object[] oldFields, - Object oldVersion, - Object object, - Object rowId, - SessionImplementor session - ) throws HibernateException { -// FIXME a faire + /** + * @see EntityPersister#load(Serializable, Object, LockMode, + * SessionImplementor) + */ + public Object load(Serializable id, Object optionalObject, + LockMode lockMode, SessionImplementor session) + throws HibernateException { + // FIXME a faire + + // fails when optional object is supplied + + Object clone = null; + // Object obj = INSTANCES.get(id); + // if (obj!=null) { + // clone = obj.clone(); + // TwoPhaseLoad.addUninitializedEntity( + // new EntityKey( id, this, session.getEntityMode() ), + // clone, + // this, + // LockMode.NONE, + // false, + // session + // ); + // TwoPhaseLoad.postHydrate( + // this, id, + // new String[] { obj.getName() }, + // null, + // clone, + // LockMode.NONE, + // false, + // session + // ); + // TwoPhaseLoad.initializeEntity( + // clone, + // false, + // session, + // new PreLoadEvent( (EventSource) session ), + // new PostLoadEvent( (EventSource) session ) + // ); + // } + return clone; + } + + /** + * @see EntityPersister#lock(Serializable, Object, Object, LockMode, + * SessionImplementor) + */ + public void lock(Serializable id, Object version, Object object, + LockMode lockMode, SessionImplementor session) + throws HibernateException { + + throw new UnsupportedOperationException(); + } + + public void insert(Serializable id, Object[] fields, Object object, + SessionImplementor session) throws HibernateException { + // FIXME a faire + // INSTANCES.put(id, ( (Custom) object ).clone() ); + } + + public Serializable insert(Object[] fields, Object object, + SessionImplementor session) throws HibernateException { + + throw new UnsupportedOperationException(); + } + + public void delete(Serializable id, Object version, Object object, + SessionImplementor session) throws HibernateException { + // FIXME a faire + + INSTANCES.remove(id); + } + + /** + * @see EntityPersister + */ + public void update(Serializable id, Object[] fields, int[] dirtyFields, + boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, + Object object, Object rowId, SessionImplementor session) + throws HibernateException { + // FIXME a faire -// INSTANCES.put( id, ( (Custom) object ).clone() ); + // INSTANCES.put( id, ( (Custom) object ).clone() ); - } + } public String[] getPropertyNames() { return entityMetamodel.getPropertyNames(); @@ -481,39 +478,38 @@ return entityMetamodel.getIdentifierProperty().getType(); } + /** + * @see EntityPersister#hasCache() + */ + public boolean hasCache() { + return false; + } - /** - * @see EntityPersister#hasCache() - */ - public boolean hasCache() { - return false; - } - - /** - * @see EntityPersister#getCache() - */ - public CacheConcurrencyStrategy getCache() { - return null; - } + /** + * @see EntityPersister#getCache() + */ + public CacheConcurrencyStrategy getCache() { + return null; + } public String getRootEntityName() { return entityMetamodel.getRootName(); } - public Serializable[] getPropertySpaces() { - return new String[] { "CUSTOMS" }; - } + public Serializable[] getPropertySpaces() { + return new String[] { "CUSTOMS" }; + } public Serializable[] getQuerySpaces() { return getPropertySpaces(); } - /** - * @see EntityPersister#getClassMetadata() - */ - public ClassMetadata getClassMetadata() { - return null; - } + /** + * @see EntityPersister#getClassMetadata() + */ + public ClassMetadata getClassMetadata() { + return null; + } public boolean[] getPropertyUpdateability() { return entityMetamodel.getPropertyUpdateability(); @@ -531,12 +527,30 @@ return entityMetamodel.getPropertyInsertability(); } - public boolean[] getPropertyInsertGeneration() { - return entityMetamodel.getPropertyInsertGeneration(); - } - - public boolean[] getPropertyUpdateGeneration() { - return entityMetamodel.getPropertyUpdateGeneration(); + /* + * public boolean[] getPropertyInsertGeneration() { return + * entityMetamodel.getPropertyInsertGeneration(); } + * + * public boolean[] getPropertyUpdateGeneration() { return + * entityMetamodel.getPropertyUpdateGeneration(); } + */ + + /* + * (non-Javadoc) + * + * @see org.hibernate.persister.entity.EntityPersister#getPropertyInsertGenerationInclusions() + */ + public ValueInclusion[] getPropertyInsertGenerationInclusions() { + return entityMetamodel.getPropertyInsertGenerationInclusions(); + } + + /* + * (non-Javadoc) + * + * @see org.hibernate.persister.entity.EntityPersister#getPropertyUpdateGenerationInclusions() + */ + public ValueInclusion[] getPropertyUpdateGenerationInclusions() { + return entityMetamodel.getPropertyUpdateGenerationInclusions(); } public boolean[] getPropertyNullability() { @@ -551,133 +565,132 @@ return entityMetamodel.getCascadeStyles(); } - public boolean hasIdentifierPropertyOrEmbeddedCompositeIdentifier() { - return true; - } - - public boolean isBatchLoadable() { - return false; - } - - public Type getPropertyType(String propertyName) { - throw new UnsupportedOperationException(); - } - - public Object getPropertyValue(Object object, String propertyName) - throws HibernateException { - throw new UnsupportedOperationException(); - } - - public Object createProxy(Serializable id, SessionImplementor session) - throws HibernateException { - throw new UnsupportedOperationException("no proxy for this class"); - } - - public Object getCurrentVersion( - Serializable id, - SessionImplementor session) - throws HibernateException { - - return INSTANCES.get(id); - } - - public EntityMode guessEntityMode(Object object) { - if ( !isInstance(object, EntityMode.POJO) ) { - return null; - } - else { - return EntityMode.POJO; - } - } - - public boolean isDynamic() { - return false; - } - - public boolean isCacheInvalidationRequired() { - return false; - } - - public void applyFilters(QuerySelect select, String alias, Map filters) { - } - - public void applyFilters(Select select, String alias, Map filters) { - } - - - public void afterInitialize(Object entity, boolean fetched, SessionImplementor session) { - } - - public void afterReassociate(Object entity, SessionImplementor session) { - } - - public Object[] getDatabaseSnapshot(Serializable id, SessionImplementor session) - throws HibernateException { - return null; - } - - public CacheEntryStructure getCacheEntryStructure() { - return new UnstructuredCacheEntry(); - } - - public boolean hasSubselectLoadableCollections() { - return false; - } - - public int[] getNaturalIdentifierProperties() { - return null; - } - - public Type[] getNaturalIdentifierTypes() { - return null; - } - - public boolean hasNaturalIdentifier() { - return false; - } - - public boolean hasMutableProperties() { - return false; - } - - public boolean isInstrumented(EntityMode entityMode) { - return false; - } - - public boolean hasInsertGeneratedProperties() { - return false; - } - - public boolean hasUpdateGeneratedProperties() { - return false; - } - - public boolean[] getPropertyLaziness() { - return null; - } - - public boolean isLazyPropertiesCacheable() { - return true; - } - - public boolean hasGeneratedProperties() { - return false; - } - - public boolean isVersionPropertyGenerated() { - return false; - } - - public Object[] getNaturalIdentifierSnapshot(Serializable id, SessionImplementor session) throws HibernateException { - return null; - } + public boolean hasIdentifierPropertyOrEmbeddedCompositeIdentifier() { + return true; + } + + public boolean isBatchLoadable() { + return false; + } + + public Type getPropertyType(String propertyName) { + throw new UnsupportedOperationException(); + } + + public Object getPropertyValue(Object object, String propertyName) + throws HibernateException { + throw new UnsupportedOperationException(); + } + + public Object createProxy(Serializable id, SessionImplementor session) + throws HibernateException { + throw new UnsupportedOperationException("no proxy for this class"); + } + + public Object getCurrentVersion(Serializable id, SessionImplementor session) + throws HibernateException { + + return INSTANCES.get(id); + } + + public EntityMode guessEntityMode(Object object) { + if (!isInstance(object, EntityMode.POJO)) { + return null; + } else { + return EntityMode.POJO; + } + } + + public boolean isDynamic() { + return false; + } + + public boolean isCacheInvalidationRequired() { + return false; + } + + public void applyFilters(QuerySelect select, String alias, Map filters) { + } + + public void applyFilters(Select select, String alias, Map filters) { + } + + public void afterInitialize(Object entity, boolean fetched, + SessionImplementor session) { + } + + public void afterReassociate(Object entity, SessionImplementor session) { + } + + public Object[] getDatabaseSnapshot(Serializable id, + SessionImplementor session) throws HibernateException { + return null; + } + + public CacheEntryStructure getCacheEntryStructure() { + return new UnstructuredCacheEntry(); + } + + public boolean hasSubselectLoadableCollections() { + return false; + } + + public int[] getNaturalIdentifierProperties() { + return null; + } + + public Type[] getNaturalIdentifierTypes() { + return null; + } + + public boolean hasNaturalIdentifier() { + return false; + } + + public boolean hasMutableProperties() { + return false; + } + + public boolean isInstrumented(EntityMode entityMode) { + return false; + } + + public boolean hasInsertGeneratedProperties() { + return false; + } + + public boolean hasUpdateGeneratedProperties() { + return false; + } + + public boolean[] getPropertyLaziness() { + return null; + } + + public boolean isLazyPropertiesCacheable() { + return true; + } + + public boolean hasGeneratedProperties() { + return false; + } + + public boolean isVersionPropertyGenerated() { + return false; + } + + public Object[] getNaturalIdentifierSnapshot(Serializable id, + SessionImplementor session) throws HibernateException { + return null; + } public boolean canExtractIdOutOfEntity() { // FIXME a renseigner return false; } - public Object forceVersionIncrement(Serializable arg0, Object arg1, SessionImplementor arg2) throws HibernateException { + public Object forceVersionIncrement(Serializable arg0, Object arg1, + SessionImplementor arg2) throws HibernateException { // FIXME a renseigner return null; } @@ -686,5 +699,4 @@ // FIXME a renseigner return null; } - }