You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <hib...@li...> - 2006-03-29 08:57:37
|
Author: epbernard Date: 2006-03-29 03:56:23 -0500 (Wed, 29 Mar 2006) New Revision: 9710 Added: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/CreateKeySecondPass.java Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/TvMagazinPk.java Log: ANN-292 Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-03-29 03:32:24 UTC (rev 9709) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-03-29 08:56:23 UTC (rev 9710) @@ -505,7 +505,7 @@ boolean onDeleteAppropriate = false; if ( InheritanceType.JOINED.equals( inheritanceState.type ) && inheritanceState.hasParents ) { onDeleteAppropriate = true; - JoinedSubclass jsc = (JoinedSubclass) persistentClass; + final JoinedSubclass jsc = (JoinedSubclass) persistentClass; if ( persistentClass.getEntityPersisterClass() == null ) { persistentClass.getRootClass().setEntityPersisterClass( JoinedSubclassEntityPersister.class ); } @@ -518,8 +518,7 @@ key.setCascadeDeleteEnabled( false ); } TableBinder.bindFk( jsc.getSuperclass(), jsc, inheritanceJoinedColumns, key, false, mappings ); - jsc.createPrimaryKey(); - jsc.createForeignKey(); + mappings.addSecondPass( new CreateKeySecondPass(jsc) ); } else if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.type ) ) { @@ -643,7 +642,7 @@ subclassAndSingleTableStrategy ? Nullability.FORCED_NULL : Nullability.NO_CONSTRAINT, propertyAnnotatedElement.getProperty(), propertyAnnotatedElement, classGenerators, entityBinder, - false, false, entityBinder.getPropertyAccessor(), mappings + false, false, mappings ); } else { @@ -664,7 +663,8 @@ } if ( ! inheritanceState.hasParents ) { - ( (RootClass) persistentClass ).createPrimaryKey(); + final RootClass rootClass = (RootClass) persistentClass; + mappings.addSecondPass( new CreateKeySecondPass(rootClass) ); } else { superEntity.addSubclass( (Subclass) persistentClass ); @@ -925,7 +925,7 @@ PropertyHolder propertyHolder, Nullability nullability, XProperty property, PropertyData inferredData, HashMap<String, IdGenerator> classGenerators, EntityBinder entityBinder, boolean isIdentifierMapper, - boolean isComponentEmbedded, String accessType, ExtendedMappings mappings + boolean isComponentEmbedded, ExtendedMappings mappings ) throws MappingException { Ejb3Column[] columns = null; @@ -1479,7 +1479,7 @@ subHolder, isNullable ? Nullability.NO_CONSTRAINT : Nullability.FORCED_NOT_NULL, propertyAnnotatedElement.getProperty(), propertyAnnotatedElement, new HashMap<String, IdGenerator>(), entityBinder, isIdentifierMapper, isComponentEmbedded, - propertyAccessor, mappings + mappings ); } return comp; @@ -1512,9 +1512,10 @@ propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, isEmbedded, isIdentifierMapper, mappings ); - ( (Component) id ).setKey( true ); - if ( ! id.getColumnIterator().hasNext() ) { - throw new AnnotationException( ( (Component) id ).getComponentClassName() + " has not persistent id property" ); + Component componentId = (Component) id; + componentId.setKey( true ); + if ( componentId.getPropertySpan() == 0 ) { + throw new AnnotationException( componentId.getComponentClassName() + " has no persistent id property" ); } } else { @@ -1541,11 +1542,12 @@ PersistentIdentifierGenerator.TABLE, table.getName() ); - Iterator idColumnIterator = id.getColumnIterator(); - params.setProperty( - PersistentIdentifierGenerator.PK, - ( (org.hibernate.mapping.Column) idColumnIterator.next() ).getName() - ); + if ( id.getColumnSpan() == 1) { + params.setProperty( + PersistentIdentifierGenerator.PK, + ( (org.hibernate.mapping.Column) id.getColumnIterator().next() ).getName() + ); + } if ( ! isDefault( generatorName ) ) { //we have a named generator IdGenerator gen = mappings.getGenerator( generatorName, localGenerators ); Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-03-29 03:32:24 UTC (rev 9709) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-03-29 08:56:23 UTC (rev 9710) @@ -240,6 +240,15 @@ iter.remove(); } } + iter = secondPasses.iterator(); + while ( iter.hasNext() ) { + SecondPass sp = (SecondPass) iter.next(); + //do the second pass of fk before the others and remove them + if ( sp instanceof CreateKeySecondPass ) { + sp.doSecondPass( classes, Collections.EMPTY_MAP ); // TODO: align meta-attributes with normal bind... + iter.remove(); + } + } inSecondPass = true; super.secondPassCompile(); inSecondPass = false; Added: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/CreateKeySecondPass.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/CreateKeySecondPass.java 2006-03-29 03:32:24 UTC (rev 9709) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/CreateKeySecondPass.java 2006-03-29 08:56:23 UTC (rev 9710) @@ -0,0 +1,37 @@ +//$Id: $ +package org.hibernate.cfg; + +import java.util.Map; + +import org.hibernate.MappingException; +import org.hibernate.mapping.RootClass; +import org.hibernate.mapping.JoinedSubclass; + +/** + * @author Emmanuel Bernard + */ +public class CreateKeySecondPass implements SecondPass { + private RootClass rootClass; + private JoinedSubclass joinedSubClass; + + public CreateKeySecondPass(RootClass rootClass) { + this.rootClass = rootClass; + } + + public CreateKeySecondPass(JoinedSubclass joinedSubClass) { + this.joinedSubClass = joinedSubClass; + } + + public void doSecondPass(Map persistentClasses, Map inheritedMetas) throws MappingException { + if (rootClass != null) { + rootClass.createPrimaryKey(); + } + else if (joinedSubClass != null) { + joinedSubClass.createPrimaryKey(); + joinedSubClass.createForeignKey(); + } + else { + throw new AssertionError( "rootClass and joinedSubClass are null" ); + } + } +} Modified: trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java =================================================================== --- trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java 2006-03-29 03:32:24 UTC (rev 9709) +++ trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/CompositeIdTest.java 2006-03-29 08:56:23 UTC (rev 9710) @@ -71,15 +71,16 @@ TvMagazin mag = new TvMagazin(); mag.time = new Date(); mag.id = pk; - pk.name = "Trax"; + //pk.name = "Trax"; pk.channel = channel; pk.presenter = pres; s.persist( mag ); tx.commit(); s.clear(); tx = s.beginTransaction(); - mag = (TvMagazin) s.createQuery( "from TvMagazin mag where mag.id.name = :name") - .setParameter( "name", "Trax" ).uniqueResult(); + mag = (TvMagazin) s.createQuery( "from TvMagazin mag") // where mag.id.name = :name") + //.setParameter( "name", "Trax" ) + .uniqueResult(); assertNotNull( mag.id ); assertNotNull( mag.id.channel ); assertEquals( channel.id, mag.id.channel.id ); Modified: trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/TvMagazinPk.java =================================================================== --- trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/TvMagazinPk.java 2006-03-29 03:32:24 UTC (rev 9709) +++ trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/cid/TvMagazinPk.java 2006-03-29 08:56:23 UTC (rev 9710) @@ -12,7 +12,7 @@ public class TvMagazinPk implements Serializable { @ManyToOne public Channel channel; - public String name; + //public String name; @ManyToOne public Presenter presenter; } |
From: <hib...@li...> - 2006-03-29 03:32:31
|
Author: ste...@jb... Date: 2006-03-28 22:32:24 -0500 (Tue, 28 Mar 2006) New Revision: 9709 Modified: trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java Log: HHH-1175 : oops Modified: trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-29 03:31:49 UTC (rev 9708) +++ trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-29 03:32:24 UTC (rev 9709) @@ -169,9 +169,6 @@ else if ( "database-object".equals( elementName ) ) { bindAuxiliaryDatabaseObject( element, mappings ); } - else { - throw new MappingException( "Unrecognized element [hibernate-mapping/" + elementName + "]" ); - } } } |
From: <hib...@li...> - 2006-03-29 03:31:54
|
Author: ste...@jb... Date: 2006-03-28 22:31:49 -0500 (Tue, 28 Mar 2006) New Revision: 9708 Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java Log: HHH-1175 : oops Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java =================================================================== --- branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-28 22:24:56 UTC (rev 9707) +++ branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-29 03:31:49 UTC (rev 9708) @@ -169,9 +169,6 @@ else if ( "database-object".equals( elementName ) ) { bindAuxiliaryDatabaseObject( element, mappings ); } - else { - throw new MappingException( "Unrecognized element [hibernate-mapping/" + elementName + "]" ); - } } } |
From: <hib...@li...> - 2006-03-28 22:24:59
|
Author: ste...@jb... Date: 2006-03-28 17:24:56 -0500 (Tue, 28 Mar 2006) New Revision: 9707 Modified: branches/Branch_3_1/Hibernate3/build.xml Log: .md5.txt extension on release checksum files Modified: branches/Branch_3_1/Hibernate3/build.xml =================================================================== --- branches/Branch_3_1/Hibernate3/build.xml 2006-03-28 20:00:04 UTC (rev 9706) +++ branches/Branch_3_1/Hibernate3/build.xml 2006-03-28 22:24:56 UTC (rev 9707) @@ -466,13 +466,13 @@ <zip zipfile="${fullname}.zip"> <zipfileset prefix="${name}-${version.sansPatchLevel}" dir="${dist.dir}"/> </zip> - <checksum file="${fullname}.zip"/> + <checksum file="${fullname}.zip" algorithm="MD5" fileext=".md5.txt"/> <tar tarfile="${fullname}.tar"> <tarfileset prefix="${name}-${version.sansPatchLevel}" dir="${dist.dir}"/> </tar> <gzip src="${fullname}.tar" zipfile="${fullname}.tar.gz"/> <delete file="${dist.dir}.tar"/> - <checksum file="${fullname}.tar.gz"/> + <checksum file="${fullname}.tar.gz" algorithm="MD5" fileext=".md5.txt"/> </target> <target name="info" description="Echo system properties"> |
From: <hib...@li...> - 2006-03-28 20:00:17
|
Author: ste...@jb... Date: 2006-03-28 15:00:04 -0500 (Tue, 28 Mar 2006) New Revision: 9706 Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/StatelessSession.java branches/Branch_3_1/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java branches/Branch_3_1/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java Log: HHH-1266 : StatelessSession.refresh() Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/StatelessSession.java =================================================================== --- branches/Branch_3_1/Hibernate3/src/org/hibernate/StatelessSession.java 2006-03-28 19:59:31 UTC (rev 9705) +++ branches/Branch_3_1/Hibernate3/src/org/hibernate/StatelessSession.java 2006-03-28 20:00:04 UTC (rev 9706) @@ -27,67 +27,125 @@ * Close the stateless session and release the JDBC connection. */ public void close(); + /** * Insert a row. + * * @param entity a new transient instance */ public Serializable insert(Object entity); + /** - * Update a row. - * @param entity a detached entity instance - */ - public void update(Object entity); - /** - * Delete a row. - * @param entity a detached entity instance - */ - public void delete(Object entity); - /** * Insert a row. + * + * @param entityName The entityName for the entity to be inserted * @param entity a new transient instance * @return the identifier of the instance */ public Serializable insert(String entityName, Object entity); + /** * Update a row. + * * @param entity a detached entity instance */ + public void update(Object entity); + + /** + * Update a row. + * + * @param entityName The entityName for the entity to be updated + * @param entity a detached entity instance + */ public void update(String entityName, Object entity); + /** * Delete a row. + * * @param entity a detached entity instance */ + public void delete(Object entity); + + /** + * Delete a row. + * + * @param entityName The entityName for the entity to be deleted + * @param entity a detached entity instance + */ public void delete(String entityName, Object entity); + /** * Retrieve a row. + * * @return a detached entity instance */ public Object get(String entityName, Serializable id); + /** * Retrieve a row. + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id); + /** * Retrieve a row, obtaining the specified lock mode. + * * @return a detached entity instance */ public Object get(String entityName, Serializable id, LockMode lockMode); + /** * Retrieve a row, obtaining the specified lock mode. + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id, LockMode lockMode); + /** + * Refresh the entity instance state from the database. + * + * @param entity The entity to be refreshed. + */ + public void refresh(Object entity); + + /** + * Refresh the entity instance state from the database. + * + * @param entityName The entityName for the entity to be refreshed. + * @param entity The entity to be refreshed. + */ + public void refresh(String entityName, Object entity); + + /** + * Refresh the entity instance state from the database. + * + * @param entity The entity to be refreshed. + * @param lockMode The LockMode to be applied. + */ + public void refresh(Object entity, LockMode lockMode); + + /** + * Refresh the entity instance state from the database. + * + * @param entityName The entityName for the entity to be refreshed. + * @param entity The entity to be refreshed. + * @param lockMode The LockMode to be applied. + */ + public void refresh(String entityName, Object entity, LockMode lockMode); + + /** * Create a new instance of <tt>Query</tt> for the given HQL query string. * Entities returned by the query are detached. */ public Query createQuery(String queryString); + /** * Obtain an instance of <tt>Query</tt> for a named query string defined in * the mapping file. Entities returned by the query are detached. */ public Query getNamedQuery(String queryName); + /** * Create a new <tt>Criteria</tt> instance, for the given entity class, * or a superclass of an entity class. Entities returned by the query are @@ -97,6 +155,7 @@ * @return Criteria */ public Criteria createCriteria(Class persistentClass); + /** * Create a new <tt>Criteria</tt> instance, for the given entity class, * or a superclass of an entity class, with the given alias. @@ -106,6 +165,7 @@ * @return Criteria */ public Criteria createCriteria(Class persistentClass, String alias); + /** * Create a new <tt>Criteria</tt> instance, for the given entity name. * Entities returned by the query are detached. @@ -114,6 +174,7 @@ * @return Criteria */ public Criteria createCriteria(String entityName); + /** * Create a new <tt>Criteria</tt> instance, for the given entity name, * with the given alias. Entities returned by the query are detached. @@ -122,6 +183,7 @@ * @return Criteria */ public Criteria createCriteria(String entityName, String alias); + /** * Create a new instance of <tt>SQLQuery</tt> for the given SQL query string. * Entities returned by the query are detached. @@ -131,19 +193,22 @@ * @throws HibernateException */ public SQLQuery createSQLQuery(String queryString) throws HibernateException; + /** * Begin a Hibernate transaction. */ public Transaction beginTransaction(); + /** * Get the current Hibernate transaction. */ public Transaction getTransaction(); + /** * Returns the current JDBC connection associated with this * instance.<br> * <br> - * If the session is using aggressive collection release (as in a + * If the session is using aggressive connection release (as in a * CMT environment), it is the application's responsibility to * close the connection returned by this call. Otherwise, the * application should not close the connection. Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java =================================================================== --- branches/Branch_3_1/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java 2006-03-28 19:59:31 UTC (rev 9705) +++ branches/Branch_3_1/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java 2006-03-28 20:00:04 UTC (rev 9706) @@ -4,7 +4,6 @@ import java.io.Serializable; import java.sql.Connection; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -25,6 +24,9 @@ import org.hibernate.SessionException; import org.hibernate.StatelessSession; import org.hibernate.Transaction; +import org.hibernate.UnresolvableObjectException; +import org.hibernate.cache.CacheKey; +import org.hibernate.pretty.MessageHelper; import org.hibernate.collection.PersistentCollection; import org.hibernate.engine.EntityKey; import org.hibernate.engine.PersistenceContext; @@ -44,46 +46,33 @@ import org.hibernate.proxy.HibernateProxy; import org.hibernate.type.Type; import org.hibernate.util.CollectionHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Gavin King */ public class StatelessSessionImpl extends AbstractSessionImpl implements JDBCContext.Context, StatelessSession { - + + private static final Log log = LogFactory.getLog( StatelessSessionImpl.class ); + private JDBCContext jdbcContext; - - StatelessSessionImpl( - Connection connection, - SessionFactoryImpl factory - ) { - super(factory); + private PersistenceContext temporaryPersistenceContext = new StatefulPersistenceContext( this ); + + StatelessSessionImpl(Connection connection, SessionFactoryImpl factory) { + super( factory ); this.jdbcContext = new JDBCContext( this, connection, EmptyInterceptor.INSTANCE ); } - public boolean isOpen() { - return !isClosed(); - } - public void close() { - managedClose(); - } - - public void delete(Object entity) { - errorIfClosed(); - delete(null, entity); - } + // inserts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public Serializable insert(Object entity) { errorIfClosed(); return insert(null, entity); } - public void update(Object entity) { - errorIfClosed(); - update(null, entity); - } - public Serializable insert(String entityName, Object entity) { errorIfClosed(); EntityPersister persister = getEntityPersister(entityName, entity); @@ -91,18 +80,44 @@ Object[] state = persister.getPropertyValues(entity, EntityMode.POJO); if ( persister.isVersioned() ) { boolean substitute = Versioning.seedVersion(state, persister.getVersionProperty(), persister.getVersionType(), this); - if (substitute) persister.setPropertyValues(entity, state, EntityMode.POJO); + if ( substitute ) { + persister.setPropertyValues( entity, state, EntityMode.POJO ); + } } if ( id == IdentifierGeneratorFactory.POST_INSERT_INDICATOR ) { id = persister.insert(state, entity, this); } else { - persister.insert(id, state, entity, this); + persister.insert(id, state, entity, this); } persister.setIdentifier(entity, id, EntityMode.POJO); return id; } - + + + // deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public void delete(Object entity) { + errorIfClosed(); + delete(null, entity); + } + + public void delete(String entityName, Object entity) { + errorIfClosed(); + EntityPersister persister = getEntityPersister(entityName, entity); + Serializable id = persister.getIdentifier(entity, EntityMode.POJO); + Object version = persister.getVersion(entity, EntityMode.POJO); + persister.delete(id, version, entity, this); + } + + + // updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public void update(Object entity) { + errorIfClosed(); + update(null, entity); + } + public void update(String entityName, Object entity) { errorIfClosed(); EntityPersister persister = getEntityPersister(entityName, entity); @@ -120,15 +135,141 @@ } persister.update(id, state, null, false, null, oldVersion, entity, null, this); } - - public void delete(String entityName, Object entity) { + + + // loading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public Object get(Class entityClass, Serializable id) { + return get( entityClass.getName(), id ); + } + + public Object get(Class entityClass, Serializable id, LockMode lockMode) { + return get( entityClass.getName(), id, lockMode ); + } + + public Object get(String entityName, Serializable id) { + return get(entityName, id, LockMode.NONE); + } + + public Object get(String entityName, Serializable id, LockMode lockMode) { errorIfClosed(); - EntityPersister persister = getEntityPersister(entityName, entity); - Serializable id = persister.getIdentifier(entity, EntityMode.POJO); - Object version = persister.getVersion(entity, EntityMode.POJO); - persister.delete(id, version, entity, this); + Object result = getFactory().getEntityPersister(entityName) + .load(id, null, lockMode, this); + temporaryPersistenceContext.clear(); + return result; } + public void refresh(Object entity) { + refresh( bestGuessEntityName( entity ), entity, LockMode.NONE ); + } + + public void refresh(String entityName, Object entity) { + refresh( entityName, entity, LockMode.NONE ); + } + + public void refresh(Object entity, LockMode lockMode) { + refresh( bestGuessEntityName( entity ), entity, lockMode ); + } + + public void refresh(String entityName, Object entity, LockMode lockMode) { + final EntityPersister persister = this.getEntityPersister( entityName, entity ); + final Serializable id = persister.getIdentifier( entity, getEntityMode() ); + if ( log.isTraceEnabled() ) { + log.trace( + "refreshing transient " + + MessageHelper.infoString( persister, id, this.getFactory() ) + ); + } + // TODO : can this ever happen??? +// EntityKey key = new EntityKey( id, persister, source.getEntityMode() ); +// if ( source.getPersistenceContext().getEntry( key ) != null ) { +// throw new PersistentObjectException( +// "attempted to refresh transient instance when persistent " + +// "instance was already associated with the Session: " + +// MessageHelper.infoString( persister, id, source.getFactory() ) +// ); +// } + + if ( persister.hasCache() ) { + final CacheKey ck = new CacheKey( + id, + persister.getIdentifierType(), + persister.getRootEntityName(), + this.getEntityMode(), + this.getFactory() + ); + persister.getCache().remove(ck); + } + + String previousFetchProfile = this.getFetchProfile(); + Object result = null; + try { + this.setFetchProfile( "refresh" ); + result = persister.load( id, entity, lockMode, this ); + } + finally { + this.setFetchProfile( previousFetchProfile ); + } + UnresolvableObjectException.throwIfNull( result, id, persister.getEntityName() ); + } + + public Object immediateLoad(String entityName, Serializable id) + throws HibernateException { + throw new SessionException("proxies cannot be fetched by a stateless session"); + } + + public void initializeCollection( + PersistentCollection collection, + boolean writing) throws HibernateException { + throw new SessionException("collections cannot be fetched by a stateless session"); + } + + public Object instantiate( + String entityName, + Serializable id) throws HibernateException { + errorIfClosed(); + return getFactory().getEntityPersister( entityName ) + .instantiate( id, EntityMode.POJO ); + } + + public Object internalLoad( + String entityName, + Serializable id, + boolean eager, + boolean nullable) throws HibernateException { + errorIfClosed(); + EntityPersister persister = getFactory().getEntityPersister(entityName); + if ( !eager && persister.hasProxy() ) { + return persister.createProxy(id, this); + } + Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) ); + //TODO: if not loaded, throw an exception + return loaded==null ? get(entityName, id) : loaded; + } + + public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { + throw new UnsupportedOperationException(); + } + + public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) + throws HibernateException { + throw new UnsupportedOperationException(); + } + + public List listFilter(Object collection, String filter, QueryParameters queryParameters) + throws HibernateException { + throw new UnsupportedOperationException(); + } + + + public boolean isOpen() { + return !isClosed(); + } + + public void close() { + managedClose(); + } + public ConnectionReleaseMode getConnectionReleaseMode() { return factory.getSettings().getConnectionReleaseMode(); } @@ -178,8 +319,8 @@ return jdbcContext.borrowConnection(); } - public int executeUpdate(String query, QueryParameters queryParameters) - throws HibernateException { + public int executeUpdate(String query, QueryParameters queryParameters) + throws HibernateException { errorIfClosed(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); @@ -223,11 +364,11 @@ return EntityMode.POJO; } - public EntityPersister getEntityPersister(String entityName, Object object) - throws HibernateException { + public EntityPersister getEntityPersister(String entityName, Object object) + throws HibernateException { errorIfClosed(); - if (entityName==null) { - return factory.getEntityPersister( guessEntityName(object) ); + if ( entityName==null ) { + return factory.getEntityPersister( guessEntityName( object ) ); } else { return factory.getEntityPersister( entityName ) @@ -267,60 +408,13 @@ public long getTimestamp() { throw new UnsupportedOperationException(); } - - private PersistenceContext temporaryPersistenceContext = new StatefulPersistenceContext(this); - - public Object get(Class entityClass, Serializable id) { - return get( entityClass.getName(), id ); - } - - public Object get(Class entityClass, Serializable id, LockMode lockMode) { - return get( entityClass.getName(), id, lockMode ); - } - - public Object get(String entityName, Serializable id) { - return get(entityName, id, LockMode.NONE); - } - public Object get(String entityName, Serializable id, LockMode lockMode) { - errorIfClosed(); - Object result = getFactory().getEntityPersister(entityName) - .load(id, null, lockMode, this); - temporaryPersistenceContext.clear(); - return result; - } - public String guessEntityName(Object entity) throws HibernateException { errorIfClosed(); return entity.getClass().getName(); } - public Object immediateLoad(String entityName, Serializable id) throws HibernateException { - throw new SessionException("proxies cannot be fetched by a stateless session"); - } - public void initializeCollection(PersistentCollection collection, boolean writing) - throws HibernateException { - throw new SessionException("collections cannot be fetched by a stateless session"); - } - - public Object instantiate(String entityName, Serializable id) throws HibernateException { - errorIfClosed(); - return getFactory().getEntityPersister(entityName).instantiate(id, EntityMode.POJO); - } - - public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) - throws HibernateException { - errorIfClosed(); - EntityPersister persister = getFactory().getEntityPersister(entityName); - if ( !eager && persister.hasProxy() ) { - return persister.createProxy(id, this); - } - Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) ); - //TODO: if not loaded, throw an exception - return loaded==null ? get(entityName, id) : loaded; - } - public boolean isConnected() { return jdbcContext.getConnectionManager().isCurrentlyConnected(); } @@ -329,20 +423,6 @@ return jdbcContext.isTransactionInProgress(); } - public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { - throw new UnsupportedOperationException(); - } - - public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) - throws HibernateException { - throw new UnsupportedOperationException(); - } - - public List listFilter(Object collection, String filter, QueryParameters queryParameters) - throws HibernateException { - throw new UnsupportedOperationException(); - } - public void setAutoClear(boolean enabled) { throw new UnsupportedOperationException(); } @@ -354,25 +434,25 @@ public void setFlushMode(FlushMode fm) { throw new UnsupportedOperationException(); } - + public Transaction getTransaction() throws HibernateException { errorIfClosed(); return jdbcContext.getTransaction(); } - + public Transaction beginTransaction() throws HibernateException { errorIfClosed(); Transaction result = getTransaction(); result.begin(); return result; } - + public boolean isEventSource() { return false; } - + ///////////////////////////////////////////////////////////////////////////////////////////////////// - + //TODO: COPY/PASTE FROM SessionImpl, pull up! public List list(String query, QueryParameters queryParameters) throws HibernateException { @@ -423,9 +503,9 @@ String entityName = criteria.getEntityOrClassName(); CriteriaLoader loader = new CriteriaLoader( getOuterJoinLoadable(entityName), - factory, - criteria, - entityName, + factory, + criteria, + entityName, getEnabledFilters() ); return loader.scroll(this, scrollMode); @@ -437,22 +517,16 @@ int size = implementors.length; CriteriaLoader[] loaders = new CriteriaLoader[size]; - Set spaces = new HashSet(); for( int i=0; i <size; i++ ) { - loaders[i] = new CriteriaLoader( getOuterJoinLoadable( implementors[i] ), - factory, - criteria, - implementors[i], + factory, + criteria, + implementors[i], getEnabledFilters() ); - - spaces.addAll( loaders[i].getQuerySpaces() ); - } - List results = Collections.EMPTY_LIST; boolean success = false; try { @@ -478,7 +552,7 @@ return ( OuterJoinLoadable ) persister; } - public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) + public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); @@ -496,7 +570,7 @@ return results; } - public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) + public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); Modified: branches/Branch_3_1/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java =================================================================== --- branches/Branch_3_1/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java 2006-03-28 19:59:31 UTC (rev 9705) +++ branches/Branch_3_1/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java 2006-03-28 20:00:04 UTC (rev 9706) @@ -129,7 +129,33 @@ ss.close(); } - + public void testRefresh() { + StatelessSession ss = getSessions().openStatelessSession(); + Transaction tx = ss.beginTransaction(); + Paper paper = new Paper(); + paper.setColor( "whtie" ); + ss.insert( paper ); + tx.commit(); + ss.close(); + + ss = getSessions().openStatelessSession(); + tx = ss.beginTransaction(); + Paper p2 = ( Paper ) ss.get( Paper.class, paper.getId() ); + p2.setColor( "White" ); + ss.update( p2 ); + tx.commit(); + ss.close(); + + ss = getSessions().openStatelessSession(); + tx = ss.beginTransaction(); + assertEquals( "whtie", paper.getColor() ); + ss.refresh( paper ); + assertEquals( "White", paper.getColor() ); + ss.delete( paper ); + tx.commit(); + ss.close(); + } + protected String[] getMappings() { return new String[] { "stateless/Document.hbm.xml" }; } |
From: <hib...@li...> - 2006-03-28 19:59:40
|
Author: ste...@jb... Date: 2006-03-28 14:59:31 -0500 (Tue, 28 Mar 2006) New Revision: 9705 Modified: trunk/Hibernate3/src/org/hibernate/StatelessSession.java trunk/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java trunk/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java Log: HHH-1266 : StatelessSession.refresh() Modified: trunk/Hibernate3/src/org/hibernate/StatelessSession.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/StatelessSession.java 2006-03-28 18:59:59 UTC (rev 9704) +++ trunk/Hibernate3/src/org/hibernate/StatelessSession.java 2006-03-28 19:59:31 UTC (rev 9705) @@ -9,9 +9,9 @@ * against a database.<br> * <br> * A stateless session does not implement a first-level cache nor - * interact with any second-level cache, nor does it implement - * transactional write-behind or automatic dirty checking, nor do - * operations cascade to associated instances. Collections are + * interact with any second-level cache, nor does it implement + * transactional write-behind or automatic dirty checking, nor do + * operations cascade to associated instances. Collections are * ignored by a stateless session. Operations performed via a * stateless session bypass Hibernate's event model and * interceptors. Stateless sessions are vulnerable to data @@ -19,7 +19,7 @@ * <br> * For certain kinds of transactions, a stateless session may * perform slightly faster than a stateful session. - * + * * @author Gavin King */ public interface StatelessSession extends Serializable { @@ -27,76 +27,135 @@ * Close the stateless session and release the JDBC connection. */ public void close(); + /** * Insert a row. + * * @param entity a new transient instance */ public Serializable insert(Object entity); + /** - * Update a row. - * @param entity a detached entity instance - */ - public void update(Object entity); - /** - * Delete a row. - * @param entity a detached entity instance - */ - public void delete(Object entity); - /** * Insert a row. + * + * @param entityName The entityName for the entity to be inserted * @param entity a new transient instance * @return the identifier of the instance */ public Serializable insert(String entityName, Object entity); + /** * Update a row. + * * @param entity a detached entity instance */ + public void update(Object entity); + + /** + * Update a row. + * + * @param entityName The entityName for the entity to be updated + * @param entity a detached entity instance + */ public void update(String entityName, Object entity); + /** * Delete a row. + * * @param entity a detached entity instance */ + public void delete(Object entity); + + /** + * Delete a row. + * + * @param entityName The entityName for the entity to be deleted + * @param entity a detached entity instance + */ public void delete(String entityName, Object entity); + /** * Retrieve a row. + * * @return a detached entity instance */ public Object get(String entityName, Serializable id); + /** * Retrieve a row. + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id); + /** * Retrieve a row, obtaining the specified lock mode. + * * @return a detached entity instance */ public Object get(String entityName, Serializable id, LockMode lockMode); + /** * Retrieve a row, obtaining the specified lock mode. + * * @return a detached entity instance */ public Object get(Class entityClass, Serializable id, LockMode lockMode); + /** + * Refresh the entity instance state from the database. + * + * @param entity The entity to be refreshed. + */ + public void refresh(Object entity); + + /** + * Refresh the entity instance state from the database. + * + * @param entityName The entityName for the entity to be refreshed. + * @param entity The entity to be refreshed. + */ + public void refresh(String entityName, Object entity); + + /** + * Refresh the entity instance state from the database. + * + * @param entity The entity to be refreshed. + * @param lockMode The LockMode to be applied. + */ + public void refresh(Object entity, LockMode lockMode); + + /** + * Refresh the entity instance state from the database. + * + * @param entityName The entityName for the entity to be refreshed. + * @param entity The entity to be refreshed. + * @param lockMode The LockMode to be applied. + */ + public void refresh(String entityName, Object entity, LockMode lockMode); + + /** * Create a new instance of <tt>Query</tt> for the given HQL query string. * Entities returned by the query are detached. */ public Query createQuery(String queryString); + /** - * Obtain an instance of <tt>Query</tt> for a named query string defined in + * Obtain an instance of <tt>Query</tt> for a named query string defined in * the mapping file. Entities returned by the query are detached. */ public Query getNamedQuery(String queryName); + /** * Create a new <tt>Criteria</tt> instance, for the given entity class, - * or a superclass of an entity class. Entities returned by the query are + * or a superclass of an entity class. Entities returned by the query are * detached. * * @param persistentClass a class, which is persistent, or has persistent subclasses * @return Criteria */ public Criteria createCriteria(Class persistentClass); + /** * Create a new <tt>Criteria</tt> instance, for the given entity class, * or a superclass of an entity class, with the given alias. @@ -106,6 +165,7 @@ * @return Criteria */ public Criteria createCriteria(Class persistentClass, String alias); + /** * Create a new <tt>Criteria</tt> instance, for the given entity name. * Entities returned by the query are detached. @@ -114,6 +174,7 @@ * @return Criteria */ public Criteria createCriteria(String entityName); + /** * Create a new <tt>Criteria</tt> instance, for the given entity name, * with the given alias. Entities returned by the query are detached. @@ -122,6 +183,7 @@ * @return Criteria */ public Criteria createCriteria(String entityName, String alias); + /** * Create a new instance of <tt>SQLQuery</tt> for the given SQL query string. * Entities returned by the query are detached. @@ -131,19 +193,22 @@ * @throws HibernateException */ public SQLQuery createSQLQuery(String queryString) throws HibernateException; + /** * Begin a Hibernate transaction. */ public Transaction beginTransaction(); + /** * Get the current Hibernate transaction. */ public Transaction getTransaction(); + /** * Returns the current JDBC connection associated with this * instance.<br> - * <br> - * If the session is using aggressive collection release (as in a + * <br> + * If the session is using aggressive connection release (as in a * CMT environment), it is the application's responsibility to * close the connection returned by this call. Otherwise, the * application should not close the connection. Modified: trunk/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java 2006-03-28 18:59:59 UTC (rev 9704) +++ trunk/Hibernate3/src/org/hibernate/impl/StatelessSessionImpl.java 2006-03-28 19:59:31 UTC (rev 9705) @@ -4,7 +4,6 @@ import java.io.Serializable; import java.sql.Connection; import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -25,6 +24,9 @@ import org.hibernate.SessionException; import org.hibernate.StatelessSession; import org.hibernate.Transaction; +import org.hibernate.UnresolvableObjectException; +import org.hibernate.cache.CacheKey; +import org.hibernate.pretty.MessageHelper; import org.hibernate.collection.PersistentCollection; import org.hibernate.engine.EntityKey; import org.hibernate.engine.PersistenceContext; @@ -44,46 +46,33 @@ import org.hibernate.proxy.HibernateProxy; import org.hibernate.type.Type; import org.hibernate.util.CollectionHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @author Gavin King */ public class StatelessSessionImpl extends AbstractSessionImpl implements JDBCContext.Context, StatelessSession { - + + private static final Log log = LogFactory.getLog( StatelessSessionImpl.class ); + private JDBCContext jdbcContext; - - StatelessSessionImpl( - Connection connection, - SessionFactoryImpl factory - ) { - super(factory); + private PersistenceContext temporaryPersistenceContext = new StatefulPersistenceContext( this ); + + StatelessSessionImpl(Connection connection, SessionFactoryImpl factory) { + super( factory ); this.jdbcContext = new JDBCContext( this, connection, EmptyInterceptor.INSTANCE ); } - public boolean isOpen() { - return !isClosed(); - } - public void close() { - managedClose(); - } - - public void delete(Object entity) { - errorIfClosed(); - delete(null, entity); - } + // inserts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public Serializable insert(Object entity) { errorIfClosed(); return insert(null, entity); } - public void update(Object entity) { - errorIfClosed(); - update(null, entity); - } - public Serializable insert(String entityName, Object entity) { errorIfClosed(); EntityPersister persister = getEntityPersister(entityName, entity); @@ -91,18 +80,44 @@ Object[] state = persister.getPropertyValues(entity, EntityMode.POJO); if ( persister.isVersioned() ) { boolean substitute = Versioning.seedVersion(state, persister.getVersionProperty(), persister.getVersionType(), this); - if (substitute) persister.setPropertyValues(entity, state, EntityMode.POJO); + if ( substitute ) { + persister.setPropertyValues( entity, state, EntityMode.POJO ); + } } if ( id == IdentifierGeneratorFactory.POST_INSERT_INDICATOR ) { id = persister.insert(state, entity, this); } else { - persister.insert(id, state, entity, this); + persister.insert(id, state, entity, this); } persister.setIdentifier(entity, id, EntityMode.POJO); return id; } - + + + // deletes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public void delete(Object entity) { + errorIfClosed(); + delete(null, entity); + } + + public void delete(String entityName, Object entity) { + errorIfClosed(); + EntityPersister persister = getEntityPersister(entityName, entity); + Serializable id = persister.getIdentifier(entity, EntityMode.POJO); + Object version = persister.getVersion(entity, EntityMode.POJO); + persister.delete(id, version, entity, this); + } + + + // updates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public void update(Object entity) { + errorIfClosed(); + update(null, entity); + } + public void update(String entityName, Object entity) { errorIfClosed(); EntityPersister persister = getEntityPersister(entityName, entity); @@ -120,15 +135,141 @@ } persister.update(id, state, null, false, null, oldVersion, entity, null, this); } - - public void delete(String entityName, Object entity) { + + + // loading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public Object get(Class entityClass, Serializable id) { + return get( entityClass.getName(), id ); + } + + public Object get(Class entityClass, Serializable id, LockMode lockMode) { + return get( entityClass.getName(), id, lockMode ); + } + + public Object get(String entityName, Serializable id) { + return get(entityName, id, LockMode.NONE); + } + + public Object get(String entityName, Serializable id, LockMode lockMode) { errorIfClosed(); - EntityPersister persister = getEntityPersister(entityName, entity); - Serializable id = persister.getIdentifier(entity, EntityMode.POJO); - Object version = persister.getVersion(entity, EntityMode.POJO); - persister.delete(id, version, entity, this); + Object result = getFactory().getEntityPersister(entityName) + .load(id, null, lockMode, this); + temporaryPersistenceContext.clear(); + return result; } + public void refresh(Object entity) { + refresh( bestGuessEntityName( entity ), entity, LockMode.NONE ); + } + + public void refresh(String entityName, Object entity) { + refresh( entityName, entity, LockMode.NONE ); + } + + public void refresh(Object entity, LockMode lockMode) { + refresh( bestGuessEntityName( entity ), entity, lockMode ); + } + + public void refresh(String entityName, Object entity, LockMode lockMode) { + final EntityPersister persister = this.getEntityPersister( entityName, entity ); + final Serializable id = persister.getIdentifier( entity, getEntityMode() ); + if ( log.isTraceEnabled() ) { + log.trace( + "refreshing transient " + + MessageHelper.infoString( persister, id, this.getFactory() ) + ); + } + // TODO : can this ever happen??? +// EntityKey key = new EntityKey( id, persister, source.getEntityMode() ); +// if ( source.getPersistenceContext().getEntry( key ) != null ) { +// throw new PersistentObjectException( +// "attempted to refresh transient instance when persistent " + +// "instance was already associated with the Session: " + +// MessageHelper.infoString( persister, id, source.getFactory() ) +// ); +// } + + if ( persister.hasCache() ) { + final CacheKey ck = new CacheKey( + id, + persister.getIdentifierType(), + persister.getRootEntityName(), + this.getEntityMode(), + this.getFactory() + ); + persister.getCache().remove(ck); + } + + String previousFetchProfile = this.getFetchProfile(); + Object result = null; + try { + this.setFetchProfile( "refresh" ); + result = persister.load( id, entity, lockMode, this ); + } + finally { + this.setFetchProfile( previousFetchProfile ); + } + UnresolvableObjectException.throwIfNull( result, id, persister.getEntityName() ); + } + + public Object immediateLoad(String entityName, Serializable id) + throws HibernateException { + throw new SessionException("proxies cannot be fetched by a stateless session"); + } + + public void initializeCollection( + PersistentCollection collection, + boolean writing) throws HibernateException { + throw new SessionException("collections cannot be fetched by a stateless session"); + } + + public Object instantiate( + String entityName, + Serializable id) throws HibernateException { + errorIfClosed(); + return getFactory().getEntityPersister( entityName ) + .instantiate( id, EntityMode.POJO ); + } + + public Object internalLoad( + String entityName, + Serializable id, + boolean eager, + boolean nullable) throws HibernateException { + errorIfClosed(); + EntityPersister persister = getFactory().getEntityPersister(entityName); + if ( !eager && persister.hasProxy() ) { + return persister.createProxy(id, this); + } + Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) ); + //TODO: if not loaded, throw an exception + return loaded==null ? get( entityName, id ) : loaded; + } + + public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { + throw new UnsupportedOperationException(); + } + + public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) + throws HibernateException { + throw new UnsupportedOperationException(); + } + + public List listFilter(Object collection, String filter, QueryParameters queryParameters) + throws HibernateException { + throw new UnsupportedOperationException(); + } + + + public boolean isOpen() { + return !isClosed(); + } + + public void close() { + managedClose(); + } + public ConnectionReleaseMode getConnectionReleaseMode() { return factory.getSettings().getConnectionReleaseMode(); } @@ -178,8 +319,8 @@ return jdbcContext.borrowConnection(); } - public int executeUpdate(String query, QueryParameters queryParameters) - throws HibernateException { + public int executeUpdate(String query, QueryParameters queryParameters) + throws HibernateException { errorIfClosed(); queryParameters.validateParameters(); HQLQueryPlan plan = getHQLQueryPlan( query, false ); @@ -223,11 +364,11 @@ return EntityMode.POJO; } - public EntityPersister getEntityPersister(String entityName, Object object) - throws HibernateException { + public EntityPersister getEntityPersister(String entityName, Object object) + throws HibernateException { errorIfClosed(); - if (entityName==null) { - return factory.getEntityPersister( guessEntityName(object) ); + if ( entityName==null ) { + return factory.getEntityPersister( guessEntityName( object ) ); } else { return factory.getEntityPersister( entityName ) @@ -267,60 +408,13 @@ public long getTimestamp() { throw new UnsupportedOperationException(); } - - private PersistenceContext temporaryPersistenceContext = new StatefulPersistenceContext(this); - - public Object get(Class entityClass, Serializable id) { - return get( entityClass.getName(), id ); - } - - public Object get(Class entityClass, Serializable id, LockMode lockMode) { - return get( entityClass.getName(), id, lockMode ); - } - - public Object get(String entityName, Serializable id) { - return get(entityName, id, LockMode.NONE); - } - public Object get(String entityName, Serializable id, LockMode lockMode) { - errorIfClosed(); - Object result = getFactory().getEntityPersister(entityName) - .load(id, null, lockMode, this); - temporaryPersistenceContext.clear(); - return result; - } - public String guessEntityName(Object entity) throws HibernateException { errorIfClosed(); return entity.getClass().getName(); } - public Object immediateLoad(String entityName, Serializable id) throws HibernateException { - throw new SessionException("proxies cannot be fetched by a stateless session"); - } - public void initializeCollection(PersistentCollection collection, boolean writing) - throws HibernateException { - throw new SessionException("collections cannot be fetched by a stateless session"); - } - - public Object instantiate(String entityName, Serializable id) throws HibernateException { - errorIfClosed(); - return getFactory().getEntityPersister(entityName).instantiate(id, EntityMode.POJO); - } - - public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) - throws HibernateException { - errorIfClosed(); - EntityPersister persister = getFactory().getEntityPersister(entityName); - if ( !eager && persister.hasProxy() ) { - return persister.createProxy(id, this); - } - Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) ); - //TODO: if not loaded, throw an exception - return loaded==null ? get(entityName, id) : loaded; - } - public boolean isConnected() { return jdbcContext.getConnectionManager().isCurrentlyConnected(); } @@ -329,20 +423,6 @@ return jdbcContext.isTransactionInProgress(); } - public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException { - throw new UnsupportedOperationException(); - } - - public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) - throws HibernateException { - throw new UnsupportedOperationException(); - } - - public List listFilter(Object collection, String filter, QueryParameters queryParameters) - throws HibernateException { - throw new UnsupportedOperationException(); - } - public void setAutoClear(boolean enabled) { throw new UnsupportedOperationException(); } @@ -354,25 +434,25 @@ public void setFlushMode(FlushMode fm) { throw new UnsupportedOperationException(); } - + public Transaction getTransaction() throws HibernateException { errorIfClosed(); return jdbcContext.getTransaction(); } - + public Transaction beginTransaction() throws HibernateException { errorIfClosed(); Transaction result = getTransaction(); result.begin(); return result; } - + public boolean isEventSource() { return false; } - + ///////////////////////////////////////////////////////////////////////////////////////////////////// - + //TODO: COPY/PASTE FROM SessionImpl, pull up! public List list(String query, QueryParameters queryParameters) throws HibernateException { @@ -423,9 +503,9 @@ String entityName = criteria.getEntityOrClassName(); CriteriaLoader loader = new CriteriaLoader( getOuterJoinLoadable(entityName), - factory, - criteria, - entityName, + factory, + criteria, + entityName, getEnabledFilters() ); return loader.scroll(this, scrollMode); @@ -437,19 +517,14 @@ int size = implementors.length; CriteriaLoader[] loaders = new CriteriaLoader[size]; - Set spaces = new HashSet(); for( int i=0; i <size; i++ ) { - loaders[i] = new CriteriaLoader( getOuterJoinLoadable( implementors[i] ), - factory, - criteria, - implementors[i], + factory, + criteria, + implementors[i], getEnabledFilters() ); - - spaces.addAll( loaders[i].getQuerySpaces() ); - } @@ -478,7 +553,7 @@ return ( OuterJoinLoadable ) persister; } - public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) + public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); @@ -496,7 +571,7 @@ return results; } - public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) + public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException { errorIfClosed(); CustomLoader loader = new CustomLoader( customQuery, getFactory() ); Modified: trunk/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java 2006-03-28 18:59:59 UTC (rev 9704) +++ trunk/Hibernate3/test/org/hibernate/test/stateless/StatelessSessionTest.java 2006-03-28 19:59:31 UTC (rev 9705) @@ -128,6 +128,33 @@ tx.commit(); ss.close(); } + + public void testRefresh() { + StatelessSession ss = getSessions().openStatelessSession(); + Transaction tx = ss.beginTransaction(); + Paper paper = new Paper(); + paper.setColor( "whtie" ); + ss.insert( paper ); + tx.commit(); + ss.close(); + + ss = getSessions().openStatelessSession(); + tx = ss.beginTransaction(); + Paper p2 = ( Paper ) ss.get( Paper.class, paper.getId() ); + p2.setColor( "White" ); + ss.update( p2 ); + tx.commit(); + ss.close(); + + ss = getSessions().openStatelessSession(); + tx = ss.beginTransaction(); + assertEquals( "whtie", paper.getColor() ); + ss.refresh( paper ); + assertEquals( "White", paper.getColor() ); + ss.delete( paper ); + tx.commit(); + ss.close(); + } protected String[] getMappings() { |
From: <hib...@li...> - 2006-03-28 19:00:06
|
Author: ste...@jb... Date: 2006-03-28 13:59:59 -0500 (Tue, 28 Mar 2006) New Revision: 9704 Modified: trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java Log: HHH-1175 : hibernate-mapping sub-element ordering insensitivity Modified: trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-28 18:59:42 UTC (rev 9703) +++ trunk/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-28 18:59:59 UTC (rev 9704) @@ -122,125 +122,117 @@ } Element hmNode = doc.getRootElement(); - inheritedMetas = getMetas( hmNode, inheritedMetas, true ); // get meta's from - // <hibernate-mapping> + // get meta's from <hibernate-mapping> + inheritedMetas = getMetas( hmNode, inheritedMetas, true ); extractRootAttributes( hmNode, mappings ); - Iterator filterDefs = hmNode.elementIterator( "filter-def" ); - while ( filterDefs.hasNext() ) { - parseFilterDef( (Element) filterDefs.next(), mappings ); - } + Iterator rootChildren = hmNode.elementIterator(); + while ( rootChildren.hasNext() ) { + final Element element = (Element) rootChildren.next(); + final String elementName = element.getName(); - Iterator typeDefs = hmNode.elementIterator( "typedef" ); - while ( typeDefs.hasNext() ) { - Element typeDef = (Element) typeDefs.next(); - String typeClass = typeDef.attributeValue( "class" ); - String typeName = typeDef.attributeValue( "name" ); - Iterator paramIter = typeDef.elementIterator( "param" ); - Properties parameters = new Properties(); - while ( paramIter.hasNext() ) { - Element param = (Element) paramIter.next(); - parameters.setProperty( param.attributeValue( "name" ), param.getTextTrim() ); + if ( "filter-def".equals( elementName ) ) { + parseFilterDef( element, mappings ); } - - mappings.addTypeDef( typeName, typeClass, parameters ); + else if ( "typedef".equals( elementName ) ) { + bindTypeDef( element, mappings ); + } + else if ( "class".equals( elementName ) ) { + RootClass rootclass = new RootClass(); + bindRootClass( element, rootclass, mappings, inheritedMetas ); + mappings.addClass( rootclass ); + } + else if ( "subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "joined-subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleJoinedSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "union-subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleUnionSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "query".equals( elementName ) ) { + bindNamedQuery( element, null, mappings ); + } + else if ( "sql-query".equals( elementName ) ) { + bindNamedSQLQuery( element, null, mappings ); + } + else if ( "resultset".equals( elementName ) ) { + bindResultSetMappingDefinition( element, null, mappings ); + } + else if ( "import".equals( elementName ) ) { + bindImport( element, mappings ); + } + else if ( "database-object".equals( elementName ) ) { + bindAuxiliaryDatabaseObject( element, mappings ); + } + else { + throw new MappingException( "Unrecognized element [hibernate-mapping/" + elementName + "]" ); + } } + } - Iterator nodes = hmNode.elementIterator( "class" ); - while ( nodes.hasNext() ) { - Element n = (Element) nodes.next(); - RootClass rootclass = new RootClass(); - bindRootClass( n, rootclass, mappings, inheritedMetas ); - mappings.addClass( rootclass ); - } + private static void bindImport(Element importNode, Mappings mappings) { + String className = getClassName( importNode.attribute( "class" ), mappings ); + Attribute renameNode = importNode.attribute( "rename" ); + String rename = ( renameNode == null ) ? + StringHelper.unqualify( className ) : + renameNode.getValue(); + log.debug( "Import: " + rename + " -> " + className ); + mappings.addImport( className, rename ); + } - Iterator subclassnodes = hmNode.elementIterator( "subclass" ); - while ( subclassnodes.hasNext() ) { - Element subnode = (Element) subclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleSubclass( superModel, mappings, subnode, inheritedMetas ); + private static void bindTypeDef(Element typedefNode, Mappings mappings) { + String typeClass = typedefNode.attributeValue( "class" ); + String typeName = typedefNode.attributeValue( "name" ); + Iterator paramIter = typedefNode.elementIterator( "param" ); + Properties parameters = new Properties(); + while ( paramIter.hasNext() ) { + Element param = (Element) paramIter.next(); + parameters.setProperty( param.attributeValue( "name" ), param.getTextTrim() ); } + mappings.addTypeDef( typeName, typeClass, parameters ); + } - Iterator joinedsubclassnodes = hmNode.elementIterator( "joined-subclass" ); - while ( joinedsubclassnodes.hasNext() ) { - Element subnode = (Element) joinedsubclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleJoinedSubclass( superModel, mappings, subnode, inheritedMetas ); - } - - Iterator unionsubclassnodes = hmNode.elementIterator( "union-subclass" ); - while ( unionsubclassnodes.hasNext() ) { - Element subnode = (Element) unionsubclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleUnionSubclass( superModel, mappings, subnode, inheritedMetas ); - } - - nodes = hmNode.elementIterator( "query" ); - while ( nodes.hasNext() ) { - bindNamedQuery( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "sql-query" ); - while ( nodes.hasNext() ) { - bindNamedSQLQuery( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "resultset" ); - while ( nodes.hasNext() ) { - bindResultSetMappingDefinition( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "import" ); - while ( nodes.hasNext() ) { - Element n = (Element) nodes.next(); - String className = getClassName( n.attribute( "class" ), mappings ); - Attribute renameNode = n.attribute( "rename" ); - String rename = ( renameNode == null ) ? - StringHelper.unqualify( className ) : - renameNode.getValue(); - log.debug( "Import: " + rename + " -> " + className ); - mappings.addImport( className, rename ); - } - - nodes = hmNode.elementIterator( "database-object"); - while ( nodes.hasNext() ) { - Element auxDbObjectNode = ( Element ) nodes.next(); - AuxiliaryDatabaseObject auxDbObject = null; - Element definitionNode = auxDbObjectNode.element( "definition" ); - if ( definitionNode != null ) { - try { - auxDbObject = ( AuxiliaryDatabaseObject ) ReflectHelper - .classForName( definitionNode.attributeValue( "class" ) ) - .newInstance(); - } - catch( ClassNotFoundException e ) { - throw new MappingException( - "could not locate custom database object class [" + - definitionNode.attributeValue( "class" ) + "]" - ); - } - catch( Throwable t ) { - throw new MappingException( - "could not instantiate custom database object class [" + - definitionNode.attributeValue( "class" ) + "]" - ); - } + private static void bindAuxiliaryDatabaseObject(Element auxDbObjectNode, Mappings mappings) { + AuxiliaryDatabaseObject auxDbObject = null; + Element definitionNode = auxDbObjectNode.element( "definition" ); + if ( definitionNode != null ) { + try { + auxDbObject = ( AuxiliaryDatabaseObject ) ReflectHelper + .classForName( definitionNode.attributeValue( "class" ) ) + .newInstance(); } - else { - auxDbObject = new SimpleAuxiliaryDatabaseObject( - auxDbObjectNode.elementTextTrim( "create" ), - auxDbObjectNode.elementTextTrim( "drop" ) + catch( ClassNotFoundException e ) { + throw new MappingException( + "could not locate custom database object class [" + + definitionNode.attributeValue( "class" ) + "]" ); } - - Iterator dialectScopings = auxDbObjectNode.elementIterator( "dialect-scope" ); - while ( dialectScopings.hasNext() ) { - Element dialectScoping = ( Element ) dialectScopings.next(); - auxDbObject.addDialectScope( dialectScoping.attributeValue( "name" ) ); + catch( Throwable t ) { + throw new MappingException( + "could not instantiate custom database object class [" + + definitionNode.attributeValue( "class" ) + "]" + ); } + } + else { + auxDbObject = new SimpleAuxiliaryDatabaseObject( + auxDbObjectNode.elementTextTrim( "create" ), + auxDbObjectNode.elementTextTrim( "drop" ) + ); + } - mappings.addAuxiliaryDatabaseObject( auxDbObject ); + Iterator dialectScopings = auxDbObjectNode.elementIterator( "dialect-scope" ); + while ( dialectScopings.hasNext() ) { + Element dialectScoping = ( Element ) dialectScopings.next(); + auxDbObject.addDialectScope( dialectScoping.attributeValue( "name" ) ); } + + mappings.addAuxiliaryDatabaseObject( auxDbObject ); } private static void extractRootAttributes(Element hmNode, Mappings mappings) { @@ -260,7 +252,7 @@ mappings.setDefaultLazy( dlNode == null || dlNode.getValue().equals( "true" ) ); Attribute aiNode = hmNode.attribute( "auto-import" ); - mappings.setAutoImport( ( aiNode == null ) ? true : "true".equals( aiNode.getValue() ) ); + mappings.setAutoImport( ( aiNode == null ) || "true".equals( aiNode.getValue() ) ); Attribute packNode = hmNode.attribute( "package" ); if ( packNode != null ) mappings.setDefaultPackage( packNode.getValue() ); @@ -301,7 +293,7 @@ catalog, getClassTableName( entity, node, schema, catalog, null, mappings ), getSubselect( node ), - entity.isAbstract() == null ? false : entity.isAbstract().booleanValue() + entity.isAbstract() != null && entity.isAbstract().booleanValue() ); entity.setTable( table ); bindComment(table, node); @@ -607,13 +599,15 @@ // DYNAMIC UPDATE Attribute dynamicNode = node.attribute( "dynamic-update" ); - entity.setDynamicUpdate( ( dynamicNode == null ) ? false : "true".equals( dynamicNode - .getValue() ) ); + entity.setDynamicUpdate( + dynamicNode != null && "true".equals( dynamicNode.getValue() ) + ); // DYNAMIC INSERT Attribute insertNode = node.attribute( "dynamic-insert" ); - entity.setDynamicInsert( ( insertNode == null ) ? false : "true".equals( insertNode - .getValue() ) ); + entity.setDynamicInsert( + insertNode != null && "true".equals( insertNode.getValue() ) + ); // IMPORT mappings.addImport( entity.getEntityName(), entity.getEntityName() ); @@ -795,7 +789,7 @@ schema, catalog, getClassTableName(unionSubclass, node, schema, catalog, denormalizedSuperTable, mappings ), - unionSubclass.isAbstract() == null ? false : unionSubclass.isAbstract().booleanValue(), + unionSubclass.isAbstract() != null && unionSubclass.isAbstract().booleanValue(), getSubselect( node ), denormalizedSuperTable ); |
From: <hib...@li...> - 2006-03-28 18:59:47
|
Author: ste...@jb... Date: 2006-03-28 13:59:42 -0500 (Tue, 28 Mar 2006) New Revision: 9703 Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java Log: HHH-1175 : hibernate-mapping sub-element ordering insensitivity Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java =================================================================== --- branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-27 23:13:39 UTC (rev 9702) +++ branches/Branch_3_1/Hibernate3/src/org/hibernate/cfg/HbmBinder.java 2006-03-28 18:59:42 UTC (rev 9703) @@ -122,125 +122,117 @@ } Element hmNode = doc.getRootElement(); - inheritedMetas = getMetas( hmNode, inheritedMetas, true ); // get meta's from - // <hibernate-mapping> + // get meta's from <hibernate-mapping> + inheritedMetas = getMetas( hmNode, inheritedMetas, true ); extractRootAttributes( hmNode, mappings ); - Iterator filterDefs = hmNode.elementIterator( "filter-def" ); - while ( filterDefs.hasNext() ) { - parseFilterDef( (Element) filterDefs.next(), mappings ); - } + Iterator rootChildren = hmNode.elementIterator(); + while ( rootChildren.hasNext() ) { + final Element element = (Element) rootChildren.next(); + final String elementName = element.getName(); - Iterator typeDefs = hmNode.elementIterator( "typedef" ); - while ( typeDefs.hasNext() ) { - Element typeDef = (Element) typeDefs.next(); - String typeClass = typeDef.attributeValue( "class" ); - String typeName = typeDef.attributeValue( "name" ); - Iterator paramIter = typeDef.elementIterator( "param" ); - Properties parameters = new Properties(); - while ( paramIter.hasNext() ) { - Element param = (Element) paramIter.next(); - parameters.setProperty( param.attributeValue( "name" ), param.getTextTrim() ); + if ( "filter-def".equals( elementName ) ) { + parseFilterDef( element, mappings ); } - - mappings.addTypeDef( typeName, typeClass, parameters ); + else if ( "typedef".equals( elementName ) ) { + bindTypeDef( element, mappings ); + } + else if ( "class".equals( elementName ) ) { + RootClass rootclass = new RootClass(); + bindRootClass( element, rootclass, mappings, inheritedMetas ); + mappings.addClass( rootclass ); + } + else if ( "subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "joined-subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleJoinedSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "union-subclass".equals( elementName ) ) { + PersistentClass superModel = getSuperclass( mappings, element ); + handleUnionSubclass( superModel, mappings, element, inheritedMetas ); + } + else if ( "query".equals( elementName ) ) { + bindNamedQuery( element, null, mappings ); + } + else if ( "sql-query".equals( elementName ) ) { + bindNamedSQLQuery( element, null, mappings ); + } + else if ( "resultset".equals( elementName ) ) { + bindResultSetMappingDefinition( element, null, mappings ); + } + else if ( "import".equals( elementName ) ) { + bindImport( element, mappings ); + } + else if ( "database-object".equals( elementName ) ) { + bindAuxiliaryDatabaseObject( element, mappings ); + } + else { + throw new MappingException( "Unrecognized element [hibernate-mapping/" + elementName + "]" ); + } } + } - Iterator nodes = hmNode.elementIterator( "class" ); - while ( nodes.hasNext() ) { - Element n = (Element) nodes.next(); - RootClass rootclass = new RootClass(); - bindRootClass( n, rootclass, mappings, inheritedMetas ); - mappings.addClass( rootclass ); - } + private static void bindImport(Element importNode, Mappings mappings) { + String className = getClassName( importNode.attribute( "class" ), mappings ); + Attribute renameNode = importNode.attribute( "rename" ); + String rename = ( renameNode == null ) ? + StringHelper.unqualify( className ) : + renameNode.getValue(); + log.debug( "Import: " + rename + " -> " + className ); + mappings.addImport( className, rename ); + } - Iterator subclassnodes = hmNode.elementIterator( "subclass" ); - while ( subclassnodes.hasNext() ) { - Element subnode = (Element) subclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleSubclass( superModel, mappings, subnode, inheritedMetas ); + private static void bindTypeDef(Element typedefNode, Mappings mappings) { + String typeClass = typedefNode.attributeValue( "class" ); + String typeName = typedefNode.attributeValue( "name" ); + Iterator paramIter = typedefNode.elementIterator( "param" ); + Properties parameters = new Properties(); + while ( paramIter.hasNext() ) { + Element param = (Element) paramIter.next(); + parameters.setProperty( param.attributeValue( "name" ), param.getTextTrim() ); } + mappings.addTypeDef( typeName, typeClass, parameters ); + } - Iterator joinedsubclassnodes = hmNode.elementIterator( "joined-subclass" ); - while ( joinedsubclassnodes.hasNext() ) { - Element subnode = (Element) joinedsubclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleJoinedSubclass( superModel, mappings, subnode, inheritedMetas ); - } - - Iterator unionsubclassnodes = hmNode.elementIterator( "union-subclass" ); - while ( unionsubclassnodes.hasNext() ) { - Element subnode = (Element) unionsubclassnodes.next(); - PersistentClass superModel = getSuperclass( mappings, subnode ); - handleUnionSubclass( superModel, mappings, subnode, inheritedMetas ); - } - - nodes = hmNode.elementIterator( "query" ); - while ( nodes.hasNext() ) { - bindNamedQuery( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "sql-query" ); - while ( nodes.hasNext() ) { - bindNamedSQLQuery( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "resultset" ); - while ( nodes.hasNext() ) { - bindResultSetMappingDefinition( (Element) nodes.next(), null, mappings ); - } - - nodes = hmNode.elementIterator( "import" ); - while ( nodes.hasNext() ) { - Element n = (Element) nodes.next(); - String className = getClassName( n.attribute( "class" ), mappings ); - Attribute renameNode = n.attribute( "rename" ); - String rename = ( renameNode == null ) ? - StringHelper.unqualify( className ) : - renameNode.getValue(); - log.debug( "Import: " + rename + " -> " + className ); - mappings.addImport( className, rename ); - } - - nodes = hmNode.elementIterator( "database-object"); - while ( nodes.hasNext() ) { - Element auxDbObjectNode = ( Element ) nodes.next(); - AuxiliaryDatabaseObject auxDbObject = null; - Element definitionNode = auxDbObjectNode.element( "definition" ); - if ( definitionNode != null ) { - try { - auxDbObject = ( AuxiliaryDatabaseObject ) ReflectHelper - .classForName( definitionNode.attributeValue( "class" ) ) - .newInstance(); - } - catch( ClassNotFoundException e ) { - throw new MappingException( - "could not locate custom database object class [" + - definitionNode.attributeValue( "class" ) + "]" - ); - } - catch( Throwable t ) { - throw new MappingException( - "could not instantiate custom database object class [" + - definitionNode.attributeValue( "class" ) + "]" - ); - } + private static void bindAuxiliaryDatabaseObject(Element auxDbObjectNode, Mappings mappings) { + AuxiliaryDatabaseObject auxDbObject = null; + Element definitionNode = auxDbObjectNode.element( "definition" ); + if ( definitionNode != null ) { + try { + auxDbObject = ( AuxiliaryDatabaseObject ) ReflectHelper + .classForName( definitionNode.attributeValue( "class" ) ) + .newInstance(); } - else { - auxDbObject = new SimpleAuxiliaryDatabaseObject( - auxDbObjectNode.elementTextTrim( "create" ), - auxDbObjectNode.elementTextTrim( "drop" ) + catch( ClassNotFoundException e ) { + throw new MappingException( + "could not locate custom database object class [" + + definitionNode.attributeValue( "class" ) + "]" ); } - - Iterator dialectScopings = auxDbObjectNode.elementIterator( "dialect-scope" ); - while ( dialectScopings.hasNext() ) { - Element dialectScoping = ( Element ) dialectScopings.next(); - auxDbObject.addDialectScope( dialectScoping.attributeValue( "name" ) ); + catch( Throwable t ) { + throw new MappingException( + "could not instantiate custom database object class [" + + definitionNode.attributeValue( "class" ) + "]" + ); } + } + else { + auxDbObject = new SimpleAuxiliaryDatabaseObject( + auxDbObjectNode.elementTextTrim( "create" ), + auxDbObjectNode.elementTextTrim( "drop" ) + ); + } - mappings.addAuxiliaryDatabaseObject( auxDbObject ); + Iterator dialectScopings = auxDbObjectNode.elementIterator( "dialect-scope" ); + while ( dialectScopings.hasNext() ) { + Element dialectScoping = ( Element ) dialectScopings.next(); + auxDbObject.addDialectScope( dialectScoping.attributeValue( "name" ) ); } + + mappings.addAuxiliaryDatabaseObject( auxDbObject ); } private static void extractRootAttributes(Element hmNode, Mappings mappings) { |
From: <hib...@li...> - 2006-03-27 23:13:54
|
Author: epbernard Date: 2006-03-27 18:13:39 -0500 (Mon, 27 Mar 2006) New Revision: 9702 Added: tags/entitymanager_v31beta7/HibernateExt/ Log: made a copy Copied: tags/entitymanager_v31beta7/HibernateExt (from rev 9701, trunk/HibernateExt) |
From: <hib...@li...> - 2006-03-27 23:12:57
|
Author: epbernard Date: 2006-03-27 18:12:53 -0500 (Mon, 27 Mar 2006) New Revision: 9701 Added: tags/entitymanager_v31beta7/ Log: |
From: <hib...@li...> - 2006-03-27 23:12:34
|
Author: epbernard Date: 2006-03-27 18:12:30 -0500 (Mon, 27 Mar 2006) New Revision: 9700 Removed: tags/entitymanager_31beta7/ Log: |
From: <hib...@li...> - 2006-03-27 23:10:11
|
Author: epbernard Date: 2006-03-27 18:10:05 -0500 (Mon, 27 Mar 2006) New Revision: 9699 Added: tags/entitymanager_31beta7/ Log: |
From: <hib...@li...> - 2006-03-27 23:07:10
|
Author: epbernard Date: 2006-03-27 18:06:59 -0500 (Mon, 27 Mar 2006) New Revision: 9698 Added: tags/annotations_v31beta9/HibernateExt/ Log: made a copy Copied: tags/annotations_v31beta9/HibernateExt (from rev 9697, trunk/HibernateExt) |
From: <hib...@li...> - 2006-03-27 23:06:16
|
Author: epbernard Date: 2006-03-27 18:06:12 -0500 (Mon, 27 Mar 2006) New Revision: 9697 Added: tags/annotations_v31beta9/ Log: |
From: <hib...@li...> - 2006-03-27 22:58:46
|
Author: epbernard Date: 2006-03-27 17:58:42 -0500 (Mon, 27 Mar 2006) New Revision: 9696 Removed: tags/annotations_v31beta9/ Log: |
From: <hib...@li...> - 2006-03-27 21:48:52
|
Author: epbernard Date: 2006-03-27 16:48:46 -0500 (Mon, 27 Mar 2006) New Revision: 9695 Added: tags/annotations_v31beta9/HibernateExt/ Log: Created folder remotely |
From: <hib...@li...> - 2006-03-27 20:58:08
|
Author: epbernard Date: 2006-03-27 15:58:02 -0500 (Mon, 27 Mar 2006) New Revision: 9694 Added: tags/annotations_v31beta9/ Log: tag for release |
From: <hib...@li...> - 2006-03-27 20:24:36
|
Author: epbernard Date: 2006-03-27 15:24:28 -0500 (Mon, 27 Mar 2006) New Revision: 9693 Modified: trunk/HibernateExt/ejb/changelog.txt trunk/HibernateExt/ejb/doc/reference/en/modules/configuration.xml trunk/HibernateExt/ejb/lib/hibernate-annotations.jar trunk/HibernateExt/ejb/readme.txt trunk/HibernateExt/metadata/changelog.txt trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml trunk/HibernateExt/metadata/readme.txt Log: releases Modified: trunk/HibernateExt/ejb/changelog.txt =================================================================== --- trunk/HibernateExt/ejb/changelog.txt 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/ejb/changelog.txt 2006-03-27 20:24:28 UTC (rev 9693) @@ -1,10 +1,11 @@ Hibernate EntityManager Changelog ================================== -3.1beta7 (17-03-2006) +3.1beta7 (27-03-2006) --------------------- ** Bug + * [EJB-37] - Check all the spec exceptions to be sure we raise the right ones * [EJB-80] - EMF bootstrapping doesn't work as documented * [EJB-96] - Spelling error in 2.4 section of reference doc * [EJB-114] - NPE when Persistence.createEntityManager(String) is used @@ -13,6 +14,7 @@ * [EJB-119] - @EntityResult definition is not correct * [EJB-123] - Exception "EntityManager is closed" throwed when trying to check isOpen() * [EJB-125] - Can't use Hibernate's FlushMode.NEVER with an EntityManager + * [EJB-134] - javax.persistence.OptimisticLockException not thrown * [EJB-139] - em.getTransaction() should raise IllegalStateException if accessed on a JTA EM * [EJB-145] - Support EntityManager.joinTransaction() @@ -25,6 +27,8 @@ ** New Feature * [EJB-90] - Mark transaction for Rollbacked on PersistenceException * [EJB-106] - EntityManager.lock( , LockModeType.WRITE) + * [EJB-117] - extra persist() queue + * [EJB-137] - Implements EntityExistsException * [EJB-138] - Implements EntityTransaction.setRollbackOnly() * [EJB-141] - Update EntityManagerFactory interface by removing PersistenceContextType and adding the overriding map * [EJB-142] - RollbackTransaction on JTA should clear the persistence context Modified: trunk/HibernateExt/ejb/doc/reference/en/modules/configuration.xml =================================================================== --- trunk/HibernateExt/ejb/doc/reference/en/modules/configuration.xml 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/ejb/doc/reference/en/modules/configuration.xml 2006-03-27 20:24:28 UTC (rev 9693) @@ -8,7 +8,7 @@ <para>The EJB3 compatible Hibernate EntityManager is built on top of Hibernate core and Hibernate Annotations. You have to use compatible versions of each module. This version is known to work on Hibernate - 3.2alpha2 and Hibernate Annotations 3.1beta9. The following libraries have + 3.2.0.CR2 and Hibernate Annotations 3.1beta9. The following libraries have to be in your classpath: hibernate3.jar, hibernate-annotations.jar, hibernate-entity-manager.jar and all needed third party libraries for each package.(incl. ejb-persistence.jar).</para> Modified: trunk/HibernateExt/ejb/lib/hibernate-annotations.jar =================================================================== (Binary files differ) Modified: trunk/HibernateExt/ejb/readme.txt =================================================================== --- trunk/HibernateExt/ejb/readme.txt 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/ejb/readme.txt 2006-03-27 20:24:28 UTC (rev 9693) @@ -1,8 +1,8 @@ Hibernate EntityManager ================================================== -Version: 3.1 beta 7, 17.03.2006 +Version: 3.1 beta 7, 27.03.2006 -THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE 3.2alpha2 AND DOES +THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE 3.2.0.CR2 AND DOES NOT WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE. Modified: trunk/HibernateExt/metadata/changelog.txt =================================================================== --- trunk/HibernateExt/metadata/changelog.txt 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/metadata/changelog.txt 2006-03-27 20:24:28 UTC (rev 9693) @@ -1,7 +1,7 @@ Hibernate Annotations Changelog =============================== -3.1beta9 Preview (17-03-2006) +3.1beta9 Preview (27-03-2006) ----------------------------- ** Bug * [ANN-16] - Annotations: composite pk with two manytoone not working @@ -37,6 +37,7 @@ * [ANN-271] - Change @EntityResult(Class entityClass) ( was @EntityResult(String name) ) * [ANN-272] - Remove TYPE @Target on @JoinColumn(s) * [ANN-275] - Default discriminator column is DTYPE rather than TYPE + * [ANN-291] - addUnderscore changed to protected visibility in DefaultComponentSafeNamingStrategy as an extension point ** New Feature * [ANN-15] - Use of @ManyToOne in a @EmbeddedId @@ -51,7 +52,7 @@ * [ANN-228] - Get rid of the compliance and limitation section in the doc. * [ANN-239] - DefaultValidatorMessages_de.properties: translation errors - + 3.1beta8 Preview (20-01-2006) ----------------------------- ** Bug Modified: trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml =================================================================== --- trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/metadata/doc/reference/en/modules/setup.xml 2006-03-27 20:24:28 UTC (rev 9693) @@ -12,13 +12,13 @@ </listitem> <listitem> - <para><emphasis>This preview release requires Hibernate 3.2alpha2 and + <para><emphasis>This preview release requires Hibernate 3.2.0.CR2 and above. Do not use this release of Hibernate Annotations with an older version of Hibernate 3.x!</emphasis></para> </listitem> <listitem> - <para>This release is known to work on Hibernate core 3.2alpha2</para> + <para>This release is known to work on Hibernate core 3.2.0.CR2</para> </listitem> <listitem> Modified: trunk/HibernateExt/metadata/readme.txt =================================================================== --- trunk/HibernateExt/metadata/readme.txt 2006-03-27 17:44:28 UTC (rev 9692) +++ trunk/HibernateExt/metadata/readme.txt 2006-03-27 20:24:28 UTC (rev 9693) @@ -1,8 +1,8 @@ Hibernate Annotations ================================================== -Version: 3.1 beta 9, 17.03.2006 +Version: 3.1 beta 9, 27.03.2006 -THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE 3.2alpha2 AND DOES NOT WORK +THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE 3.2.0.CR2 AND DOES NOT WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE. |
From: <hib...@li...> - 2006-03-27 17:44:31
|
Author: ste...@jb... Date: 2006-03-27 12:44:28 -0500 (Mon, 27 Mar 2006) New Revision: 9692 Added: tags/v32cr1/Hibernate3/ Log: tagged 3.2cr1 Copied: tags/v32cr1/Hibernate3 (from rev 9691, trunk/Hibernate3) |
From: <hib...@li...> - 2006-03-27 17:43:40
|
Author: ste...@jb... Date: 2006-03-27 12:43:35 -0500 (Mon, 27 Mar 2006) New Revision: 9691 Removed: tags/v32cr1/Hibernate3/ Log: wrong tag |
From: <hib...@li...> - 2006-03-27 17:42:13
|
Author: ste...@jb... Date: 2006-03-27 12:41:47 -0500 (Mon, 27 Mar 2006) New Revision: 9690 Added: tags/v32cr1/Hibernate3/ tags/v32cr1/Hibernate3/build.bat tags/v32cr1/Hibernate3/build.sh tags/v32cr1/Hibernate3/build.xml tags/v32cr1/Hibernate3/changelog.txt tags/v32cr1/Hibernate3/checkstyle_checks.xml tags/v32cr1/Hibernate3/doc/ tags/v32cr1/Hibernate3/doc/reference/en/master.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/architecture.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/basic_mapping.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/configuration.xml tags/v32cr1/Hibernate3/eg/ tags/v32cr1/Hibernate3/etc/ tags/v32cr1/Hibernate3/grammar/ tags/v32cr1/Hibernate3/hibernate_logo.gif tags/v32cr1/Hibernate3/indent.py tags/v32cr1/Hibernate3/jdbc/ tags/v32cr1/Hibernate3/lgpl.txt tags/v32cr1/Hibernate3/lib/ tags/v32cr1/Hibernate3/readme.txt tags/v32cr1/Hibernate3/src/ tags/v32cr1/Hibernate3/src/org/hibernate/cfg/Environment.java tags/v32cr1/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java tags/v32cr1/Hibernate3/src/org/hibernate/id/SequenceGenerator.java tags/v32cr1/Hibernate3/src/org/hibernate/id/SequenceIdentityGenerator.java tags/v32cr1/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java tags/v32cr1/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java tags/v32cr1/Hibernate3/src/org/hibernate/jdbc/Batcher.java tags/v32cr1/Hibernate3/src/org/hibernate/util/NamedGeneratedKeysHelper.java tags/v32cr1/Hibernate3/test/ Removed: tags/v32cr1/Hibernate3/build.bat tags/v32cr1/Hibernate3/build.sh tags/v32cr1/Hibernate3/build.xml tags/v32cr1/Hibernate3/changelog.txt tags/v32cr1/Hibernate3/checkstyle_checks.xml tags/v32cr1/Hibernate3/doc/ tags/v32cr1/Hibernate3/doc/reference/en/master.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/architecture.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/basic_mapping.xml tags/v32cr1/Hibernate3/doc/reference/en/modules/configuration.xml tags/v32cr1/Hibernate3/eg/ tags/v32cr1/Hibernate3/etc/ tags/v32cr1/Hibernate3/grammar/ tags/v32cr1/Hibernate3/hibernate_logo.gif tags/v32cr1/Hibernate3/indent.py tags/v32cr1/Hibernate3/jdbc/ tags/v32cr1/Hibernate3/lgpl.txt tags/v32cr1/Hibernate3/lib/ tags/v32cr1/Hibernate3/readme.txt tags/v32cr1/Hibernate3/src/ tags/v32cr1/Hibernate3/src/org/hibernate/cfg/Environment.java tags/v32cr1/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java tags/v32cr1/Hibernate3/src/org/hibernate/id/SequenceGenerator.java tags/v32cr1/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java tags/v32cr1/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java tags/v32cr1/Hibernate3/src/org/hibernate/jdbc/Batcher.java tags/v32cr1/Hibernate3/test/ Log: tagging 3.2 cr1 Copied: tags/v32cr1/Hibernate3 (from rev 9532, trunk/Hibernate3) Deleted: tags/v32cr1/Hibernate3/build.bat =================================================================== --- trunk/Hibernate3/build.bat 2006-03-02 03:28:59 UTC (rev 9532) +++ tags/v32cr1/Hibernate3/build.bat 2006-03-27 17:41:47 UTC (rev 9690) @@ -1 +0,0 @@ -java -cp "lib/ant-launcher-1.6.5.jar" org.apache.tools.ant.launch.Launcher -lib lib %1 %2 %3 %4 %5 Copied: tags/v32cr1/Hibernate3/build.bat (from rev 9531, trunk/Hibernate3/build.bat) Deleted: tags/v32cr1/Hibernate3/build.sh =================================================================== --- trunk/Hibernate3/build.sh 2006-03-02 03:28:59 UTC (rev 9532) +++ tags/v32cr1/Hibernate3/build.sh 2006-03-27 17:41:47 UTC (rev 9690) @@ -1,2 +0,0 @@ -#!/bin/sh -java -cp "lib/ant-launcher-1.6.5.jar" org.apache.tools.ant.launch.Launcher -lib lib "$@" Copied: tags/v32cr1/Hibernate3/build.sh (from rev 9531, trunk/Hibernate3/build.sh) Deleted: tags/v32cr1/Hibernate3/build.xml =================================================================== --- trunk/Hibernate3/build.xml 2006-03-02 03:28:59 UTC (rev 9532) +++ tags/v32cr1/Hibernate3/build.xml 2006-03-27 17:41:47 UTC (rev 9690) @@ -1,788 +0,0 @@ -<!-- - - Hibernate ANT build script. - - (Originally contributed by Fabricio Goncalves) - ---> - -<project name="Hibernate3" default="jar" basedir="."> - - <!-- Give user a chance to override without editing this file or typing -D --> - <property file="build.properties"/> - <property file="${user.home}/.ant.properties"/> - - <!-- Name of project and version, used to create filenames --> - <property name="Name" value="Hibernate"/> - <property name="name" value="hibernate"/> - <property name="name2" value="hibernate3"/> - <property name="version.major" value="3"/> - <property name="version.minor" value="2"/> - <property name="version.micro" value="0"/> - <property name="version.qualifier" value="alpha1"/> - <property name="version.full" value="${version.major}.${version.minor}.${version.micro}.${version.qualifier}"/> - <property name="version.major_minor" value="${version.major}.${version.minor}"/> - <property name="fullname" value="${name}-${version.full}"/> - - <!-- set global properties for this build --> - <property name="src.dir" value="src"/> - <property name="test.dir" value="test"/> - <property name="etc.dir" value="etc"/> - <property name="grammar.dir" value="grammar"/> - <property name="lib.dir" value="lib"/> - <property name="jdbc.dir" value="jdbc"/> - <property name="build.dir" value="build"/> - <property name="classes.dir" value="${build.dir}/classes"/> - <property name="testclasses.dir" value="${build.dir}/testclasses"/> - <property name="generated.src" value="${build.dir}/gensrc"/> - <property name="parser.src" value="${generated.src}/org/hibernate/hql/antlr"/> - <property name="test.out.dir" value="testout"/> - <property name="instrumenttest.out.dir" value="instrumenttestout"/> - <property name="clover.out.dir" value="cloverout"/> - <property name="dist.dir" value="../${name}-${version.major_minor}"/> - <property name="doc.dir" value="doc"/> - <property name="doc.api.dir" value="${doc.dir}/api"/> - <property name="doc.ref.dir" value="${doc.dir}/reference"/> - <property name="egsrc.dir" value="eg"/> - - <property name="dist.doc.dir" value="${dist.dir}/doc"/> - <property name="dist.api.dir" value="${dist.dir}/doc/api"/> - <property name="dist.ref.dir" value="${dist.dir}/doc/reference"/> - - <property name="dist.src.dir" value="${dist.dir}/src"/> - <property name="dist.test.dir" value="${dist.dir}/test"/> - <property name="dist.etc.dir" value="${dist.dir}/etc"/> - <property name="dist.eg.dir" value="${dist.dir}/eg"/> - <property name="dist.lib.dir" value="${dist.dir}/lib"/> - <property name="dist.grammar.dir" value="${dist.dir}/grammar"/> - <property name="jar.name" value="${name2}"/> - <property name="jar.path" value="${dist.dir}/${jar.name}.jar"/> - - <property name="javadoc" value="http://java.sun.com/j2se/1.3/docs/api"/> - <property name="javac.debug" value="on"/> - <property name="javac.optimize" value="off"/> - <property name="javac.target" value="1.4"/> - <property name="javac.source" value="1.4"/> - - <property name="driver.jar" value="${jdbc.dir}/hsqldb.jar"/> - <property name="clover.jar" value="${ant.home}/lib/clover.jar"/> - - <property name="replace.dir" value="${src.dir}"/> - - <path id="lib.class.path"> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${clover.jar}"/> - </path> - - <patternset id="jar.files"> - <include name="**/*.dtd"/> - <include name="**/*.xml"/> - <include name="**/*.xslt"/> - </patternset> - - <patternset id="src.files"> - <!-- include everything we want in the src directory - that we didn't want in the jar itself --> - <include name="**/*.java"/> - </patternset> - - <patternset id="refdoc.files"> - <include name="**/*.css"/> - <include name="**/*.jpg"/> - <include name="**/*.gif"/> - <include name="**/*.png"/> - </patternset> - - <!-- ############################# Tasks ##############################--> - - <taskdef name="antlrtask" - classname="org.apache.tools.ant.taskdefs.optional.ANTLR"> - <classpath> - <!-- Don't include the ANTLR from checkstyle.jar --> - <fileset dir="${lib.dir}"> - <include name="ant-antlr-*.jar"/> - <include name="antlr-*.jar"/> - </fileset> - </classpath> - </taskdef> - - <taskdef name="splash" - classname="org.apache.tools.ant.taskdefs.optional.splash.SplashTask"> - <classpath refid="lib.class.path"/> - </taskdef> - - <taskdef name="junit" - classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"> - <classpath refid="lib.class.path"/> - </taskdef> - - <taskdef name="junitreport" - classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"> - <classpath refid="lib.class.path"/> - </taskdef> - - <taskdef resource="checkstyletask.properties"> - <classpath refid="lib.class.path"/> - </taskdef> - - <taskdef resource="clovertasks"/> - - <!-- ############################ Targets #############################--> - - <target name="clean" depends="cleantestdb" - description="Cleans up build and dist directories"> - <delete dir="${build.dir}"/> - <delete dir="${dist.dir}"/> - <delete dir="${test.out.dir}"/> - <delete dir="${instrumenttest.out.dir}"/> - <delete dir="${clover.out.dir}"/> - </target> - - <target name="cleantestdb" - description="Clean up HSQLDB test database"> - <delete> - <fileset dir="." includes="test.*"/> - </delete> - </target> - - <target name="init" depends="splash" - description="Initialize the build"> - <tstamp> - <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/> - </tstamp> - <echo message="Build ${Name}-${version.full} (${subversion})"/> - - <mkdir dir="${classes.dir}"/> - <copy todir="${classes.dir}"> - <fileset dir="${src.dir}"> - <patternset refid="jar.files"/> - </fileset> - </copy> - <echo message="JDK version: ${ant.java.version}"/> - </target> - - <target name="init.antlr" depends="init" - description="Check ANTLR dependencies."> - <uptodate property="antlr.isUpToDate" - targetfile="${parser.src}/.antlr_run"> - <srcfiles dir="${grammar.dir}" includes="*.g"/> - </uptodate> - </target> - - <target name="antlr" depends="init.antlr" unless="antlr.isUpToDate" - description="Generate ANTLR parsers."> - <mkdir dir="${parser.src}"/> <!-- Create the directory for the generated sources. --> - <!-- The HQL grammar --> - <antlrtask - target="${grammar.dir}/hql.g" - outputdirectory="${parser.src}" - /> - <!-- The HQL-SQL tree transform grammar --> - <antlrtask - target="${grammar.dir}/hql-sql.g" - outputdirectory="${parser.src}" - /> - <!-- The SQL rendering tree traversal --> - <antlrtask - target="${grammar.dir}/sql-gen.g" - outputdirectory="${parser.src}" - /> - <touch file="${parser.src}/.antlr_run"/> - </target> - - <target name="cleanantlr" depends="init" - description="Clean up the generated ANTLR parsers."> - <delete dir="${parser.src}"/> - </target> - - <target name="antlr.regen" depends="init,cleanantlr,antlr" - description="Regenerate all ANTLR generated code."> - </target> - - - <target name="compile" depends="init,antlr" - description="Compile the Java source code"> - <available - classname="org.eclipse.core.launcher.Main" - property="build.compiler" - value="org.eclipse.jdt.core.JDTCompilerAdapter" - classpath="${java.class.path}"/> - <javac - destdir="${classes.dir}" - classpathref="lib.class.path" - debug="${javac.debug}" - optimize="${javac.optimize}" - target="${javac.target}" - source="${javac.source}" - nowarn="on"> - <src path="${src.dir}"/> - <src path="${generated.src}"/> - </javac> - - </target> - - <!-- If versioncheck fails two things can be "out-of-sync": - - '<libraryname> not found in fileset of libraries!' means that version.properties defines a library, but this library is not in the lib directory. - Resolution: add the library to the lib directory or remove the definiton from version.properties - - '<filename> not listed in version.properties' means a file was found in the lib directory, but not in version.properties; - Resolution: add the library to the version.properties or remove the library from the libraries. - --> - <target name="versioncheck" - description="Check version.properties up against lib directory"> - <taskdef classname="versioncheck.VersionCheckTask" - classpath="${lib.dir}/versioncheck.jar" - name="versioncheck"/> - - <mkdir dir="${dist.lib.dir}"/> - <versioncheck versionfile="${lib.dir}/version.properties" output="${dist.lib.dir}/_README.txt"> - <fileset dir="${lib.dir}"> - <include name="**/*.zip"/> - <include name="**/*.jar"/> - </fileset> - </versioncheck> - <copy file="${lib.dir}/version.properties" todir="${dist.lib.dir}"/> - </target> - - <target name="cleanimps" depends="compile" - description="Clean imports"> - <!-- clean the imports (is dependent on hibernate class files thus have to be done after compiling --> - <taskdef classname="com.tombrus.cleanImports.ant.CleanImports" - classpath="${lib.dir}/cleanimports.jar" - name="cleanimps"/> - - <cleanimps srcdir="${generated.src}"> - <classpath> - <path refid="lib.class.path"/> - <path location="${build.dir}/classes"/> - </classpath> - <cleanformat> - <options collapseAbove="99999" blankLines="1" ambiguities="on"/> - <import/> - </cleanformat> - </cleanimps> - - </target> - - <target name="compiletest" depends="compile" - description="Compile the tests"> - <mkdir dir="${testclasses.dir}"/> - <available - classname="org.eclipse.core.launcher.Main" - property="build.compiler" - value="org.eclipse.jdt.core.JDTCompilerAdapter" - classpath="${java.class.path}"/> - <javac - srcdir="${test.dir}" - destdir="${testclasses.dir}" - debug="${javac.debug}" - optimize="${javac.optimize}" - target="${javac.target}" - source="${javac.source}" - nowarn="on"> - <classpath> - <path refid="lib.class.path"/> - <pathelement path="${classes.dir}"/> - </classpath> - </javac> - - <!-- Copy over the mapping files --> - <copy todir="${testclasses.dir}"> - <fileset dir="${test.dir}"> - <patternset refid="jar.files"/> - </fileset> - </copy> - - </target> - - <target name="copysource" description="Copy sources to dist dir"> - <mkdir dir="${dist.src.dir}"/> - <copy todir="${dist.src.dir}"> - <fileset dir="${src.dir}"> - <patternset refid="src.files"/> - </fileset> - <fileset dir="${src.dir}"> - <patternset refid="jar.files"/> - </fileset> - </copy> - - <mkdir dir="${dist.test.dir}"/> - <copy todir="${dist.test.dir}"> - <fileset dir="${test.dir}"/> - </copy> - - <mkdir dir="${dist.grammar.dir}"/> - <copy todir="${dist.grammar.dir}"> - <fileset dir="${grammar.dir}"/> - </copy> - </target> - - <target name="copylib" description="Copy jars to lib dir"> - <mkdir dir="${dist.lib.dir}"/> - <copy todir="${dist.lib.dir}"> - <fileset dir="${lib.dir}"> - <include name="*.jar"/> - <exclude name="checkstyle*.jar"/> - <include name="*.txt"/> - <include name="version.properties"/> - </fileset> - </copy> - </target> - - <target name="jar" depends="compile" - description="Build the distribution .jar file"> - <mkdir dir="${dist.dir}"/> - <jar jarfile="${jar.path}" basedir="${classes.dir}"> - <include name="org/hibernate/**/*.class"/> - <patternset refid="jar.files"/> - <manifest> - <attribute name="Implementation-Title" value="Hibernate3"/> - <attribute name="Implementation-Version" value="${version.full}"/> - <attribute name="Implementation-Vendor" value="hibernate.org"/> - <attribute name="Hibernate-Version" value="${version.full}"/> - </manifest> - </jar> - </target> - - <!-- Documentation --> - - <target name="javadoc" - description="Compile the Javadoc API documentation to dist dir" - depends="splash"> - - <mkdir dir="${dist.api.dir}"/> - <javadoc - classpathref="lib.class.path" - destdir="${dist.api.dir}" - use="true" - protected="true" - version="true" - windowtitle="${Name} API Documentation" - Overview="${doc.api.dir}/package.html" - doctitle="${Name} API Documentation (${version.full})" - stylesheetfile="${doc.api.dir}/jdstyle.css" - link="${javadoc}"> - - <packageset dir="${generated.src}" defaultexcludes="yes"> - <include name="org/hibernate/**"/> - </packageset> - <packageset dir="${src.dir}" defaultexcludes="yes"> - <include name="org/hibernate/**"/> - </packageset> - - <group title="Core API" - packages="org.hibernate:org.hibernate.classic:org.hibernate.criterion:org.hibernate.metadata:org.hibernate.cfg:org.hibernate.usertype"/> - <group title="Extension API" - packages="org.hibernate.id:org.hibernate.connection:org.hibernate.transaction:org.hibernate.type:org.hibernate.dialect*:org.hibernate.cache*:org.hibernate.event*:org.hibernate.action:org.hibernate.property:org.hibernate.loader*:org.hibernate.persister*:org.hibernate.proxy:org.hibernate.tuple:org.hibernate.transform:org.hibernate.collection:org.hibernate.jdbc"/> - <group title="Miscellaneous API" - packages="org.hibernate.stat:org.hibernate.tool.hbm2ddl:org.hibernate.jmx:org.hibernate.mapping:org.hibernate.tool.instrument"/> - <group title="Internal Implementation" - packages="org.hibernate.engine:org.hibernate.impl:org.hibernate.sql:org.hibernate.lob:org.hibernate.util:org.hibernate.exception:org.hibernate.hql:org.hibernate.hql.ast:org.hibernate.hql.antlr:org.hibernate.hql.classic:org.hibernate.intercept:org.hibernate.secure:org.hibernate.pretty"/> - </javadoc> - <copy file="${doc.api.dir}/package.html" todir="${dist.api.dir}"/> - - </target> - - <target name="refdoc" depends="splash" - description="Generate and copy reference documentation"> - - <ant dir="${doc.ref.dir}" inheritall="false" target="all.doc"/> - <copy todir="${dist.ref.dir}"> - <fileset dir="${doc.ref.dir}/build"/> - </copy> - - <!-- Copy tutorial source code --> - <mkdir dir="${dist.ref.dir}/tutorial"/> - <copy todir="${dist.ref.dir}/tutorial"> - <fileset dir="${doc.ref.dir}/tutorial"> - <include name="src/**"/> - <include name="lib/**"/> - <include name="build.xml"/> - <include name="runCleanDatabase.sh"/> - </fileset> - </copy> - - <mkdir dir="${dist.doc.dir}/other"/> - <copy file="${doc.dir}/other/hibernate-quickref.pdf" todir="${dist.doc.dir}/other"/> - </target> - <!-- - <target name="fetchwikidoc" description="Fetch current Wiki snapshot if Internet connection exists"> - <echo message="Fetching Wiki snapshot from hibernate.org"/> - <mkdir dir="${dist.dir}"/> - <get src="http://www.hibernate.org/wiki_snapshot.tar.gz" - ignoreerrors="true" - dest="${dist.dir}/wiki_snapshot.tar.gz" verbose="true" /> - <available file="${dist.dir}/wiki_snapshot.tar.gz" property="wiki-snapshot-exists"/> - </target> - - <target name="wikidoc" - description="Fetch current Wiki snapshot and extract it" - depends="splash,fetchwikidoc" - if="wiki-snapshot-exists"> - - <untar compression="gzip" src="${dist.dir}/wiki_snapshot.tar.gz" dest="${dist.doc.dir}"/> - <delete file="${dist.dir}/wiki_snapshot.tar.gz"/> - - <delete dir="${dist.doc.dir}/wiki/hib_docs"/> - <replace dir="${dist.doc.dir}/wiki" token="hib_docs/" value="../"> - <include name="**/*.html"/> - </replace> - </target> - --> - - <target name="extras" - description="Copy miscellaneous files to root dir"> - <copy todir="${dist.eg.dir}"> - <fileset dir="eg"/> - </copy> - <copy todir="${dist.etc.dir}"> - <fileset dir="etc"/> - </copy> - <copy file="readme.txt" todir="${dist.dir}"/> - <copy file="lgpl.txt" todir="${dist.dir}"/> - <copy file="changelog.txt" todir="${dist.dir}"/> - <copy file="build.xml" todir="${dist.dir}"/> - <copy file="build.bat" todir="${dist.dir}"/> - <copy file="hibernate_logo.gif" todir="${dist.dir}"/> - <!-- we don't want a user build to clobber their install dir --> - <replace file="${dist.dir}/build.xml"> - <replacetoken><![CDATA[../${name}-${version}]]></replacetoken> - <replacevalue><![CDATA[../${name}]]></replacevalue> - </replace> - <replace file="${dist.dir}/build.xml"> - <replacetoken><![CDATA[name="jdbc.dir" value="jdbc"]]></replacetoken> - <replacevalue><![CDATA[name="jdbc.dir" value="lib"]]></replacevalue> - </replace> - </target> - - <target name="splash" unless="nosplash" - description="Display the logo"> - <property name="splash.dir" location="."/> - <splash imageurl="file:${splash.dir}/hibernate_logo.gif" showduration="0"/> - </target> - - <target name="dist" - depends="splash,versioncheck,jar,javadoc,copysource,copylib,extras,antlr.bnf,refdoc" - description="Build everything and package"> - <zip zipfile="${build.dir}/${fullname}.zip"> - <zipfileset prefix="${name}-${version.major_minor}" dir="${dist.dir}"/> - </zip> - <checksum file="${build.dir}/${fullname}.zip" algorithm="MD5" fileext=".md5.txt"/> - <tar tarfile="${build.dir}/${fullname}.tar"> - <tarfileset prefix="${name}-${version.major_minor}" dir="${dist.dir}"/> - </tar> - <gzip src="${build.dir}/${fullname}.tar" zipfile="${build.dir}/${fullname}.tar.gz"/> - <delete file="${build.dir}/${fullname}.tar"/> - <checksum file="${build.dir}/${fullname}.tar.gz" algorithm="MD5" fileext=".md5.txt"/> - </target> - - <target name="info" description="Echo system properties"> - <echoproperties/> - <!-- <echo message="java.vm.info=${java.vm.info}"/> - <echo message="java.vm.name=${java.vm.name}"/> - <echo message="java.vm.vendor=${java.vm.vendor}"/> - <echo message="java.vm.version=${java.vm.version}"/> - <echo message="os.arch=${os.arch}"/> - <echo message="os.name=${os.name}"/> - <echo message="os.version=${os.version}"/> - <echo message="java.home = ${java.home}"/> - <echo message="java.class.path = ${java.class.path}"/> - <echo message="build.compiler = ${build.compiler}"/> - <echo message="file.encoding=${file.encoding}"/> - <echo message="user.home = ${user.home}"/> - <echo message="user.language=${user.language}"/> - <echo message="driver.jar=${driver.jar}"/> --> - </target> - - <target name="junit" depends="cleantestdb,compiletest" - description="Run the test suite (requires driver.jar property)"> - <delete dir="${test.out.dir}"/> - <mkdir dir="${test.out.dir}"/> - - <path id="selector.classpath"> - <!-- - the selector needs all of this because it actually gets the suite - from AllTests and then performs the filtering based on that - --> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${jdbc.dir}"> - <include name="**/*.jar"/> - <include name="**/*.zip"/> - </fileset> - <pathelement path="${classes.dir}"/> - <pathelement path="${testclasses.dir}"/> - <pathelement path="${etc.dir}"/> - </path> - - <!-- - The forkmode="perBatch" setting makes the tests run faster. - <junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${basedir}" maxmemory="256M"> - --> - <junit printsummary="yes" haltonfailure="yes" dir="${basedir}" - maxmemory="256M" fork="yes" forkmode="perBatch"> - <classpath> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${jdbc.dir}"> - <include name="**/*.jar"/> - <include name="**/*.zip"/> - </fileset> - <pathelement path="${classes.dir}"/> - <pathelement path="${etc.dir}"/> - <pathelement path="${testclasses.dir}"/> - <!--pathelement path="${src.dir}"/ --> <!-- pick up properties from here --> - <!--pathelement path="${test.dir}"/ --> <!-- pick up mappings from here --> - <pathelement path="."/> - <pathelement path="${driver.jar}"/> - <pathelement path="${clover.jar}"/> - </classpath> - <formatter type="plain"/> - <formatter type="xml"/> - <batchtest todir="${test.out.dir}" haltonfailure="no"> - <fileset dir="${testclasses.dir}"> - <include name="org/hibernate/test/**/*Test.class"/> - <exclude name="org/hibernate/test/lazyonetoone/**/*Test.class"/> - <exclude name="org/hibernate/test/instrument/**/*Test.class"/> - <!--custom selector to make sure only those tests in the AllTests suite get picked up here --> - <custom classname="org.hibernate.test.TestSelector" classpathref="selector.classpath"/> - </fileset> - </batchtest> - </junit> - </target> - - <target name="junitinstrument" depends="cleantestdb,compiletest,instrument" - description="Run the instrument test suite (requires driver.jar property)"> - <mkdir dir="${instrumenttest.out.dir}"/> - <junit printsummary="yes" haltonfailure="yes" dir="${basedir}" - maxmemory="256M" fork="yes" forkmode="perBatch"> - <classpath> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${jdbc.dir}"> - <include name="**/*.jar"/> - <include name="**/*.zip"/> - </fileset> - <pathelement path="${classes.dir}"/> - <pathelement path="${etc.dir}"/> - <pathelement path="${testclasses.dir}"/> - <pathelement path="."/> - <pathelement path="${driver.jar}"/> - </classpath> - <formatter type="plain"/> - <formatter type="xml"/> - <batchtest todir="${instrumenttest.out.dir}" haltonfailure="no"> - <fileset dir="${testclasses.dir}"> - <include name="org/hibernate/test/**/*Test.class"/> - <exclude name="org/hibernate/test/*PerformanceTest.class"/> - </fileset> - </batchtest> - <!--test name="org.hibernate.test.lazyonetoone.LazyOneToOneTest" - todir="${instrumenttest.out.dir}" haltonfailure="no"/> - <test name="org.hibernate.test.instrument.InstrumentTest" - todir="${instrumenttest.out.dir}" haltonfailure="no"/--> - </junit> - </target> - - <target name="perf" depends="cleantestdb,compiletest" - description="Run the performance tests"> - <mkdir dir="${test.out.dir}"/> - <junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${basedir}"> - <classpath> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <fileset dir="${jdbc.dir}"> - <include name="**/*.jar"/> - <include name="**/*.zip"/> - </fileset> - <pathelement path="${classes.dir}"/> - <pathelement path="${testclasses.dir}"/> - <!--pathelement path="${src.dir}"/ --> <!-- pick up properties from here --> - <!--pathelement path="${test.dir}"/ --> <!-- pick up mappings from here --> - <pathelement path="."/> - <pathelement path="${driver.jar}"/> - <pathelement path="${clover.jar}"/> - </classpath> - <formatter type="plain"/> - <test name="org.hibernate.test.NewPerformanceTest" todir="${test.out.dir}" haltonfailure="no"/> - <test name="org.hibernate.test.NewerPerformanceTest" todir="${test.out.dir}" haltonfailure="no"/> - <test name="org.hibernate.test.PerformanceTest" todir="${test.out.dir}" haltonfailure="no"/> - </junit> - </target> - - <target name="junitreport" depends="splash,junit" - description="Run tests and create JUnit report (requires driver.jar property)"> - <junitreport todir="${test.out.dir}"> - <fileset dir="${test.out.dir}"> - <include name="TEST-*.xml"/> - </fileset> - <report format="frames" todir="${test.out.dir}"/> - </junitreport> - </target> - - <target name="junitinstrumentreport" depends="splash,junitinstrument" - description="Run instrumented tests and create JUnit report (requires driver.jar property)"> - <junitreport todir="${instrumenttest.out.dir}"> - <fileset dir="${instrumenttest.out.dir}"> - <include name="TEST-*.xml"/> - </fileset> - <report format="frames" todir="${instrumenttest.out.dir}"/> - </junitreport> - </target> - - <!-- Run a single unit test. --> - <target name="junitsingle" depends="cleantestdb,compiletest" - description="Run a single test suite (requires testname and jdbc.driver properties)"> - <mkdir dir="${test.out.dir}"/> - <junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${basedir}"> - <classpath> - <pathelement path="${etc.dir}"/> <!-- pick up property resources from the 'etc' directory first --> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - <pathelement path="${classes.dir}"/> - <pathelement path="${testclasses.dir}"/> - <pathelement path="${src.dir}"/> <!-- pick up property resources from here (after classes and etc) --> - <pathelement path="."/> - <pathelement path="${driver.jar}"/> - </classpath> - <formatter type="plain"/> - <formatter type="xml"/> - <test fork="yes" todir="${test.out.dir}" haltonfailure="no" name="${testname}"/> - </junit> - </target> - - <!-- - Makes one patch file containing all local changes. Use this if target if you have - a local copy of sources from CVS and want to contribute any fixes you have made. - - The generated patch.txt file should be attached in a new "Patch" issue in - JIRA at http://opensource.atlassian.com/projects/hibernate/ (where you'll have - to register and log in). - --> - <target name="patch" depends="checkstyle" - description="Create a patch"> - <cvs command="-q diff -u -N" output="patch.txt"/> - </target> - - <target name="checkstyle" description="Check coding style"> - <checkstyle config="checkstyle_checks.xml"> - <fileset dir="${src.dir}"> - <include name="**/*.java"/> - </fileset> - <formatter type="plain"/> - </checkstyle> - </target> - - <target name="eg" - description="Compile and run the simple example"> - <!-- works only in distribution, not in CVS tree --> - <available - classname="org.eclipse.core.launcher.Main" - property="build.compiler" - value="org.eclipse.jdt.core.JDTCompilerAdapter" - classpath="${java.class.path}"/> - <javac - srcdir="${egsrc.dir}" - destdir="${egsrc.dir}" - debug="${javac.debug}" - optimize="${javac.optimize}" - target="${javac.target}" - source="${javac.source}" - nowarn="on"> - <classpath> - <pathelement path="${jar.path}"/> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - </fileset> - </classpath> - </javac> - <echo message="remember to place your JDBC driver in the lib directory"/> - <java - classname="org.hibernate.auction.Main" - fork="true" - failonerror="true"> - <classpath> - <fileset dir="${lib.dir}"> - <include name="**/*.jar"/> - <include name="**/*.zip"/> - </fileset> - <pathelement path="${jar.path}"/> - <pathelement path="${etc.dir}"/> <!-- properties files live here --> - <pathelement path="${egsrc.dir}"/> <!-- compiled into here --> - </classpath> - </java> - <echo message="Please follow the Getting Started road map: http://www.hibernate.org/152.html"/> - </target> - - <target name="replace" - description="do a text search replace"> - <replace dir="${replace.dir}" - token="${replace.token}" - value="${replace.value}"/> - </target> - - <target name="with.clover"> - <clover-setup initString="clover_coverage.db"/> - </target> - - <target name="cloverreport.html" depends="with.clover" - description="Generate a clover report from the current clover database."> - <clover-report> - <current outfile="${clover.out.dir}"> - <format type="html"/> - </current> - </clover-report> - </target> - - <target name="cloverreport" depends="with.clover,junitreport,cloverreport.html" - description="Run the tests and generate a clover report"> - </target> - - <target name="instrument" depends="compiletest" - description="Instrument the persistent classes"> <!-- depends="jar" --> - - <taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask"> - <classpath path="${jar.path}"/> - <classpath path="${classes.dir}"/> - <classpath refid="lib.class.path"/> - </taskdef> - - <instrument verbose="true"> - <fileset dir="${testclasses.dir}/org/hibernate/test"> - <include name="**/*.class"/> - <exclude name="**/*Test$*.class"/> - <exclude name="**/*Test.class"/> - <exclude name="**/*Tests.class"/> - </fileset> - </instrument> - - <jar jarfile="${build.dir}/instrumented-classes.jar"> - <fileset dir="${testclasses.dir}"> - <include name="org/hibernate/test/**/*.class"/> - <exclude name="org/hibernate/test/**/*Test.class"/> - </fileset> - </jar> - - </target> - - <target name="antlr.bnf" depends="init" description="Generate BNF diagram for HQL"> - <mkdir dir="${doc.dir}/other/hql"/> - <property name="bnf.grammar" location="${grammar.dir}/hql.g"/> - - <java dir="${doc.dir}/other/hql" classname="net.mark_malakanov.sdg2.Main" classpathref="lib.class.path" fork="true"> - <jvmarg line="-Xmx512M"/> - <arg line="-blind"/> - <arg line="-savehtml hql-bnf.html"/> - <arg line="-savehtmltitle Hibernate ${version.full} HQL"/> - <arg line="${bnf.grammar}"/> - </java> - </target> -</project> Copied: tags/v32cr1/Hibernate3/build.xml (from rev 9689, trunk/Hibernate3/build.xml) Deleted: tags/v32cr1/Hibernate3/changelog.txt =================================================================== --- trunk/Hibernate3/changelog.txt 2006-03-02 03:28:59 UTC (rev 9532) +++ tags/v32cr1/Hibernate3/changelog.txt 2006-03-27 17:41:47 UTC (rev 9690) @@ -1,2048 +0,0 @@ -Hibernate Changelog -=================== -Note: Newer entries are automatically generated and the description might not -match the actual issue resolution (i.e. a bug might not be a bug). Please -refer to the particular case on JIRA using the issue tracking number to learn -more about each case. - -Chages in version 3.2 alpha1 (2006.02.28) -------------------------------------------- - -** Bug - * [HHH-687] - Exception QuerySyntaxError not really serializable - * [HHH-1236] - Remove static reference to classloader, to avoid memory leak at webapp reload - * [HHH-1287] - Problem with WAS ExtendedJTATransaction not available when using MDB - * [HHH-1419] - Update + Exists doesn't seem to work - * [HHH-1445] - SchemaUpdate closes shared ConnectionProvider - * [HHH-1464] - QueryException from Query.getReturnAliases when query uses "fetch" - * [HHH-1486] - Concurrent access issues with both SoftLimitMRUCache and SimpleMRUCache - * [HHH-1508] - Session.createQuery() should not flush the session - -** Improvement - * [HHH-1411] - Collection fetches and DISTINCT - * [HHH-1412] - Collection fetches and firstResult/maxRows - * [HHH-1416] - LockMode.FORCE to implement EJB3 LockModeType.WRITE - * [HHH-1457] - support new optimisitc locking capabilities of JBossCache - * [HHH-1466] - better handling of Antlr exceptions - * [HHH-1516] - support DataDirect standard jdbc stored procedures - * [HHH-1518] - Guarentee LockMode behaviors - * [HHH-1520] - with clause with implied joins within an explicit join - * [HHH-1526] - Improved DTDEntityResolver - -** New Feature - * [HHH-1251] - Avoid replicating the clearing of TreeCache on SessionFactory..close() - * [HHH-1410] - FlushMode.AUTO -> COMMIT when outside a transaction - * [HHH-1447] - pluggable bytecode libraries - - -Changes in version 3.1.2 (01.27.2006) -------------------------------------------- - -** Bug - * [HHH-73] - Statistics for HQL queries use pre-processed query string - * [HHH-1306] - HQL parsing problem with join fetching of arrays/collections of values - * [HHH-1370] - Warning in hibernate-mapping-3.0.dtd - * [HHH-1371] - MappingException is thrown when the same column is referenced with different case - * [HHH-1386] - Numeric (long) literals not properly handled by HQL parser - * [HHH-1390] - Session.isOpen() throws exeception when the session is closed with ThreadLocalSessionContext - * [HHH-1391] - Invalid parameter index SQLException when using named parameters after positional parameters - * [HHH-1392] - Proxies cannot be serialized after session is closed - * [HHH-1398] - extends and entity-names broken with mapping-level package attribute - * [HHH-1407] - return-join broken for entity collections - -** Improvement - * [HHH-1364] - Defensive check of isClosed when obtaining a connection from ConnectionManager - * [HHH-1367] - warn level log "this operation breaks ==" may be disturbing - -** New Feature - * [HHH-1372] - Support for MySQL5 new varchar length - -** Patch - * [HHH-1005] - Criteria LEFT JOIN capability when adding Order to associations - -** Task - * [HHH-1373] - Document update versioned - - -Changes in version 3.1.1 (01.13.2006) -------------------------------------------- - -** Bug - * [HHH-853] - DML-style HQL queries and associations - * [HHH-1281] - FORWARD_ONLY ScrollableResults#next() throw GenericJDBCException - * [HHH-1286] - Set entity in HQL query without prefix -> incorrect SQL - * [HHH-1308] - Session.createFilter(...).iterate() results in bogus column names for result set extraction - * [HHH-1314] - float/double literals not sent to the database correctly - * [HHH-1316] - SchemaUpdate : java.sql.SQLException: You cannot commit during a managed transaction! - * [HHH-1328] - org.hibernate.util.SimpleMRUCache keeps a soft reference to the cache key, so cached values get collected prematurely - * [HHH-1336] - ForeignGenerator does not handle transient entities with an entity-name properly - * [HHH-1337] - Mapped <component> generated column names incorrect with ImprovedNamingStrategy - * [HHH-1349] - HQL delete statement problem due to oracle lacking table aliases in delete clause - * [HHH-1361] - creating temporary table for bulk delete will commit current transaction in managed environment such as J2EE - -** Improvement - * [HHH-1019] - Native SQL return-property mapping doesn't support dot-syntax in return-property for components - * [HHH-1290] - Defensive checking of session status - * [HHH-1302] - query.getReturnTypes inconsistent - * [HHH-1304] - better handling of borrowed connections in non-ON_CLOSE release semantics - * [HHH-1309] - schemaupdate does not handle TableHiLoGenerator - * [HHH-1339] - empty property name in mapping file gives imcomprehensible error message - * [HHH-1344] - ANSI-SQL trim function for SQLServer - * [HHH-1345] - ANSI-SQL mod function for SQLServer - * [HHH-1346] - ANSI-SQL bit_length function for SQLServer - * [HHH-1351] - <return-scalar name="blah"/> should be possible - * [HHH-1360] - set autodiscovery flag for SQLQueries when resultsetmappings are used - - -Changes in version 3.1 (12.12.2005) -------------------------------------------- - -** Bug - * [HHH-849] - Cartesian product + implicit joins - * [HHH-1065] - user provided connection not usable by default due to agressive release changes - * [HHH-1101] - associations join fetched in HQL without owner being selected - * [HHH-1133] - Comparators, defined for collections in mapping files, are not set - * [HHH-1149] - NPE flushing reattached entity w/ non-mutable natural-id - * [HHH-1170] - HQL 'cast' function doesn't work with MySQL 4 when casting to string - * [HHH-1187] - Cannot delete a object having a delete-orphan collection when user_rollback_id is set - * [HHH-1191] - HQL fails backward compatibility using classic translator - * [HHH-1194] - hql delete statements with joined-subclass hierarchies with a mapped where attribute at the root - * [HHH-1206] - Mappings.TableDescription is not serializable - * [HHH-1212] - mismatch in entity-modes defined in DTD and EntityMode class - * [HHH-1227] - ClassCastException on DOM4J replicate of Calendar property - * [HHH-1239] - BinaryArithmeticOperatorNode.getDataType() does not properly handle date/time arithmetic - * [HHH-1240] - Track connection leakage in JDBCContext.afterTransactionCompletion() - * [HHH-1245] - Calling the Session should register it with the current JTA txn. - * [HHH-1254] - Serialization of Sessions using JDBCTransactions with auto-flush/auto-close - -** New Feature - * [HHH-1222] - Autodiscover scalar types in native-sql - * [HHH-1243] - allow placeholders to system properties in config properties - * [HHH-1244] - Support for MySQL5 stored procedures - * [HHH-1260] - Configuration.mergeProperties() - -** Task - * [HHH-1066] - Upgrade CGLIB to fix proxy memory leak - * [HHH-1242] - upgrade ANTLR to 2.7.6rc1 - -** Improvement - * [HHH-860] - insert ... select ... and version numbers - * [HHH-926] - TypeDef should be global - * [HHH-1138] - No ConstraintName when using PostgreSQL - * [HHH-1144] - Implement naming convention for temporary test failures - * [HHH-1153] - PropertiesHelper fails reading primitive values from hibernate-mapping when doc has whitespace - * [HHH-1182] - Access to filter metadata - * [HHH-1183] - Getting sql "plan" for DML operations - * [HHH-1197] - Support for HQL delete on MaxDB - * [HHH-1198] - post-insert event pass the entity wo the id field filled when the generator is identity - * [HHH-1213] - make JACC event listeners auto configurable (through initialize(Configuration)) - * [HHH-1215] - Added support for LVARCHAR in InformixDialect - * [HHH-1218] - Add concat() function support to SAPDBDialect - * [HHH-1255] - ThreadLocalSessionContext and Session serialization - -** Patch - * [HHH-967] - executeUpdate on StatelessSession - * [HHH-1172] - Missing configuration templates for the new MimerSQLDialect - -** Deprecation - * [HHH-1229] - deprecate ability for entities to not define identifier properties - - -Changes in version 3.1 rc3 (17.11.2005) -------------------------------------------- - -** Bug - * [HHH-755] - Setter / Getter for property gDate are wrong - * [HHH-764] - XML mapping - * [HHH-1034] - The connection is closed *outside* the JTA transaction in TransactionHelper - * [HHH-1062] - java:comp/UserTransaction not correct for JBoss - * [HHH-1064] - Exception using JTATransaction in WebSphere 6 - * [HHH-1069] - Unnecessary commas generated in select with left outer joins - * [HHH-1075] - New parser "not exists" command bug - * [HHH-1077] - Typo in docs: "equiped" - * [HHH-1080] - HQL delete fails on entities with where-fragments using operators other than '=' - * [HHH-1081] - missing parens in example code for Criteria Associations - * [HHH-1084] - incorrect method name "sql" in Restrictions example, should be "sqlRestriction" - * [HHH-1091] - Can't write transparent CurrentSessionContext for BMT - * [HHH-1098] - Patch for build.sh to be able to build latest version on linux - * [HHH-1106] - HQL "not in" generatad wrong SQL - * [HHH-1111] - JDBCTransaction.rollback() results in a call to Interceptor.beforeTransactionCompletion() - * [HHH-1128] - Column alias clashes under certain circumstances - * [HHH-1146] - latest cvs(11/10/05) hibernate3 issue with classic query - * [HHH-1156] - StatefulPersistenceContext not serializable when property-ref is used - * [HHH-1160] - Incorrect use of getGeneratedKey() for Oracle - -** New Feature - * [HHH-449] - korean hibernate reference manual - * [HHH-1129] - use expected-type in 'untyped' Query.setParameter() - -** Improvement - * [HHH-221] - Proxy for one-to-one with property-ref - * [HHH-844] - move parameter "bookkeeping" into QueryTranslator - * [HHH-1051] - "Compiled" native SQL queries are not cached - * [HHH-1061] - import.sql should allow more human readable and usable files - * [HHH-1078] - <dynamic-component> requires type on property - * [HHH-1120] - Make NamingStrategy to work nicely with HA and EJB3 naming strategy - * [HHH-1142] - added getSelectSequenceNextValString() and getCurrentTimestampSelectString() to TimesTenDialect - -** Patch - * [HHH-1063] - support for 'locate' function in SQLServer and Sybase dialects - * [HHH-1090] - Allow subqueries on criteria to obtain non-string results - * [HHH-1095] - Hibernate takes incorrect HasCode when a lot of CompositeKeys and Lazy loading is involved - * [HHH-1103] - finalize method filter for proxies - * [HHH-1136] - more meaningful AssertionFailure message in org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(...) - - -Changes in version 3.1 rc2 (17.10.2005) -------------------------------------------- -** Bug - * [HHH-1045] - Example contains inner classes that aren't serializable - * [HHH-1055] - optimistic-lock is not inherited from class to subclass et.al. - -** Improvement - * [HHH-702] - auto detect aliasing for collection properties (coll.key, coll.id etc.) - * [HHH-1038] - make 'auto' the default for hibernate.connection.release_mode - * [HHH-1042] - determine "expected type" of parameters during HQL parsing - - -Changes in version 3.1 rc1 (07.10.2005) -------------------------------------------- -** Bug - * [HHH-528] - component.manyToOne.id in HQL causes join - * [HHH-871] - Configuration.setListener(String type, Object listener) throws ClassCastException - * [HHH-873] - referencing raw HQL FromElement alias outide the from clause of update and delete statements generates incorrect sql - * [HHH-876] - PreparedStatement being closed before being executed by AbstractBatcher - * [HHH-884] - SchemaExport does not propagate parent indexes to <union-subclass> tables - * [HHH-887] - Aggressive release and Session.connection() - * [HHH-893] - custom tuplizer are not instantiated for components - * [HHH-905] - $PlaceHolder$ remains in generated SQL when filter is enabled - * [HHH-907] - optimistic-lock="false" for timestamped object results in SQLException: Invalid column index - * [HHH-908] - CLONE -NullPointerException when using BigInteger in a query - * [HHH-911] - CGLIBLazyInitializer and Exceptions - * [HHH-913] - NPE in CMTTransaction since javax.transaction.Transaction is never set - * [HHH-918] - impossible to move objects to another session - * [HHH-924] - Useless OracleErrorCodeConverter (and possibly others) - * [HHH-932] - HQL UPDATE and <union-subclass> - * [HHH-946] - QuerySyntaxException might not be serializable - * [HHH-964] - ORA-00936 with joined subclass / Oracle - * [HHH-986] - Need to check Thread.currentThread().getContextClassLoader() in ConfigHelper - * [HHH-991] - Cannot use comparator class - * [HHH-1000] - varchar(xxx char) not supported on Oracle8i - -** New Feature - * [HHH-950] - interface for SessionFactory.getCurrentSession() handling - - -** Improvement - * [HHH-608] - update HSQLDialect for HSQL 1.8 sequence support - * [HHH-889] - Add read-only cache-mode comment in <query and <sql-query - * [HHH-898] - OracleDialect UTF8 varchar2 - * [HHH-909] - Onquoted primary key in IncrementGenerator - * [HHH-988] - generated="never|insert|always" - * [HHH-989] - add discussion of implicit and explcit joins - * [HHH-1011] - Make disconnect/reconnect of a Session implicit - -** Patch - * [HHH-994] - Sybase/SQLServer support for temporary tables - - -Changes in version 3.1 beta 3 (13.09.2005) -------------------------------------------- -** Bug - * [HHH-528] - component.manyToOne.id in HQL causes join - * [HHH-871] - Configuration.setListener(String type, Object listener) throws ClassCastException - * [HHH-873] - referencing raw HQL FromElement alias of update and delete statements - * [HHH-876] - PreparedStatement being closed before being executed by AbstractBatcher - * [HHH-884] - SchemaExport does not propagate parent indexes to <union-subclass> tables - * [HHH-887] - Aggressive release and Session.connection() - * [HHH-893] - custom tuplizer are not instantiated for components - * [HHH-905] - $PlaceHolder$ remains in generated SQL when filter is enabled - * [HHH-907] - optimistic-lock="false" for timestamped object results in SQLException: Invalid column index - * [HHH-908] - NullPointerException when using BigInteger in a query - * [HHH-911] - CGLIBLazyInitializer and Exceptions - * [HHH-913] - NPE in CMTTransaction since javax.transaction.Transaction is never set - * [HHH-918] - impossible to move objects to another session - * [HHH-924] - Removed ErrorCodeConverters - * [HHH-946] - QuerySyntaxException might not be serializable - -** Improvement - * [HHH-898] - OracleDialect UTF8 varchar2 - * [HHH-909] - Unquoted primary key in IncrementGenerator - - -Changes in version 3.1 beta 2 (16.08.2005) -------------------------------------------- -** Bug - * [HHH-477] - Boolean discriminators generate invalid SQL for PostgreSQL dialect - * [HHH-480] - SchemaExportTask ignores some properties not defined in hibernate.properties - * [HHH-615] - SchemaExport outputFile ignores ant's basedir - * [HHH-770] - hql query execution generates invalid SQL - * [HHH-779] - Assertion failure occured with Hibernate 3 saving objects - * [HHH-781] - SimpleExpression ignorecase regression - * [HHH-799] - merge() and embedded composite identifiers - * [HHH-801] - subselect fetch and named parameters - * [HHH-802] - querying "mapped" composite identifiers - * [HHH-803] - no version increment from delayed collection adds - * [HHH-805] - Session.getStatistics().getEntityCount() throws UnsupportedOperationException - * [HHH-819] - Firebird CONCAT SQL function - * [HHH-821] - query by natural-id cache is not update when object is inserted or deleted - * [HHH-822] - <key-property> will actually pick up <type> tags if it were allowed by the DTD - * [HHH-825] - ReadWrite-Cache issues NullPointerException after modification of an array - * [HHH-839] - Session.refresh not working for custom 'Load' SQL - * [HHH-849] - Cartesian product + implicit joins - * [HHH-854] - Class with mapped composite id can't have subclasses - * [HHH-858] - Autocommit status inconsistent in connections created by DriverManagerConnectionProvider - * [HHH-863] - Hibernate generates "notExists" instead of "not exists" - * [HHH-868] - Missing parens after / or - - -** New Feature - * [HHH-35] - add attribute haltonerror to schemaexport Ant task - * [HHH-182] - Mimer SQL Dialect for Hibernate 3 - * [HHH-704] - Statistics for optimistic lock failures - * [HHH-725] - Allow hooks into all executed sql by a session - * [HHH-783] - collection lazy="extra" - * [HHH-818] - Optimisitc locking using database current timestamp - * [HHH-828] - session.getTransaction() - * [HHH-829] - <cache include="all|non-lazy" ... /> - * [HHH-831] - allow database generated property values - * [HHH-832] - allow database generated property values for versioning - * [HHH-838] - Transaction.setTimeout() - * [HHH-840] - allow definition of "auxiliary" database objects in mapping - * [HHH-846] - Add Intializable interface for events - * [HHH-848] - Validate mappings against JDBC metadata - * [HHH-859] - post-commit events - -** Improvement - * [HHH-133] - schemaexport task: provide independent drop/create output - * [HHH-135] - parameterized types can't be used on key-property or ir (possible others) - * [HHH-552] - NoopAccessor for HQL-only properties - * [HHH-680] - Easier support for doing UserCollectionType's - * [HHH-686] - Final classes and classes with private null ctors cause unhelpful NullPointerException - * [HHH-754] - Allow HQL DML for implicit polymorphism - * [HHH-782] - Avoid unnecessary updates when component property is update='false' but modified - * [HHH-786] - Improve lazy options for <one-to-one> - * [HHH-791] - Use cascade styles when fetching entities in refresh() and merge() - * [HHH-815] - Confusing use of the term "dereference" - * [HHH-830] - Improvements to caching lazy properties - -** Patch - * [HHH-378] - Better LockMode.UPGRADE for DB2 UDB v8.2 - * [HHH-430] - Improved SizeExpression with greater, lesser, not equals, etc. capabilities - * [HHH-735] - SchemaUpdate reads table metadata from wrong schema - * [HHH-780] - org.hibernate.proxy.BasicLazyInitializer reflection hotspot - * [HHH-864] - Use QUERY_CACHE for sessions with filters to improve performance - - -Changes in version 3.1 beta 1 (21.07.2005) -------------------------------------------- - -** Bug - * [HHH-145] - union-subclass and oracle 8i - * [HHH-374] - EJB3 example delete query doesn't work in Hibernate. - * [HHH-447] - EHCache integration prevents multiple session factories - * [HHH-488] - JACCListeners are not working at all - * [HHH-564] - missing commas for implicit joins - * [HHH-577] - joins within subqueries on dbs supporting ansi-joins result in extraneous commas - * [HHH-592] - cast() function doesn't know its returned Hibernate type - * [HHH-639] - CGLIB instrumentation of subclasses - * [HHH-658] - Bug in Alias Name Generation - * [HHH-671] - Firebird support of sequences/generators - * [HHH-679] - setLockMode(LockMode.UPGRADE_NOWAIT) does not translate to correct SQL on Oracle - * [HHH-688] - Bad implementation in org.hibernate.type.CustomType.stringToObject - * [HHH-691] - generated column alias is incorrect if there is a prior relationship and the table column names are similar to the table name - * [HHH-694] - NPE when accessing the SLCache stats with TreeCache - * [HHH-698] - Exception on EG , trying to change immutable id (natural-id) - * [HHH-699] - Incorrect Tablename genetaion when using MySQL Dialect and no Schema definition - * [HHH-708] - Restrictions.in could not be used properly on composite-ids - * [HHH-709] - ArrayType.replaceElements fails if original.length != target.length - * [HHH-718] - HQL "fetch all properties" not working for column level lazy props - * [HHH-726] - ConstraintViolationException with primitive collection - * [HHH-727] - java.lang.StackOverflowError when cascade="true" on both sides of bidirectional one-to-one association using FK - * [HHH-734] - HQL incorrectly parses certain query strings - * [HHH-736] - Use of sql functions containing space not supported in filter conditions - * [HHH-738] - formula property with select-before-update - * [HHH-747] - Order.toSQLString generates incorrect statement - * [HHH-748] - component dereferencing in subquery from clauses - * [HHH-752] - Typo in 8.5.3 bidirectional one-to-one jjoin table example - * [HHH-757] - NullPointerException when using BigInteger in a query - -** New Feature - * [HHH-595] - HQL insert select - * [HHH-597] - Named XML resultsetmappings - * [HHH-696] - handle discriminators on HQL insert - * [HHH-697] - allow bumping versions in HQL update - * [HHH-716] - handle version columns in bulk inserts - * [HHH-723] - Need to be able to pass in javax.sql.DataSource in SF creation - * [HHH-739] - Order.ignoreCase() - * [HHH-741] - select clause subselects - * [HHH-742] - Stateless session - * [HHH-744] - collection fetching in scroll() via "break processing" - * [HHH-768] - <many-to-many property-ref=".."/> - -** Improvement - * [HHH-14] - Add Session.delete(String entityName, Object entity) - * [HHH-295] - cleanup and expose the Tuplizers - * [HHH-352] - HQL bulk and cache - * [HHH-689] - exclude parens for components outside where-clause - * [HHH-743] - {coll.key}, {coll.index}, {coll.element}, etc - * [HHH-745] - EJB3 composite PK style - * [HHH-749] - Cascade merge() and unidirectional one-to-many - * [HHH-750] - use attribute name other than 'type' in dynamic-maps - * [HHH-753] - Replace antlr System.exit with QueryException - * [HHH-769] - property-ref="foo.bar" to a component property - * [HHH-772] - null in maps are handled inconsistently - * [TODO-18] - optimistic-lock="all|dirty" with components - - -Changes in version 3.1 alpha 1 (24.06.2005) ------------------------------------- -** Bug - * [HHH-204] - Wrong/uncommon log name in class ...hql ast ErrorCounter - * [HHH-241] - HQL lexer doesn't support unicode quoted strings - * [HHH-354] - property named "full" breaks HQL queries - * [HHH-493] - WARNING: Keyword 'member' is being intepreted as an ident - * [HHH-538] - length() function does not work in SQLServerDialect - * [HHH-539] - ClassCastException on mapping a property with a formula in a set of composite elements - * [HHH-540] - Mapping a one-to-many collection with a non-null foreign key within a component fails on save - * [HHH-547] - Cannot commit using UserCollectionType and debug logging - * [HHH-548] - many-to-many faulty delete optimization when filter in use - * [HHH-554] - Hibernate 3 HQL to SQL FROM Clause Comma Generation Problem - * [HHH-558] - HQL doesn't support multi-byte character in class name and property names - * [HHH-559] - quoted multi-byte character in HQL is translated into weird character in SQL. - * [HHH-565] - delete-orphan generating AssertionFailure - * [HHH-566] - The result is not correct in 'createQuery("select new Foor(x,x) from Foo").scroll()' - * [HHH-570] - size operator fails on a many to many in HQL - * [HHH-571] - JDK 1.3 Compatibility Issue - * [HHH-573] - error when merging entity graph has cascade level>2 - * [HHH-575] - org.hibernate.cache.FilterKey is not Serializable - * [HHH-589] - parameterized expression inside function - * [HHH-594] - order-by mapping for collections overrides order by in HQL - * [HHH-601] - New temporary table feature assumes all persisters are ready - * [HHH-614] - SchemaUpdate broken in DB2/400 - * [HHH-622] - Spelling mistake 'intepreted' in org.hibernate.hql.PARSER warning - * [HHH-642] - criterias with projection - * [HHH-650] - FilterImpl is Serializable yet FilterDefinition is not - * [HHH-657] - Date parse exception using EntityMode.DOM4J - * [HHH-666] - JTAHelper.isInProgress( txn.getStatus()) throws NPE when txn null - -** New Feature - * [HHH-620] - Extra join conditions in HQL - * [HHH-640] - short-circuit dirty checking for instrumented classes - * [HHH-643] - support mutable="false" for collections - * [HHH-645] - Session.setReadOnly() - * [HHH-549] - portable to_char() function - * [HHH-576] - Hook to pre-process generated select strings in the Dialect - * [HHH-662] - Add support for definition of functional composite key ("properties") in joined subclass - -** Improvement - * [HHH-46] - Allow access to properties that are not joined - * [HHH-261] - Stored procedure support for SQLServer dialects - * [HHH-351] - multi-table bulk operations - * [HHH-574] - improve in naming named-query - * [HHH-596] - Auto-detect {..} in native SQL queries - * [HHH-641] - create constraints for many-to-one property-ref - * [HHH-501] - warn when a final method is tried to be proxied - * [HHH-525] - cglib related startup performance - * [HHH-557] - Helpful error message for non Serializable classes with a composite-id - * [HHH-586] - check immutable natural-ids - * [HHH-609] - Adds substr to PostgreSQL dialect - * [HHH-618] - documentation bugs - -** Patch - * [HHH-224] - JDataStore Dialect and updated Testfiles - * [HHH-366] - InformixDialect SQLExceptionConverter - * [HHH-536] - ImprovedNamingStrategy modifies capitalized column names inappropriately - * [HHH-632] - Informix Dialect missing from automatic dialect discovery - * [HHH-4] - CachedFile bugfix + configuration + autodetect resource as file - - -Changes in version 3.0.5 (25.5.2005) ------------------------------------- - -** Bug - * [HHH-516] - Interceptor.onFlushDirty() sometimes not called - * [HHH-517] - getDatabaseMajorVersion() not available in JDK 1.3 - * [HHH-518] - SQL parser does not recognize all whitespace - * [HHH-519] - broken SQL when traversing many-to-many to joined <subselect> - * [HHH-529] - Bug in merge() - -** New Feature - * added <natural-id> mapping - * [HHH-533] - allow unique-key on <property> and <many-to-one> - * [HHH-534] - efficient cache by natural key - * support for <comment> on MySQL - -** Improvement - * [HHH-526] - log "Aggressively releasing JDBC Connection" as DEBUG instead of INFO - * various logging improvements - - -Changes in version 3.0.4 (23... [truncated message content] |
From: <hib...@li...> - 2006-03-27 17:39:44
|
Author: ste...@jb... Date: 2006-03-27 12:39:13 -0500 (Mon, 27 Mar 2006) New Revision: 9689 Modified: trunk/Hibernate3/build.xml trunk/Hibernate3/changelog.txt trunk/Hibernate3/doc/reference/en/master.xml trunk/Hibernate3/readme.txt trunk/Hibernate3/src/org/hibernate/cfg/Environment.java Log: prep 3.2 cr1 Modified: trunk/Hibernate3/build.xml =================================================================== --- trunk/Hibernate3/build.xml 2006-03-27 17:30:09 UTC (rev 9688) +++ trunk/Hibernate3/build.xml 2006-03-27 17:39:13 UTC (rev 9689) @@ -19,7 +19,7 @@ <property name="version.major" value="3"/> <property name="version.minor" value="2"/> <property name="version.micro" value="0"/> - <property name="version.qualifier" value="alpha2"/> + <property name="version.qualifier" value="cr1"/> <property name="version.full" value="${version.major}.${version.minor}.${version.micro}.${version.qualifier}"/> <property name="version.major_minor" value="${version.major}.${version.minor}"/> <property name="fullname" value="${name}-${version.full}"/> Modified: trunk/Hibernate3/changelog.txt =================================================================== --- trunk/Hibernate3/changelog.txt 2006-03-27 17:30:09 UTC (rev 9688) +++ trunk/Hibernate3/changelog.txt 2006-03-27 17:39:13 UTC (rev 9689) @@ -5,7 +5,24 @@ refer to the particular case on JIRA using the issue tracking number to learn more about each case. +Chages in version 3.2 cr1 (2006.03.27) +------------------------------------------- +** Bug + * [HHH-1453] - Broken exception handling in NullableType + +** Improvement + * [HHH-227] - remove reflection optimizer + * [HHH-587] - Make ResultTransformer available for all query methods + * [HHH-1588] - delay inserts for insert-generated-identifiers outside transaction + * [HHH-1590] - redesign how PostInsertIdentifierGenerators are handled at insertion + * [HHH-1592] - allow SelectGenerator to use a defined natural-id (if one) + +** New Feature + * [HHH-332] - create ability to add resulttransformer to HQL query + * [HHH-1179] - support inline sequence id generation on Oracle using RETURNING clause + + Chages in version 3.2 alpha2 (2006.03.15) ------------------------------------------- Modified: trunk/Hibernate3/doc/reference/en/master.xml =================================================================== --- trunk/Hibernate3/doc/reference/en/master.xml 2006-03-27 17:30:09 UTC (rev 9688) +++ trunk/Hibernate3/doc/reference/en/master.xml 2006-03-27 17:39:13 UTC (rev 9689) @@ -33,7 +33,7 @@ <bookinfo> <title>HIBERNATE - Relational Persistence for Idiomatic Java</title> <subtitle>Hibernate Reference Documentation</subtitle> - <releaseinfo>3.2 alpha2</releaseinfo> + <releaseinfo>3.2 cr1</releaseinfo> </bookinfo> <toc/> Modified: trunk/Hibernate3/readme.txt =================================================================== --- trunk/Hibernate3/readme.txt 2006-03-27 17:30:09 UTC (rev 9688) +++ trunk/Hibernate3/readme.txt 2006-03-27 17:39:13 UTC (rev 9689) @@ -1,6 +1,6 @@ Hibernate - Relational Persistence for Idiomatic Java ===================================================== -version 3.2 alpha2, Mar 15, 2006 +version 3.2 cr1, Mar 27, 2006 Instructions ------------ Modified: trunk/Hibernate3/src/org/hibernate/cfg/Environment.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/cfg/Environment.java 2006-03-27 17:30:09 UTC (rev 9688) +++ trunk/Hibernate3/src/org/hibernate/cfg/Environment.java 2006-03-27 17:39:13 UTC (rev 9689) @@ -153,7 +153,7 @@ */ public final class Environment { - public static final String VERSION = "3.2 alpha2"; + public static final String VERSION = "3.2 cr1"; /** * <tt>ConnectionProvider</tt> implementor to use when obtaining connections |
From: <hib...@li...> - 2006-03-27 17:30:20
|
Author: ste...@jb... Date: 2006-03-27 12:30:09 -0500 (Mon, 27 Mar 2006) New Revision: 9688 Added: tags/v32cr1/ Log: created release tag folder for 3.2cr1 |
From: <hib...@li...> - 2006-03-27 16:48:42
|
Author: ste...@jb... Date: 2006-03-27 11:48:39 -0500 (Mon, 27 Mar 2006) New Revision: 9687 Modified: trunk/Hibernate3/doc/reference/en/modules/architecture.xml trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml trunk/Hibernate3/doc/reference/en/modules/configuration.xml Log: various doc updates Modified: trunk/Hibernate3/doc/reference/en/modules/architecture.xml =================================================================== --- trunk/Hibernate3/doc/reference/en/modules/architecture.xml 2006-03-27 16:47:06 UTC (rev 9686) +++ trunk/Hibernate3/doc/reference/en/modules/architecture.xml 2006-03-27 16:48:39 UTC (rev 9687) @@ -297,7 +297,7 @@ See the Javadocs for the <literal>org.hibernate.context.CurrentSessionContext</literal> interface for a detailed discussion of its contract. It defines a single method, <literal>currentSession()</literal>, by which the implementation is responsible for - tracking the current contextual session. Out-of-the-box, Hibernate comes with two + tracking the current contextual session. Out-of-the-box, Hibernate comes with three implementations of this interface. </para> Modified: trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml =================================================================== --- trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml 2006-03-27 16:47:06 UTC (rev 9686) +++ trunk/Hibernate3/doc/reference/en/modules/basic_mapping.xml 2006-03-27 16:48:39 UTC (rev 9687) @@ -734,6 +734,20 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term><literal>sequence-identity</literal></term> + <listitem> + <para> + a specialized sequence generation strategy which utilizes a + database sequence for the actual value generation, but combines + this with JDBC3 getGeneratedKeys to actually return the generated + identifier value as part of the insert statement execution. This + strategy is only known to be supported on Oracle 10g drivers + targetted for JDK 1.4. Note comments on these insert statements + are disabled due to a bug in the Oracle drivers. + </para> + </listitem> + </varlistentry> </variablelist> </para> Modified: trunk/Hibernate3/doc/reference/en/modules/configuration.xml =================================================================== --- trunk/Hibernate3/doc/reference/en/modules/configuration.xml 2006-03-27 16:47:06 UTC (rev 9686) +++ trunk/Hibernate3/doc/reference/en/modules/configuration.xml 2006-03-27 16:48:39 UTC (rev 9687) @@ -698,9 +698,17 @@ transaction strategy. <para> <emphasis role="strong">eg.</emphasis> - <literal>on_close</literal> (default) | <literal>after_transaction</literal> | - <literal>after_statement</literal> | <literal>auto</literal> + <literal>auto</literal> (default) | <literal>on_close</literal> | + <literal>after_transaction</literal> | <literal>after_statement</literal> </para> + <para> + Note that this setting only affects <literal>Session</literal>s returned from + <literal>SessionFactory.openSession</literal>. For <literal>Session</literal>s + obtained through <literal>SessionFactory.getCurrentSession</literal>, the + <literal>CurrentSessionContext</literal> implementation configured for use + controls the connection release mode for those <literal>Session</literal>s. + See <xref linkend="architecture-current-session"/> + </para> </entry> </row> <row> |
From: <hib...@li...> - 2006-03-27 16:47:18
|
Author: ste...@jb... Date: 2006-03-27 11:47:06 -0500 (Mon, 27 Mar 2006) New Revision: 9686 Added: trunk/Hibernate3/src/org/hibernate/id/SequenceIdentityGenerator.java trunk/Hibernate3/src/org/hibernate/util/NamedGeneratedKeysHelper.java trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/SelectGeneratorTest.java trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.hbm.xml trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.java trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/SequenceIdentityTest.java Removed: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/OracleGeneratedKeysTest.java Modified: trunk/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java trunk/Hibernate3/src/org/hibernate/id/SequenceGenerator.java trunk/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java trunk/Hibernate3/src/org/hibernate/jdbc/Batcher.java trunk/Hibernate3/test/org/hibernate/test/AllTests.java trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.java Log: HHH-1179 : sequence-identity (for Oracle) Modified: trunk/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/id/IdentifierGeneratorFactory.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -83,6 +83,7 @@ GENERATORS.put("foreign", ForeignGenerator.class); GENERATORS.put("guid", GUIDGenerator.class); GENERATORS.put("uuid.hex", UUIDHexGenerator.class); //uuid.hex is deprecated + GENERATORS.put("sequence-identity", SequenceIdentityGenerator.class); } public static IdentifierGenerator create(String strategy, Type type, Properties params, Dialect dialect) Modified: trunk/Hibernate3/src/org/hibernate/id/SequenceGenerator.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/id/SequenceGenerator.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/id/SequenceGenerator.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -105,7 +105,9 @@ public String[] sqlCreateStrings(Dialect dialect) throws HibernateException { String[] ddl = dialect.getCreateSequenceStrings(sequenceName); - if ( parameters!=null ) ddl[ddl.length-1] += ' ' + parameters; + if ( parameters != null ) { + ddl[ddl.length - 1] += ' ' + parameters; + } return ddl; } @@ -117,4 +119,8 @@ return sequenceName; } + public String getSequenceName() { + return sequenceName; + } + } Added: trunk/Hibernate3/src/org/hibernate/id/SequenceIdentityGenerator.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/id/SequenceIdentityGenerator.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/id/SequenceIdentityGenerator.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,100 @@ +package org.hibernate.id; + +import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; +import org.hibernate.id.insert.AbstractReturningDelegate; +import org.hibernate.id.insert.IdentifierGeneratingInsert; +import org.hibernate.dialect.Dialect; +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.sql.Insert; +import org.hibernate.util.NamedGeneratedKeysHelper; +import org.hibernate.type.Type; +import org.hibernate.engine.SessionImplementor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Properties; + +/** + * A generator which combines sequence generation with immediate retrieval + * through JDBC3 {@link java.sql.Connection#prepareStatement(String, String[]) getGeneratedKeys}. + * In this respect it works much like ANSI-SQL IDENTITY generation. + * <p/> + * This generator only known to work with newer Oracle drivers compiled for + * JDK 1.4 (JDBC3). + * <p/> + * Note: Due to a bug in Oracle drivers, sql comments on these insert statements + * are completely disabled. + * + * @author Steve Ebersole + */ +public class SequenceIdentityGenerator extends SequenceGenerator + implements PostInsertIdentifierGenerator { + + private static final Log log = LogFactory.getLog( SequenceIdentityGenerator.class ); + + public Serializable generate(SessionImplementor s, Object obj) { + return IdentifierGeneratorFactory.POST_INSERT_INDICATOR; + } + + public InsertGeneratedIdentifierDelegate getInsertGeneratedIdentifierDelegate( + PostInsertIdentityPersister persister, + Dialect dialect, + boolean isGetGeneratedKeysEnabled) throws HibernateException { + return new Delegate( persister, dialect, getSequenceName() ); + } + + public void configure(Type type, Properties params, Dialect dialect) throws MappingException { + super.configure( type, params, dialect ); + } + + public static class Delegate extends AbstractReturningDelegate { + private final Dialect dialect; + private final String sequenceNextValFragment; + private final String[] keyColumns; + + public Delegate(PostInsertIdentityPersister persister, Dialect dialect, String sequenceName) { + super( persister ); + this.dialect = dialect; + this.sequenceNextValFragment = dialect.getSelectSequenceNextValString( sequenceName ); + this.keyColumns = getPersister().getRootTableKeyColumnNames(); + if ( keyColumns.length > 1 ) { + throw new HibernateException( "sequence-identity generator cannot be used with with multi-column keys" ); + } + } + + public IdentifierGeneratingInsert prepareIdentifierGeneratingInsert() { + NoCommentsInsert insert = new NoCommentsInsert( dialect ); + insert.addColumn( getPersister().getRootTableKeyColumnNames()[0], sequenceNextValFragment ); + return insert; + } + + protected PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException { + return session.getBatcher().prepareStatement( insertSQL, keyColumns ); + } + + protected Serializable executeAndExtract(PreparedStatement insert) throws SQLException { + insert.executeUpdate(); + return IdentifierGeneratorFactory.getGeneratedIdentity( + NamedGeneratedKeysHelper.getGeneratedKey( insert ), + getPersister().getIdentifierType() + ); + } + } + + public static class NoCommentsInsert extends IdentifierGeneratingInsert { + public NoCommentsInsert(Dialect dialect) { + super( dialect ); + } + + public Insert setComment(String comment) { + // don't allow comments on these insert statements as comments totally + // blow up the Oracle getGeneratedKeys "support" :( + log.info( "disallowing insert statement comment for select-identity due to Oracle driver bug" ); + return this; + } + } +} Modified: trunk/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/id/insert/AbstractReturningDelegate.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -33,7 +33,7 @@ return executeAndExtract( insert ); } finally { - session.getBatcher().closeStatement( insert ); + releaseStatement( insert, session ); } } catch ( SQLException sqle ) { @@ -46,7 +46,15 @@ } } + protected PostInsertIdentityPersister getPersister() { + return persister; + } + protected abstract PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException; protected abstract Serializable executeAndExtract(PreparedStatement insert) throws SQLException; + + protected void releaseStatement(PreparedStatement insert, SessionImplementor session) throws SQLException { + session.getBatcher().closeStatement( insert ); + } } Modified: trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/jdbc/AbstractBatcher.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -22,6 +22,7 @@ import org.hibernate.pretty.Formatter; import org.hibernate.util.GetGeneratedKeysHelper; import org.hibernate.util.JDBCExceptionReporter; +import org.hibernate.util.NamedGeneratedKeysHelper; /** * Manages prepared statements and batching. @@ -51,7 +52,7 @@ private boolean releasing = false; private final Interceptor interceptor; - + private long transactionTimeout = -1; boolean isTransactionTimeoutSet; @@ -65,23 +66,23 @@ isTransactionTimeoutSet = true; transactionTimeout = System.currentTimeMillis() / 1000 + seconds; } - + public void unsetTransactionTimeout() { isTransactionTimeoutSet = false; } - + protected PreparedStatement getStatement() { return batchUpdate; } - public CallableStatement prepareCallableStatement(String sql) + public CallableStatement prepareCallableStatement(String sql) throws SQLException, HibernateException { executeBatch(); logOpenPreparedStatement(); return getCallableStatement( connectionManager.getConnection(), sql, false); } - public PreparedStatement prepareStatement(String sql) + public PreparedStatement prepareStatement(String sql) throws SQLException, HibernateException { return prepareStatement( sql, false ); } @@ -96,10 +97,26 @@ false, getGeneratedKeys, null, + null, false ); } + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException, HibernateException { + executeBatch(); + logOpenPreparedStatement(); + return getPreparedStatement( + connectionManager.getConnection(), + sql, + false, + false, + columnNames, + null, + false + ); + } + public PreparedStatement prepareSelectStatement(String sql) throws SQLException, HibernateException { logOpenPreparedStatement(); @@ -109,6 +126,7 @@ false, false, null, + null, false ); } @@ -140,6 +158,7 @@ sql, scrollable, false, + null, scrollMode, true ); @@ -175,7 +194,7 @@ resultSetsToClose.add(rs); logOpenResults(); return rs; - + } public void closeQueryStatement(PreparedStatement ps, ResultSet rs) throws SQLException { statementsToClose.remove(ps); @@ -194,7 +213,7 @@ public PreparedStatement prepareBatchStatement(String sql) throws SQLException, HibernateException { sql = getSQL( sql ); - + if ( !sql.equals(batchUpdateSQL) ) { batchUpdate=prepareStatement(sql); // calls executeBatch() batchUpdateSQL=sql; @@ -263,7 +282,7 @@ } if ( lastQuery==ps ) lastQuery = null; - + } /** @@ -315,11 +334,11 @@ } protected abstract void doExecuteBatch(PreparedStatement ps) throws SQLException, HibernateException; - + private String preparedStatementCountsToString() { return - " (open PreparedStatements: " + - openPreparedStatementCount + + " (open PreparedStatements: " + + openPreparedStatementCount + ", globally: " + globalOpenPreparedStatementCount + ")"; @@ -327,8 +346,8 @@ private String resultSetCountsToString() { return - " (open ResultSets: " + - openResultSetCount + + " (open ResultSets: " + + openResultSetCount + ", globally: " + globalOpenResultSetCount + ")"; @@ -368,7 +387,7 @@ protected SessionFactoryImplementor getFactory() { return factory; } - + private void log(String sql) { if ( SQL_LOG.isDebugEnabled() ) { SQL_LOG.debug( format(sql) ); @@ -377,7 +396,7 @@ System.out.println( "Hibernate: " + format(sql) ); } } - + private String format(String sql) { if ( factory.getSettings().isFormatSqlEnabled() ) { return new Formatter(sql).format(); @@ -388,16 +407,17 @@ } private PreparedStatement getPreparedStatement( - final Connection conn, - final String sql, - final boolean scrollable, - final ScrollMode scrollMode) + final Connection conn, + final String sql, + final boolean scrollable, + final ScrollMode scrollMode) throws SQLException { return getPreparedStatement( conn, sql, scrollable, false, + null, scrollMode, false ); @@ -405,15 +425,15 @@ private CallableStatement getCallableStatement( final Connection conn, - String sql, - boolean scrollable) throws SQLException { + String sql, + boolean scrollable) throws SQLException { if ( scrollable && !factory.getSettings().isScrollableResultSetsEnabled() ) { throw new AssertionFailure("scrollable result sets are not enabled"); } sql = getSQL( sql ); log( sql ); - + log.trace("preparing callable statement"); if ( scrollable ) { return conn.prepareCall( @@ -436,12 +456,13 @@ } private PreparedStatement getPreparedStatement( - final Connection conn, - String sql, - boolean scrollable, - final boolean useGetGeneratedKeys, - final ScrollMode scrollMode, - final boolean callable) throws SQLException { + final Connection conn, + String sql, + boolean scrollable, + final boolean useGetGeneratedKeys, + final String[] namedGeneratedKeys, + final ScrollMode scrollMode, + final boolean callable) throws SQLException { if ( scrollable && !factory.getSettings().isScrollableResultSetsEnabled() ) { throw new AssertionFailure("scrollable result sets are not enabled"); } @@ -457,7 +478,7 @@ if ( scrollable ) { if ( callable ) { result = conn.prepareCall( sql, scrollMode.toResultSetType(), ResultSet.CONCUR_READ_ONLY ); - } + } else { result = conn.prepareStatement( sql, scrollMode.toResultSetType(), ResultSet.CONCUR_READ_ONLY ); } @@ -465,21 +486,24 @@ else if ( useGetGeneratedKeys ) { result = GetGeneratedKeysHelper.prepareStatement( conn, sql ); } + else if ( namedGeneratedKeys != null ) { + result = NamedGeneratedKeysHelper.prepareStatement( conn, sql, namedGeneratedKeys ); + } else { if ( callable ) { result = conn.prepareCall( sql ); - } + } else { result = conn.prepareStatement( sql ); } } - + setTimeout( result ); - + if ( factory.getStatistics().isStatisticsEnabled() ) { factory.getStatisticsImplementor().prepareStatement(); } - + return result; } @@ -528,18 +552,18 @@ catch (SQLException sqle) { throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), - sqle, - "Cannot open connection" + sqle, + "Cannot open connection" ); } } public void closeConnection(Connection conn) throws HibernateException { if ( log.isDebugEnabled() ) { - log.debug( - "closing JDBC connection" + - preparedStatementCountsToString() + - resultSetCountsToString() + log.debug( + "closing JDBC connection" + + preparedStatementCountsToString() + + resultSetCountsToString() ); } @@ -552,8 +576,8 @@ catch (SQLException sqle) { throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), - sqle, - "Cannot close connection" + sqle, + "Cannot close connection" ); } } @@ -565,8 +589,8 @@ catch (SQLException sqle) { throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), - sqle, - "Cannot cancel query" + sqle, + "Cannot cancel query" ); } } Modified: trunk/Hibernate3/src/org/hibernate/jdbc/Batcher.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/jdbc/Batcher.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/jdbc/Batcher.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -47,19 +47,32 @@ public PreparedStatement prepareSelectStatement(String sql) throws SQLException, HibernateException; /** - * Get a non-batchable prepared statement to use for inserting / deleting / updating. - * Must be explicitly released by <tt>closeStatement()</tt> + * Get a non-batchable prepared statement to use for inserting / deleting / updating, + * using JDBC3 getGeneratedKeys ({@link Connection#prepareStatement(String, int)}). + * <p/> + * Must be explicitly released by {@link #closeStatement} after use. */ public PreparedStatement prepareStatement(String sql, boolean useGetGeneratedKeys) throws SQLException, HibernateException; + /** * Get a non-batchable prepared statement to use for inserting / deleting / updating. - * Must be explicitly released by <tt>closeStatement()</tt> + * using JDBC3 getGeneratedKeys ({@link Connection#prepareStatement(String, String[])}). + * <p/> + * Must be explicitly released by {@link #closeStatement} after use. */ + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException, HibernateException; + + /** + * Get a non-batchable prepared statement to use for inserting / deleting / updating. + * <p/> + * Must be explicitly released by {@link #closeStatement} after use. + */ public PreparedStatement prepareStatement(String sql) throws SQLException, HibernateException; /** * Get a non-batchable callable statement to use for inserting / deleting / updating. - * Must be explicitly released by <tt>closeStatement()</tt> + * <p/> + * Must be explicitly released by {@link #closeStatement} after use. */ public CallableStatement prepareCallableStatement(String sql) throws SQLException, HibernateException; @@ -67,6 +80,7 @@ * Close a prepared or callable statement opened using <tt>prepareStatement()</tt> or <tt>prepareCallableStatement()</tt> */ public void closeStatement(PreparedStatement ps) throws SQLException; + /** * Get a batchable prepared statement to use for inserting / deleting / updating * (might be called many times before a single call to <tt>executeBatch()</tt>). @@ -147,8 +161,3 @@ public void unsetTransactionTimeout(); } - - - - - Added: trunk/Hibernate3/src/org/hibernate/util/NamedGeneratedKeysHelper.java =================================================================== --- trunk/Hibernate3/src/org/hibernate/util/NamedGeneratedKeysHelper.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/src/org/hibernate/util/NamedGeneratedKeysHelper.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,79 @@ +package org.hibernate.util; + +import org.hibernate.AssertionFailure; + +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; +import java.sql.Connection; +import java.sql.Statement; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.ResultSet; + +/** + * @author Steve Ebersole + */ +public class NamedGeneratedKeysHelper { + private NamedGeneratedKeysHelper() { + } + + private static final Method PREPARE_STATEMENT_METHOD; + private static final Method GET_GENERATED_KEYS_METHOD; + + static { + try { + PREPARE_STATEMENT_METHOD = Connection.class.getMethod( + "prepareStatement", + new Class[] { String.class, String[].class } + ); + GET_GENERATED_KEYS_METHOD = Statement.class.getDeclaredMethod( + "getGeneratedKeys", + null + ); + } + catch ( Exception e ) { + throw new AssertionFailure( "could not initialize getGeneratedKeys() support", e ); + } + } + + public static PreparedStatement prepareStatement(Connection conn, String sql, String[] columnNames) throws SQLException { + Object[] args = new Object[] { sql, columnNames } ; + try { + return ( PreparedStatement ) PREPARE_STATEMENT_METHOD.invoke( conn, args ); + } + catch ( InvocationTargetException ite ) { + if ( ite.getTargetException() instanceof SQLException ) { + throw ( SQLException ) ite.getTargetException(); + } + else if ( ite.getTargetException() instanceof RuntimeException ) { + throw ( RuntimeException ) ite.getTargetException(); + } + else { + throw new AssertionFailure( "InvocationTargetException preparing statement capable of returning generated keys (JDBC3)", ite ); + } + } + catch ( IllegalAccessException iae ) { + throw new AssertionFailure( "IllegalAccessException preparing statement capable of returning generated keys (JDBC3)", iae ); + } + } + + public static ResultSet getGeneratedKey(PreparedStatement ps) throws SQLException { + try { + return ( ResultSet ) GET_GENERATED_KEYS_METHOD.invoke( ps, null ); + } + catch ( InvocationTargetException ite ) { + if ( ite.getTargetException() instanceof SQLException ) { + throw ( SQLException ) ite.getTargetException(); + } + else if ( ite.getTargetException() instanceof RuntimeException ) { + throw ( RuntimeException ) ite.getTargetException(); + } + else { + throw new AssertionFailure( "InvocationTargetException extracting generated keys (JDBC3)", ite ); + } + } + catch ( IllegalAccessException iae ) { + throw new AssertionFailure( "IllegalAccessException extracting generated keys (JDBC3)", iae ); + } + } +} Modified: trunk/Hibernate3/test/org/hibernate/test/AllTests.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/AllTests.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/test/org/hibernate/test/AllTests.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -38,7 +38,8 @@ import org.hibernate.test.generated.TimestampGeneratedValuesWithCachingTest; import org.hibernate.test.generated.TriggerGeneratedValuesWithCachingTest; import org.hibernate.test.generated.TriggerGeneratedValuesWithoutCachingTest; -import org.hibernate.test.generatedkeys.oracle.OracleGeneratedKeysTest; +import org.hibernate.test.generatedkeys.select.SelectGeneratorTest; +import org.hibernate.test.generatedkeys.seqidentity.SequenceIdentityTest; import org.hibernate.test.hql.HQLSuite; import org.hibernate.test.id.MultipleHiLoPerTableGeneratorTest; import org.hibernate.test.idbag.IdBagTest; @@ -286,7 +287,8 @@ suite.addTest( TimestampGeneratedValuesWithCachingTest.suite() ); suite.addTest( TriggerGeneratedValuesWithCachingTest.suite() ); suite.addTest( TriggerGeneratedValuesWithoutCachingTest.suite() ); - suite.addTest( OracleGeneratedKeysTest.suite() ); + suite.addTest( SelectGeneratorTest.suite() ); + suite.addTest( SequenceIdentityTest.suite() ); suite.addTest( InterceptorDynamicEntityTest.suite() ); suite.addTest( TuplizerDynamicEntityTest.suite() ); suite.addTest( org.hibernate.test.bytecode.cglib.ReflectionOptimizerTest.suite() ); Copied: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select (from rev 9531, trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle) Deleted: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/MyEntity.hbm.xml 2006-03-02 03:14:31 UTC (rev 9531) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml 2006-03-27 16:47:06 UTC (rev 9686) @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> - -<hibernate-mapping package="org.hibernate.test.generatedkeys.oracle" default-access="field"> - - <class name="MyEntity" table="my_entity"> - - <id name="id"> - <generator class="select"/> - </id> - <property name="name"/> - </class> - - <database-object> - <create> - <![CDATA[CREATE OR REPLACE TRIGGER t_i_my_entity - BEFORE INSERT ON my_entity - FOR EACH ROW - BEGIN - select nvl( max(id), 0 ) + 1 - into :new.id - from my_entity; - END;]]> - </create> - <drop> - <![CDATA[DROP TRIGGER t_i_my_entity]]> - </drop> - <dialect-scope name="org.hibernate.dialect.Oracle9Dialect"/> - <dialect-scope name="org.hibernate.dialect.OracleDialect"/> - </database-object> - -</hibernate-mapping> \ No newline at end of file Copied: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml (from rev 9675, trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/MyEntity.hbm.xml) =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/MyEntity.hbm.xml 2006-03-22 17:34:59 UTC (rev 9675) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.hbm.xml 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping package="org.hibernate.test.generatedkeys.select" default-access="field"> + + <class name="MyEntity" table="my_entity"> + + <id name="id"> + <generator class="select"/> + </id> + <natural-id> + <property name="name"/> + </natural-id> + </class> + + <database-object> + <create> + <![CDATA[CREATE OR REPLACE TRIGGER t_i_my_entity + BEFORE INSERT ON my_entity + FOR EACH ROW + BEGIN + select nvl( max(id), 0 ) + 1 + into :new.id + from my_entity; + END;]]> + </create> + <drop> + <![CDATA[DROP TRIGGER t_i_my_entity]]> + </drop> + <dialect-scope name="org.hibernate.dialect.Oracle9Dialect"/> + <dialect-scope name="org.hibernate.dialect.OracleDialect"/> + </database-object> + +</hibernate-mapping> \ No newline at end of file Modified: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/MyEntity.java 2006-03-02 03:14:31 UTC (rev 9531) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/MyEntity.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -1,4 +1,4 @@ -package org.hibernate.test.generatedkeys.oracle; +package org.hibernate.test.generatedkeys.select; /** * @author <a href="mailto:st...@hi...">Steve Ebersole </a> Deleted: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/OracleGeneratedKeysTest.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/OracleGeneratedKeysTest.java 2006-03-02 03:14:31 UTC (rev 9531) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/OracleGeneratedKeysTest.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -1,58 +0,0 @@ -package org.hibernate.test.generatedkeys.oracle; - -import org.hibernate.test.DatabaseSpecificTestCase; -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; -import org.hibernate.dialect.Oracle9Dialect; -import org.hibernate.dialect.Dialect; -import org.hibernate.dialect.DataDirectOracle9Dialect; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author <a href="mailto:st...@hi...">Steve Ebersole </a> - */ -public class OracleGeneratedKeysTest extends DatabaseSpecificTestCase { - public OracleGeneratedKeysTest(String x) { - super( x ); - } - - protected void configure(Configuration cfg) { - super.configure( cfg ); - cfg.setProperty( Environment.USE_GET_GENERATED_KEYS, "true" ); // make certain generated keys enabled. - } - - public boolean appliesTo(Dialect dialect) { - return ( dialect instanceof Oracle9Dialect ); - } - - protected String[] getMappings() { - return new String[] { - "generatedkeys/oracle/MyEntity.hbm.xml" - }; - } - - public static Test suite() { - return new TestSuite( OracleGeneratedKeysTest.class ); - } - - public void testJDBC3GetGeneratedKeysSupportOnOracle() { - if ( getDialect() instanceof DataDirectOracle9Dialect ) { - reportSkip( "DataDirect drivers known to not support JDBC3 getGeneratedKeys for Oracle", "oracle getGeneratedKeys support" ); - return; - } - Session session = openSession(); - session.beginTransaction(); - - MyEntity e = new MyEntity( "entity-1" ); - session.save( e ); - - // this insert should happen immediately! - assertEquals( "id not generated through forced insertion", new Long(1), e.getId() ); - - session.delete( e ); - session.getTransaction().commit(); - session.close(); - } -} Added: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/SelectGeneratorTest.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/oracle/SelectGeneratorTest.java 2006-03-02 03:14:31 UTC (rev 9531) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/SelectGeneratorTest.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,58 @@ +package org.hibernate.test.generatedkeys.select; + +import org.hibernate.test.DatabaseSpecificTestCase; +import org.hibernate.Session; +import org.hibernate.cfg.Configuration; +import org.hibernate.dialect.Oracle9Dialect; +import org.hibernate.dialect.Dialect; +import org.hibernate.dialect.DataDirectOracle9Dialect; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Steve Ebersole + */ +public class SelectGeneratorTest extends DatabaseSpecificTestCase { + public SelectGeneratorTest(String x) { + super( x ); + } + + // TODO : need to determine appropriate physical generation strategies for select-generator testing on other databases... + + protected void configure(Configuration cfg) { + super.configure( cfg ); + } + + public boolean appliesTo(Dialect dialect) { + return ( dialect instanceof Oracle9Dialect ); + } + + protected String[] getMappings() { + return new String[] { + "generatedkeys/select/MyEntity.hbm.xml" + }; + } + + public static Test suite() { + return new TestSuite( SelectGeneratorTest.class ); + } + + public void testJDBC3GetGeneratedKeysSupportOnOracle() { + if ( getDialect() instanceof DataDirectOracle9Dialect ) { + reportSkip( "DataDirect drivers known to not support JDBC3 getGeneratedKeys for Oracle", "oracle getGeneratedKeys support" ); + return; + } + Session session = openSession(); + session.beginTransaction(); + + MyEntity e = new MyEntity( "entity-1" ); + session.save( e ); + + // this insert should happen immediately! + assertEquals( "id not generated through forced insertion", new Long(1), e.getId() ); + + session.delete( e ); + session.getTransaction().commit(); + session.close(); + } +} Property changes on: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/select/SelectGeneratorTest.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.hbm.xml =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.hbm.xml 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.hbm.xml 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + +<hibernate-mapping package="org.hibernate.test.generatedkeys.seqidentity" default-access="field"> + + <class name="MyEntity" table="my_entity"> + + <id name="id"> + <generator class="sequence-identity"/> + </id> + <natural-id> + <property name="name"/> + </natural-id> + </class> + +</hibernate-mapping> \ No newline at end of file Added: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/MyEntity.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,28 @@ +package org.hibernate.test.generatedkeys.seqidentity; + +/** + * @author <a href="mailto:st...@hi...">Steve Ebersole </a> + */ +public class MyEntity { + private Long id; + private String name; + + public MyEntity() { + } + + public MyEntity(String name) { + this.name = name; + } + + public Long getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} Added: trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/SequenceIdentityTest.java =================================================================== --- trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/SequenceIdentityTest.java 2006-03-27 15:48:23 UTC (rev 9685) +++ trunk/Hibernate3/test/org/hibernate/test/generatedkeys/seqidentity/SequenceIdentityTest.java 2006-03-27 16:47:06 UTC (rev 9686) @@ -0,0 +1,54 @@ +package org.hibernate.test.generatedkeys.seqidentity; + +import org.hibernate.test.DatabaseSpecificTestCase; +import org.hibernate.Session; +import org.hibernate.cfg.Configuration; +import org.hibernate.dialect.Oracle9Dialect; +import org.hibernate.dialect.Dialect; +import org.hibernate.dialect.DataDirectOracle9Dialect; +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * @author Steve Ebersole + */ +public class SequenceIdentityTest extends DatabaseSpecificTestCase { + public SequenceIdentityTest(String x) { + super( x ); + } + + protected void configure(Configuration cfg) { + super.configure( cfg ); + } + + public boolean appliesTo(Dialect dialect) { + // the DataDirect driver for Oracle known to not support + // JDBC3 getGeneratedKeys... + return ( dialect instanceof Oracle9Dialect ) && ( ! ( dialect instanceof DataDirectOracle9Dialect ) ) ; + } + + protected String[] getMappings() { + return new String[] { + "generatedkeys/seqidentity/MyEntity.hbm.xml" + }; + } + + public static Test suite() { + return new TestSuite( SequenceIdentityTest.class ); + } + + public void testSequenceIdentityGenerator() { + Session session = openSession(); + session.beginTransaction(); + + MyEntity e = new MyEntity( "entity-1" ); + session.save( e ); + + // this insert should happen immediately! + assertEquals( "id not generated through forced insertion", new Long(1), e.getId() ); + + session.delete( e ); + session.getTransaction().commit(); + session.close(); + } +} |