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: <ste...@us...> - 2006-02-16 19:24:22
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15297/test/org/hibernate/test/hql Modified Files: ASTParserLoadingTest.java Log Message: disallow fetches in subqueries Index: ASTParserLoadingTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/hql/ASTParserLoadingTest.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- ASTParserLoadingTest.java 8 Feb 2006 18:49:26 -0000 1.52 +++ ASTParserLoadingTest.java 16 Feb 2006 19:24:13 -0000 1.53 @@ -67,6 +67,18 @@ }; } + public void testFetchInSubqueryFails() { + Session s = openSession(); + try { + s.createQuery( "from Animal a where a.mother in (select m from Animal a1 inner join a1.mother as m join fetch m.mother)" ).list(); + fail( "fetch join allowed in subquery" ); + } + catch( QueryException expected ) { + // expected behavior + } + s.close(); + } + public void testQueryMetadataRetrievalWithFetching() { // HHH-1464 : there was a problem due to the fact they we polled // the shallow version of the query plan to get the metadata. |
From: <ste...@us...> - 2006-02-16 19:23:36
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14970/src/org/hibernate/hql/ast Modified Files: HqlSqlWalker.java Log Message: disallow fetches in subqueries Index: HqlSqlWalker.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/hql/ast/HqlSqlWalker.java,v retrieving revision 1.116 retrieving revision 1.117 diff -u -d -r1.116 -r1.117 --- HqlSqlWalker.java 13 Feb 2006 15:50:28 -0000 1.116 +++ HqlSqlWalker.java 16 Feb 2006 19:23:22 -0000 1.117 @@ -299,7 +299,10 @@ AST fetchNode, AST propertyFetch, AST with) throws SemanticException { - boolean fetch = ( fetchNode != null ) ? true : false; + boolean fetch = fetchNode != null; + if ( fetch && isSubQuery() ) { + throw new QueryException( "fetch not allowed in subquery from-elements" ); + } // The path AST should be a DotNode, and it should have been evaluated already. if ( path.getType() != SqlTokenTypes.DOT ) { throw new SemanticException( "Path expected for join!" ); |
From: <epb...@us...> - 2006-02-16 12:52:16
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14316/metadata/src/test/org/hibernate/test/annotations/id Modified Files: Ball.java IdTest.java Log Message: Better test Index: Ball.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id/Ball.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Ball.java 3 Jan 2006 09:41:01 -0000 1.4 +++ Ball.java 16 Feb 2006 12:52:09 -0000 1.5 @@ -7,6 +7,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.TableGenerator; +import javax.persistence.Column; /** * Sample of table generator @@ -19,6 +20,7 @@ private Integer id; @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GEN") + @Column(name="ball_id") public Integer getId() { return id; } Index: IdTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id/IdTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- IdTest.java 15 Feb 2006 22:29:28 -0000 1.8 +++ IdTest.java 16 Feb 2006 12:52:09 -0000 1.9 @@ -3,6 +3,7 @@ import org.hibernate.Session; import org.hibernate.Transaction; +import org.hibernate.mapping.Column; import org.hibernate.test.annotations.TestCase; /** @@ -43,6 +44,7 @@ public void testTableGenerator() throws Exception { Session s = openSession(); Transaction tx = s.beginTransaction(); + Ball b = new Ball(); Dog d = new Dog(); Computer c = new Computer(); @@ -218,6 +220,12 @@ s.close(); } + public void testColumnDefinition() { + Column idCol = (Column) getCfg().getClassMapping( Ball.class.getName() ).getIdentifierProperty().getValue() + .getColumnIterator().next(); + assertEquals( "ball_id", idCol.getName() ); + } + /** * @see org.hibernate.test.annotations.TestCase#getMappings() */ |
From: <epb...@us...> - 2006-02-15 22:29:37
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4885/metadata/src/test/org/hibernate/test/annotations/id Modified Files: IdTest.java Log Message: ANN-98 Index: IdTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/id/IdTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IdTest.java 26 Jan 2006 08:41:09 -0000 1.7 +++ IdTest.java 15 Feb 2006 22:29:28 -0000 1.8 @@ -180,6 +180,8 @@ s.persist(keeper); tx.commit(); s.clear(); + + //lookup by id tx = s.beginTransaction(); FootballerPk fpk = new FootballerPk("David", "Beckam"); fb = (Footballer) s.get(Footballer.class, fpk); @@ -190,6 +192,26 @@ assertEquals( "Beckam", fb.getLastname() ); assertEquals( "Arsenal", fb.getClub() ); assertEquals( 1, s.createQuery( "from Footballer f where f.firstname = 'David'" ).list().size() ); + tx.commit(); + + //reattach by merge + tx = s.beginTransaction(); + fb.setClub( "Bimbo FC" ); + s.merge( fb ); + tx.commit(); + + //reattach by saveOrUpdate + tx = s.beginTransaction(); + fb.setClub( "Bimbo FC SA" ); + s.saveOrUpdate( fb ); + tx.commit(); + + //clean up + s.clear(); + tx = s.beginTransaction(); + fpk = new FootballerPk("David", "Beckam"); + fb = (Footballer) s.get(Footballer.class, fpk); + assertEquals( "Bimbo FC SA", fb.getClub() ); s.delete( fb ); s.delete( keeper ); tx.commit(); |
From: <epb...@us...> - 2006-02-15 22:28:30
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/tuple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/src/org/hibernate/tuple Modified Files: IdentifierProperty.java PropertyFactory.java Log Message: HHH-1489 Index: IdentifierProperty.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/tuple/IdentifierProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IdentifierProperty.java 5 Jun 2005 04:31:34 -0000 1.3 +++ IdentifierProperty.java 15 Feb 2006 22:28:15 -0000 1.4 @@ -19,6 +19,7 @@ private IdentifierValue unsavedValue; private IdentifierGenerator identifierGenerator; private boolean identifierAssignedByInsert; + private boolean hasIdentifierMapper; /** * Construct a non-virtual identifier property. @@ -34,15 +35,16 @@ * @param identifierGenerator The generator to use for id value generation. */ public IdentifierProperty( - String name, - String node, - Type type, - boolean embedded, - IdentifierValue unsavedValue, - IdentifierGenerator identifierGenerator) { + String name, + String node, + Type type, + boolean embedded, + IdentifierValue unsavedValue, + IdentifierGenerator identifierGenerator) { super(name, node, type); this.virtual = false; this.embedded = embedded; + this.hasIdentifierMapper = false; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; this.identifierAssignedByInsert = identifierGenerator instanceof PostInsertIdentifierGenerator; @@ -60,11 +62,13 @@ public IdentifierProperty( Type type, boolean embedded, - IdentifierValue unsavedValue, + boolean hasIdentifierMapper, + IdentifierValue unsavedValue, IdentifierGenerator identifierGenerator) { super(null, null, type); this.virtual = true; this.embedded = embedded; + this.hasIdentifierMapper = hasIdentifierMapper; this.unsavedValue = unsavedValue; this.identifierGenerator = identifierGenerator; this.identifierAssignedByInsert = identifierGenerator instanceof PostInsertIdentifierGenerator; @@ -89,4 +93,8 @@ public boolean isIdentifierAssignedByInsert() { return identifierAssignedByInsert; } + + public boolean hasIdentifierMapper() { + return hasIdentifierMapper; + } } Index: PropertyFactory.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/tuple/PropertyFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- PropertyFactory.java 26 Sep 2005 19:29:03 -0000 1.9 +++ PropertyFactory.java 15 Feb 2006 22:28:15 -0000 1.10 @@ -53,6 +53,7 @@ return new IdentifierProperty( type, mappedEntity.hasEmbeddedIdentifier(), + mappedEntity.hasIdentifierMapper(), unsavedValue, generator ); |
From: <epb...@us...> - 2006-02-15 22:28:30
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/persister/entity In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/src/org/hibernate/persister/entity Modified Files: AbstractEntityPersister.java EntityPersister.java Log Message: HHH-1489 Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- AbstractEntityPersister.java 14 Feb 2006 03:23:55 -0000 1.29 +++ AbstractEntityPersister.java 15 Feb 2006 22:28:15 -0000 1.30 @@ -90,7 +90,7 @@ * @author Gavin King */ public abstract class AbstractEntityPersister - implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, + implements OuterJoinLoadable, Queryable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, LazyPropertyInitializer, PostInsertIdentityPersister { private static final Log log = LogFactory.getLog( AbstractEntityPersister.class ); @@ -162,7 +162,7 @@ private final String[] subclassFormulaTemplateClosure; private final String[] subclassFormulaAliasClosure; [...986 lines suppressed...] return getTuplizer( entityMode ).getPropertyValue( object, propertyName ); } - + public Serializable getIdentifier(Object object, EntityMode entityMode) throws HibernateException { return getTuplizer( entityMode ).getIdentifier( object ); @@ -3460,9 +3464,9 @@ else { String subclassEntityName = getSubclassEntityName( clazz ); if ( subclassEntityName == null ) { - throw new HibernateException( - "instance not of expected entity type: " + clazz.getName() + - " is not a: " + getEntityName() + throw new HibernateException( + "instance not of expected entity type: " + clazz.getName() + + " is not a: " + getEntityName() ); } else { Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/persister/entity/EntityPersister.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- EntityPersister.java 14 Feb 2006 03:23:55 -0000 1.24 +++ EntityPersister.java 15 Feb 2006 22:28:15 -0000 1.25 @@ -154,7 +154,7 @@ /** * Do detached instances of this class carry their own identifier value? */ - public boolean hasIdentifierPropertyOrEmbeddedCompositeIdentifier(); + public boolean canExtractIdOutOfEntity(); /** * Are instances of this class versioned by a timestamp or version number column. |
From: <epb...@us...> - 2006-02-15 22:28:28
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/src/org/hibernate/mapping Modified Files: PersistentClass.java Log Message: HHH-1489 Index: PersistentClass.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/mapping/PersistentClass.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- PersistentClass.java 12 Jan 2006 23:13:03 -0000 1.50 +++ PersistentClass.java 15 Feb 2006 22:28:15 -0000 1.51 @@ -674,6 +674,10 @@ return identifierMapper; } + public boolean hasIdentifierMapper() { + return identifierMapper != null; + } + public void setIdentifierMapper(Component handle) { this.identifierMapper = handle; } |
From: <epb...@us...> - 2006-02-15 22:28:28
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/src/org/hibernate/type Modified Files: EntityType.java Log Message: HHH-1489 Index: EntityType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/type/EntityType.java,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- EntityType.java 26 Oct 2005 21:33:07 -0000 1.54 +++ EntityType.java 15 Feb 2006 22:28:15 -0000 1.55 @@ -388,7 +388,7 @@ public int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor factory) { EntityPersister persister = factory.getEntityPersister(associatedEntityName); - if ( !persister.hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) { + if ( !persister.canExtractIdOutOfEntity() ) { return super.getHashCode(x, entityMode); } @@ -404,7 +404,7 @@ public boolean isEqual(Object x, Object y, EntityMode entityMode, SessionFactoryImplementor factory) { EntityPersister persister = factory.getEntityPersister(associatedEntityName); - if ( !persister.hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) { + if ( !persister.canExtractIdOutOfEntity() ) { return super.isEqual(x, y, entityMode); } |
From: <epb...@us...> - 2006-02-15 22:28:27
|
Update of /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/test/org/hibernate/test/legacy Modified Files: CustomPersister.java Log Message: HHH-1489 Index: CustomPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/test/org/hibernate/test/legacy/CustomPersister.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- CustomPersister.java 14 Feb 2006 03:24:18 -0000 1.31 +++ CustomPersister.java 15 Feb 2006 22:28:15 -0000 1.32 @@ -479,7 +479,7 @@ } - public boolean hasIdentifierPropertyOrEmbeddedCompositeIdentifier() { + public boolean canExtractIdOutOfEntity() { return true; } |
From: <epb...@us...> - 2006-02-15 22:28:24
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/event/def In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4307/src/org/hibernate/event/def Modified Files: DefaultFlushEntityEventListener.java Log Message: HHH-1489 Index: DefaultFlushEntityEventListener.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/event/def/DefaultFlushEntityEventListener.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- DefaultFlushEntityEventListener.java 3 Feb 2006 22:08:24 -0000 1.27 +++ DefaultFlushEntityEventListener.java 15 Feb 2006 22:28:14 -0000 1.28 @@ -28,11 +28,11 @@ /** * An event that occurs for each entity instance at flush time - * + * * @author Gavin King */ public class DefaultFlushEntityEventListener implements FlushEntityEventListener { - + private static final Log log = LogFactory.getLog(DefaultFlushEntityEventListener.class); /** @@ -41,7 +41,7 @@ public void checkId(Object object, EntityPersister persister, Serializable id, EntityMode entityMode) throws HibernateException { - if ( persister.hasIdentifierPropertyOrEmbeddedCompositeIdentifier() ) { + if ( persister.canExtractIdOutOfEntity() ) { Serializable oid = persister.getIdentifier( object, entityMode ); if (id==null) { @@ -58,7 +58,7 @@ } } - + private void checkNaturalId( EntityPersister persister, Serializable identifier, @@ -100,16 +100,16 @@ final Status status = entry.getStatus(); final EntityMode entityMode = session.getEntityMode(); final Type[] types = persister.getPropertyTypes(); - + final boolean mightBeDirty = entry.requiresDirtyCheck(entity); final Object[] values = getValues( entity, entry, entityMode, mightBeDirty, session ); - + event.setPropertyValues(values); //TODO: avoid this for non-new instances where mightBeDirty==false boolean substitute = wrapCollections( session, persister, types, values); - + if ( isUpdateNecessary( event, mightBeDirty ) ) { substitute = scheduleUpdate( event ) || substitute; } @@ -128,16 +128,16 @@ } private Object[] getValues( - Object entity, - EntityEntry entry, - EntityMode entityMode, + Object entity, + EntityEntry entry, + EntityMode entityMode, boolean mightBeDirty, SessionImplementor session ) { final Object[] loadedState = entry.getLoadedState(); final Status status = entry.getStatus(); final EntityPersister persister = entry.getPersister(); - + final Object[] values; if ( status == Status.DELETED ) { //grab its state saved at deletion @@ -148,19 +148,19 @@ } else { checkId( entity, persister, entry.getId(), entityMode ); - + // grab its current state values = persister.getPropertyValues( entity, entityMode ); - + checkNaturalId( persister, entry.getId(), values, loadedState, entityMode, session ); } return values; } private boolean wrapCollections( - EventSource session, - EntityPersister persister, - Type[] types, + EventSource session, + EntityPersister persister, + Type[] types, Object[] values ) { if ( persister.hasCollections() ) { |
From: <one...@us...> - 2006-02-15 21:46:16
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/templates/seam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22048/src/templates/seam Modified Files: editorbean.java.ftl Log Message: handle multiple children Index: editorbean.java.ftl =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/templates/seam/editorbean.java.ftl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- editorbean.java.ftl 6 Feb 2006 09:08:07 -0000 1.2 +++ editorbean.java.ftl 15 Feb 2006 21:46:08 -0000 1.3 @@ -115,7 +115,7 @@ null : new ${pojo.importType("java.util.ArrayList")}( instance.${getter}() ); } - @${pojo.importType("org.jboss.seam.annotations.datamodel.DataModelSelection")} + @${pojo.importType("org.jboss.seam.annotations.datamodel.DataModelSelection")}("${property.name}List") private ${childPojo.shortName} selected${childPojo.shortName}; @${pojo.importType("org.jboss.seam.annotations.In")}(create=true) |
From: <ste...@us...> - 2006-02-15 20:15:32
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23307/src/org/hibernate/jdbc Modified Files: Tag: Branch_3_1 ConnectionManager.java Log Message: more websphere fun Index: ConnectionManager.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/jdbc/ConnectionManager.java,v retrieving revision 1.24.2.2 retrieving revision 1.24.2.3 diff -u -d -r1.24.2.2 -r1.24.2.3 --- ConnectionManager.java 3 Feb 2006 20:18:39 -0000 1.24.2.2 +++ ConnectionManager.java 15 Feb 2006 20:15:24 -0000 1.24.2.3 @@ -198,17 +198,21 @@ * @return True if the connections will be released after each statement; false otherwise. */ public boolean isAggressiveRelease() { - boolean inAutoCommitState; - try { - inAutoCommitState = !callback.isTransactionInProgress() && isAutoCommit(); + if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { + return true; } - catch( SQLException e ) { - // assume we are in an auto-commit state - inAutoCommitState = true; + else if ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION ) { + boolean inAutoCommitState; + try { + inAutoCommitState = isAutoCommit()&& !callback.isTransactionInProgress(); + } + catch( SQLException e ) { + // assume we are in an auto-commit state + inAutoCommitState = true; + } + return inAutoCommitState; } - // release connections - return releaseMode == ConnectionReleaseMode.AFTER_STATEMENT || - ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION && inAutoCommitState ); + return false; } /** |
From: <ste...@us...> - 2006-02-15 20:15:15
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/jdbc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23080/src/org/hibernate/jdbc Modified Files: ConnectionManager.java Log Message: more websphere fun Index: ConnectionManager.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/jdbc/ConnectionManager.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ConnectionManager.java 3 Feb 2006 22:08:24 -0000 1.26 +++ ConnectionManager.java 15 Feb 2006 20:15:04 -0000 1.27 @@ -198,17 +198,21 @@ * @return True if the connections will be released after each statement; false otherwise. */ public boolean isAggressiveRelease() { - boolean inAutoCommitState; - try { - inAutoCommitState = !callback.isTransactionInProgress() && isAutoCommit(); + if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { + return true; } - catch( SQLException e ) { - // assume we are in an auto-commit state - inAutoCommitState = true; + else if ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION ) { + boolean inAutoCommitState; + try { + inAutoCommitState = isAutoCommit()&& !callback.isTransactionInProgress(); + } + catch( SQLException e ) { + // assume we are in an auto-commit state + inAutoCommitState = true; + } + return inAutoCommitState; } - // release connections - return releaseMode == ConnectionReleaseMode.AFTER_STATEMENT || - ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION && inAutoCommitState ); + return false; } /** |
Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/reflection/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18882/metadata/src/java/org/hibernate/reflection/java Modified Files: JavaXFactory.java JavaXProperty.java JavaXArrayProperty.java Added Files: Pair.java Removed Files: Couplet.java Log Message: Better support for generic arrays in reflection layer --- NEW FILE: Pair.java --- package org.hibernate.reflection.java; /** * A pair of objects that can be used as a key in a Map. * * @author Paolo Perrotta * @author Davide Marchignoli */ abstract class Pair<T, U> { private final T o1; private final U o2; Pair( T o1, U o2 ) { this.o1 = o1; this.o2 = o2; } @Override public boolean equals(Object obj) { Pair other = (Pair) obj; return safeEquals( o1, other.o1 ) && safeEquals( o2, other.o2 ); } @Override public int hashCode() { return safeHashCode( o1 ) ^ safeHashCode( o2 ); } private int safeHashCode(Object o) { if( o == null ) return 0; return o.hashCode(); } private boolean safeEquals(Object obj1, Object obj2) { if ( obj1 == null ) return obj2 == null; boolean result = obj1.equals( obj2 ); return result; } } Index: JavaXFactory.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JavaXFactory.java 13 Feb 2006 19:14:35 -0000 1.1 +++ JavaXFactory.java 15 Feb 2006 18:37:27 -0000 1.2 @@ -25,13 +25,13 @@ */ public class JavaXFactory implements ReflectionManager { - private static class PropertyKey extends Couplet<Member, XClass> { + private static class PropertyKey extends Pair<Member, XClass> { PropertyKey( Member member, XClass owner ) { super( member, owner ); } } - private static class TypeKey extends Couplet<Type, TypeEnvironment> { + private static class TypeKey extends Pair<Type, TypeEnvironment> { TypeKey( Type t, TypeEnvironment context ) { super( t, context ); } Index: JavaXProperty.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXProperty.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- JavaXProperty.java 13 Feb 2006 19:14:35 -0000 1.3 +++ JavaXProperty.java 15 Feb 2006 18:37:28 -0000 1.4 @@ -132,7 +132,7 @@ } public XClass getType() { - return getFactory().toXClass( env.bind( type ), env ); + return getFactory().toXClass( getJavaType(), env ); } public String getName() { @@ -162,7 +162,7 @@ } protected Type getJavaType() { - return type; + return env.bind( type ); } protected TypeEnvironment getTypeEnvironment() { Index: JavaXArrayProperty.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/reflection/java/JavaXArrayProperty.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JavaXArrayProperty.java 13 Feb 2006 19:14:35 -0000 1.1 +++ JavaXArrayProperty.java 15 Feb 2006 18:37:28 -0000 1.2 @@ -1,5 +1,6 @@ package org.hibernate.reflection.java; +import java.lang.reflect.Array; import java.lang.reflect.GenericArrayType; import java.lang.reflect.Member; import java.lang.reflect.Type; @@ -30,24 +31,39 @@ } public XClass getElementClass() { - return new TypeSwitch<XClass>() { + return getFactory().toXClass( getElementType(), getTypeEnvironment() ); + } + + private Type getElementType() { + return new TypeSwitch<Type>() { @Override - public XClass caseClass(Class classType) { - return getFactory().toXClass( classType.getComponentType(), getTypeEnvironment() ); + public Type caseClass(Class classType) { + return classType.getComponentType(); } @Override - public XClass caseGenericArrayType(GenericArrayType genericArrayType) { - return getFactory().toXClass( genericArrayType.getGenericComponentType(), getTypeEnvironment() ); + public Type caseGenericArrayType(GenericArrayType genericArrayType) { + return genericArrayType.getGenericComponentType(); } @Override - public XClass defaultCase(Type t) { + public Type defaultCase(Type t) { throw new IllegalArgumentException( t + " is not an array type" ); } }.doSwitch( getJavaType() ); } + public XClass getType() { + Type boundType = getElementType(); + if( boundType instanceof Class ) + boundType = arrayTypeOf( (Class) boundType ); + return getFactory().toXClass( boundType, getTypeEnvironment() ); + } + + private Class<? extends Object> arrayTypeOf(Class componentType) { + return Array.newInstance( componentType, 0 ).getClass(); + } + public XClass getClassOrElementClass() { return getElementClass(); } --- Couplet.java DELETED --- |
From: <pao...@us...> - 2006-02-15 18:37:37
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/reflection/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18882/metadata/src/test/org/hibernate/test/reflection/java Modified Files: JavaXPropertyTest.java Log Message: Better support for generic arrays in reflection layer Index: JavaXPropertyTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/reflection/java/JavaXPropertyTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JavaXPropertyTest.java 13 Feb 2006 19:14:35 -0000 1.1 +++ JavaXPropertyTest.java 15 Feb 2006 18:37:29 -0000 1.2 @@ -58,11 +58,7 @@ public void testCanBeAnArray() { List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" ); XProperty p = getPropertyNamed_from( "arrayProperty", declaredProperties ); - - // TODO: this truly sucks. the problem is that I can't get a reference to a specific array class - // at runtime. is there any way to do that in Java? - assertNull( p.getType() ); - + assertTrue( factory.equals( p.getType(), String[].class )); assertTrue( factory.equals( p.getElementClass(), String.class )); assertTrue( factory.equals( p.getClassOrElementClass(), String.class )); assertNull( p.getCollectionClass() ); |
From: <max...@us...> - 2006-02-15 17:07:39
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/xpl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16397/src/org/hibernate/eclipse/console/utils/xpl Added Files: SelectionHelper.java Log Message: HBX-595 Add "New XML mapping file" option/wizard --- NEW FILE: SelectionHelper.java --- /******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation, JBoss Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Max Rydahl Andersen - extracted to use in general *******************************************************************************/ package org.hibernate.eclipse.console.utils.xpl; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.ui.viewsupport.IViewPartInputProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.views.contentoutline.ContentOutline; import org.hibernate.eclipse.console.HibernateConsolePlugin; public class SelectionHelper { static public IType getClassFromElement(IJavaElement element) { IType classToTest= null; if (element != null) { // evaluate the enclosing type IType typeInCompUnit= (IType) element.getAncestor(IJavaElement.TYPE); if (typeInCompUnit != null) { if (typeInCompUnit.getCompilationUnit() != null) { classToTest= typeInCompUnit; } } else { ICompilationUnit cu= (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT); if (cu != null) classToTest= cu.findPrimaryType(); else { if (element instanceof IClassFile) { try { IClassFile cf= (IClassFile) element; if (cf.isStructureKnown()) classToTest= cf.getType(); } catch(JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } } } } } return classToTest; } /** * Utility method to inspect a selection to find a Java element. * * @param selection the selection to be inspected * @return a Java element to be used as the initial selection, or <code>null</code>, * if no Java element exists in the given selection */ static public IJavaElement getInitialJavaElement(ISelection simpleSelection) { IJavaElement jelem= null; if (simpleSelection != null && !simpleSelection.isEmpty() && simpleSelection instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) simpleSelection; Object selectedElement= selection.getFirstElement(); if (selectedElement instanceof IAdaptable) { IAdaptable adaptable= (IAdaptable) selectedElement; jelem= (IJavaElement) adaptable.getAdapter(IJavaElement.class); if (jelem == null) { IResource resource= (IResource) adaptable.getAdapter(IResource.class); if (resource != null && resource.getType() != IResource.ROOT) { while (jelem == null && resource.getType() != IResource.PROJECT) { resource= resource.getParent(); jelem= (IJavaElement) resource.getAdapter(IJavaElement.class); } if (jelem == null) { jelem= JavaCore.create(resource); // java project } } } } } if (jelem == null) { IWorkbenchPart part= getActivePage().getActivePart(); if (part instanceof ContentOutline) { part= getActivePage().getActiveEditor(); } if (part instanceof IViewPartInputProvider) { Object elem= ((IViewPartInputProvider)part).getViewPartInput(); if (elem instanceof IJavaElement) { jelem= (IJavaElement) elem; } } } /*if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) { try { IJavaProject[] projects= JavaCore.create(getWorkspaceRoot()).getJavaProjects(); if (projects.length == 1) { jelem= projects[0]; } } catch (JavaModelException e) { JavaPlugin.log(e); } }*/ return jelem; } public static IWorkbenchPage getActivePage() { IWorkbenchWindow window= getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; return getWorkbench().getActiveWorkbenchWindow().getActivePage(); } static public IWorkbench getWorkbench() { return PlatformUI.getWorkbench(); } } |
From: <max...@us...> - 2006-02-15 17:07:39
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16397 Modified Files: plugin.xml Log Message: HBX-595 Add "New XML mapping file" option/wizard Index: plugin.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/plugin.xml,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- plugin.xml 2 Dec 2005 22:48:23 -0000 1.35 +++ plugin.xml 15 Feb 2006 17:07:27 -0000 1.36 @@ -60,6 +60,12 @@ id="hibernatewizards"/> <wizard category="hibernatewizards" + class="org.hibernate.eclipse.console.wizards.NewHibernateMappingFileWizard" + icon="icons/hibernate_small_icon.gif" + id="org.hibernate.eclipse.console.wizards.NewHibernateMappingFileWizard" + name="Hibernate XML Mapping file (hbm.xml)"/> + <wizard + category="hibernatewizards" class="org.hibernate.eclipse.console.wizards.NewConfigurationWizard" icon="icons/hibernate_small_icon.gif" id="org.hibernate.eclipse.console.wizards.NewConfigurationWizard" @@ -67,15 +73,6 @@ <description>Create a new hibernate.cfg.xml file (Helping with the initial JDBC setup etc.)</description> </wizard> <wizard - canFinishEarly="false" - category="hibernatewizards" - class="org.hibernate.eclipse.console.wizards.NewReverseEngineeringFileWizard" - icon="icons/hibernate_small_icon.gif" - id="org.hibernate.eclipse.console.wizards.NewReverseEngineeringFileWizard" - name="Hibernate Reverse Engineering File (reveng.xml)"> - <description>Create a new hibernate.reveng.xml (Helping with the initial table and type filtering)</description> - </wizard> - <wizard category="hibernatewizards" class="org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard" descriptionImage="icons/hibernate_small_icon.gif" @@ -84,9 +81,18 @@ id="org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard" name="Hibernate Console Configuration" preferredPerspectives="org.hibernate.eclipse.console.HibernateConsolePerspective" - project="false"> + project="true"> <description>Creates a new Hibernate Console Configuration</description> </wizard> + <wizard + canFinishEarly="false" + category="hibernatewizards" + class="org.hibernate.eclipse.console.wizards.NewReverseEngineeringFileWizard" + icon="icons/hibernate_small_icon.gif" + id="org.hibernate.eclipse.console.wizards.NewReverseEngineeringFileWizard" + name="Hibernate Reverse Engineering File (reveng.xml)"> + <description>Create a new hibernate.reveng.xml (Helping with the initial table and type filtering)</description> + </wizard> </extension> <extension point="org.eclipse.ui.popupMenus"> @@ -267,9 +273,10 @@ <extension point="org.eclipse.ui.perspectiveExtensions"> <perspectiveExtension targetID="org.hibernate.eclipse.console.HibernateConsolePerspective"> + <newWizardShortcut id="org.hibernate.eclipse.console.wizards.NewHibernateMappingFileWizard"/> <newWizardShortcut id="org.hibernate.eclipse.console.wizards.NewConfigurationWizard"/> <newWizardShortcut id="org.hibernate.eclipse.console.wizards.ConsoleConfigurationCreationWizard"/> - <newWizardShortcut id="org.hibernate.eclipse.console.newWizardShortcut3"/> + <newWizardShortcut id="org.hibernate.eclipse.console.wizards.NewReverseEngineeringFileWizard"/> <viewShortcut id="org.hibernate.eclipse.console.views.KnownConfigurationsView"/> <viewShortcut id="org.hibernate.eclipse.graph.EntityGraphView"/> <viewShortcut id="org.hibernate.eclipse.console.views.QueryPageTabView"/> |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16397/src/org/hibernate/eclipse/console/wizards Added Files: NewHibernateMappingFilePage.java NewHibernateMappingFileWizard.java Log Message: HBX-595 Add "New XML mapping file" option/wizard --- NEW FILE: NewHibernateMappingFilePage.java --- package org.hibernate.eclipse.console.wizards; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.SearchEngine; import org.eclipse.jdt.ui.IJavaElementSearchConstants; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.dialogs.ContainerSelectionDialog; import org.eclipse.ui.dialogs.SelectionDialog; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.hibernate.eclipse.console.HibernateConsolePlugin; import org.hibernate.eclipse.console.utils.xpl.SelectionHelper; /** * The "New" wizard page allows setting the container for the new file as well * as the file name. The page will only accept file name without the extension * OR with the extension that matches the expected one (hbm.xml). */ public class NewHibernateMappingFilePage extends WizardPage { private Label containerText; private Label fileText; private ISelection selection; private Text classToMap; private WizardNewFileCreationPage fileCreation; private boolean beenShown; /** * Constructor for SampleNewWizardPage. * @param page * * @param pageName */ public NewHibernateMappingFilePage(ISelection selection, WizardNewFileCreationPage page) { super("wizardPage"); this.fileCreation = page; setTitle("Hibernate XML Mapping file"); setDescription("This wizard creates a new Hibernate XML Mapping file"); this.selection = selection; } public void setVisible(boolean visible) { containerText.setText(fileCreation.getContainerFullPath().toPortableString() ); fileText.setText(fileCreation.getFileName() ); super.setVisible(visible); if(visible) { classToMap.setFocus(); } beenShown = true; dialogChanged(); } /** * @see IDialogPage#createControl(Composite) */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText("&Container:"); containerText = new Label(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&File name:"); fileText = new Label(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("Class to &map:"); classToMap = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); classToMap.setLayoutData(gd); classToMap.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { dialogChanged(); } }); //TODO (internal api!): ControlContentAssistHelper.createTextContentAssistant(classToMap, aCompletionProcessor); Button button = new Button(container, SWT.PUSH); button.setText("Browse..."); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleClassToMapBrowse(); } }); initialize(); dialogChanged(); setControl(container); } /** * Tests if the current workbench selection is a suitable container to use. */ private void initialize() { IType initialJavaElement = SelectionHelper.getClassFromElement(SelectionHelper.getInitialJavaElement(selection)); if(initialJavaElement!=null) { classToMap.setText(initialJavaElement.getFullyQualifiedName('.')); } } /** * Uses the standard container selection dialog to choose the new value for * the container field. */ private void handleBrowse() { ContainerSelectionDialog dialog = new ContainerSelectionDialog( getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, "Select new file container"); if (dialog.open() == ContainerSelectionDialog.OK) { Object[] result = dialog.getResult(); if (result.length == 1) { containerText.setText(((Path) result[0]).toString()); } } } private void handleClassToMapBrowse() { IType type = findClassToMap(); if(type!=null) { classToMap.setText(type.getFullyQualifiedName('.')); } } IType findClassToMap() { IJavaProject root= getRootJavaProject(); if (root == null) return null; IJavaElement[] elements= new IJavaElement[] { root }; IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), getWizard().getContainer(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, getClassToMapText()); dialog.setTitle("Select class to map"); dialog.setMessage("The class will be used when generating the hbm.xml file"); if (dialog.open() == Window.OK) { Object[] resultArray= dialog.getResult(); if (resultArray != null && resultArray.length > 0) return (IType) resultArray[0]; } } catch (JavaModelException e) { HibernateConsolePlugin.getDefault().log(e); } return null; } private IJavaProject getRootJavaProject() { IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(containerText.getText()); if(resource!=null) { if(resource.getProject()!=null) { IJavaProject project = JavaCore.create(resource.getProject()); return project; } } return null; } String getClassToMapText() { return classToMap.getText(); } /** * Ensures that both text fields are set. */ private void dialogChanged() { IResource container = ResourcesPlugin.getWorkspace().getRoot() .findMember(new Path(getContainerName())); String fileName = getFileName(); if (getContainerName().length() == 0) { updateStatus("File container must be specified"); return; } if (container == null || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { updateStatus("File container must exist"); return; } if (!container.isAccessible()) { updateStatus("Project must be writable"); return; } if (fileName.length() == 0) { updateStatus("File name must be specified"); return; } if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { updateStatus("File name must be valid"); return; } updateStatus(null); } private void updateStatus(String message) { setErrorMessage(message); setPageComplete(message == null); } public String getContainerName() { return containerText.getText(); } public String getFileName() { return fileText.getText(); } } --- NEW FILE: NewHibernateMappingFileWizard.java --- package org.hibernate.eclipse.console.wizards; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.IType; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWizard; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.eclipse.ui.ide.IDE; import org.hibernate.console.ImageConstants; import org.hibernate.eclipse.console.HibernateConsolePlugin; import org.hibernate.eclipse.console.utils.EclipseImages; import org.hibernate.eclipse.console.utils.xpl.SelectionHelper; import org.hibernate.util.StringHelper; public class NewHibernateMappingFileWizard extends Wizard implements INewWizard { private NewHibernateMappingFilePage mappingFileInfoPage; private ISelection selection; private WizardNewFileCreationPage cPage; /** * Constructor for NewConfigurationWizard. */ public NewHibernateMappingFileWizard() { super(); setDefaultPageImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.NEW_WIZARD) ); setNeedsProgressMonitor(true); } /** extended to update status messages on first show **/ static class ExtendedWizardNewFileCreationPage extends WizardNewFileCreationPage { public ExtendedWizardNewFileCreationPage(String pageName, IStructuredSelection selection) { super(pageName, selection); } boolean firstTime = true; public void setVisible(boolean visible) { super.setVisible(visible); if(firstTime) { validatePage(); firstTime = false; } } } /** * Adding the page to the wizard. */ public void addPages() { cPage = new ExtendedWizardNewFileCreationPage( "Chbmxml", (IStructuredSelection) selection ); cPage.setTitle( "Create Hibernate XML Mapping file (hbm.xml)" ); cPage.setDescription( "Create a new XML Mapping file." ); IType initialJavaElement = SelectionHelper.getClassFromElement(SelectionHelper.getInitialJavaElement(selection)); if(initialJavaElement!=null) { cPage.setFileName(initialJavaElement.getElementName() + ".hbm.xml"); } else { cPage.setFileName("NewMapping.hbm.xml"); } addPage( cPage ); mappingFileInfoPage = new NewHibernateMappingFilePage(selection, cPage); addPage(mappingFileInfoPage); } /** * This method is called when 'Finish' button is pressed in * the wizard. We will create an operation and run it * using wizard as execution context. */ public boolean performFinish() { final IFile file = cPage.createNewFile(); final String classToMapText = mappingFileInfoPage.getClassToMapText(); IRunnableWithProgress op = new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException { try { createFile(file, classToMapText, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } } }; try { getContainer().run(true, false, op); } catch (InterruptedException e) { return false; } catch (InvocationTargetException e) { Throwable realException = e.getTargetException(); HibernateConsolePlugin.getDefault().log(realException); return false; } return true; } /** * The worker method. It will find the container, create the * file if missing or just replace its contents, and open * the editor on the newly created file. * @param file * @param props */ private void createFile( final IFile file, String classToMapText, IProgressMonitor monitor) throws CoreException { // create a sample file monitor.beginTask("Creating " + file.getName(), 2); try { InputStream stream = openContentStream(classToMapText); if (file.exists() ) { file.setContents(stream, true, true, monitor); } else { file.create(stream, true, monitor); } stream.close(); } catch (IOException e) { } monitor.worked(1); monitor.setTaskName("Opening file for editing..."); getShell().getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(page, file, true); } catch (PartInitException e) { } } }); monitor.worked(1); } /** * We will initialize file contents with a sample text. */ private InputStream openContentStream(String classToMapText) { String classname = null; String packagename = null; if(StringHelper.isNotEmpty(classToMapText)) { classname = StringHelper.unqualify(classToMapText); packagename = StringHelper.qualifier(classToMapText); } String contents = "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE hibernate-mapping PUBLIC\n" + " \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n" + " \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n" + "<hibernate-mapping"; if(StringHelper.isNotEmpty(packagename)) { contents +=" package=\"" + packagename + "\">"; } else { contents +=">\n"; } if(StringHelper.isNotEmpty(classname)) { contents +="\n <class name=\"" + classname + "\">\n" + " </class>"; } contents += "\n</hibernate-mapping>"; return new ByteArrayInputStream(contents.getBytes()); } /** * We will accept the selection in the workbench to see if * we can initialize from it. * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) */ public void init(IWorkbench workbench, IStructuredSelection selection) { this.selection = selection; } } |
From: <ste...@us...> - 2006-02-15 16:35:41
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3858/src/org/hibernate/util Modified Files: SimpleMRUCache.java SoftLimitMRUCache.java Log Message: HHH-1486 : fixed concurrent access issues in the two MRU caches Index: SimpleMRUCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/util/SimpleMRUCache.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SimpleMRUCache.java 9 Jan 2006 15:55:15 -0000 1.2 +++ SimpleMRUCache.java 15 Feb 2006 16:35:34 -0000 1.3 @@ -4,7 +4,6 @@ import java.io.Serializable; import java.io.IOException; -import java.util.Iterator; /** * Cache following a "Most Recently Used" (MRU) algorithm for maintaining a @@ -36,15 +35,11 @@ return cache.get( key ); } - public Object put(Object key, Object value) { + public synchronized Object put(Object key, Object value) { return cache.put( key, value ); } - public Iterator entries() { - return cache.entrySet().iterator(); - } - - public int size() { + public synchronized int size() { return cache.size(); } @@ -56,4 +51,8 @@ in.defaultReadObject(); init(); } + + public synchronized void clear() { + cache.clear(); + } } Index: SoftLimitMRUCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/util/SoftLimitMRUCache.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SoftLimitMRUCache.java 9 Jan 2006 15:55:15 -0000 1.1 +++ SoftLimitMRUCache.java 15 Feb 2006 16:35:34 -0000 1.2 @@ -5,7 +5,6 @@ import java.io.Serializable; import java.io.IOException; -import java.util.Iterator; /** * Cache following a "Most Recently Used" (MRY) algorithm for maintaining a @@ -55,27 +54,19 @@ return result; } - public Object put(Object key, Object value) { + public synchronized Object put(Object key, Object value) { softReferenceCache.put( key, value ); return strongReferenceCache.put( key, value ); } - public int size() { + public synchronized int size() { return strongReferenceCache.size(); } - public int softSize() { + public synchronized int softSize() { return softReferenceCache.size(); } - public Iterator entries() { - return strongReferenceCache.entrySet().iterator(); - } - - public Iterator softEntries() { - return softReferenceCache.entrySet().iterator(); - } - private void init() { strongReferenceCache = new LRUMap( strongReferenceCount ); } @@ -84,4 +75,9 @@ in.defaultReadObject(); init(); } + + public synchronized void clear() { + strongReferenceCache.clear(); + softReferenceCache.clear(); + } } |
From: <ste...@us...> - 2006-02-15 16:35:12
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3619/src/org/hibernate/util Modified Files: Tag: Branch_3_1 SimpleMRUCache.java SoftLimitMRUCache.java Log Message: HHH-1486 : fixed concurrent access issues in the two MRU caches Index: SimpleMRUCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/util/SimpleMRUCache.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -d -r1.2 -r1.2.2.1 --- SimpleMRUCache.java 9 Jan 2006 15:55:15 -0000 1.2 +++ SimpleMRUCache.java 15 Feb 2006 16:35:03 -0000 1.2.2.1 @@ -4,7 +4,6 @@ import java.io.Serializable; import java.io.IOException; -import java.util.Iterator; /** * Cache following a "Most Recently Used" (MRU) algorithm for maintaining a @@ -36,15 +35,11 @@ return cache.get( key ); } - public Object put(Object key, Object value) { + public synchronized Object put(Object key, Object value) { return cache.put( key, value ); } - public Iterator entries() { - return cache.entrySet().iterator(); - } - - public int size() { + public synchronized int size() { return cache.size(); } @@ -56,4 +51,8 @@ in.defaultReadObject(); init(); } + + public synchronized void clear() { + cache.clear(); + } } Index: SoftLimitMRUCache.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/util/SoftLimitMRUCache.java,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -u -d -r1.1 -r1.1.2.1 --- SoftLimitMRUCache.java 9 Jan 2006 15:55:15 -0000 1.1 +++ SoftLimitMRUCache.java 15 Feb 2006 16:35:03 -0000 1.1.2.1 @@ -5,7 +5,6 @@ import java.io.Serializable; import java.io.IOException; -import java.util.Iterator; /** * Cache following a "Most Recently Used" (MRY) algorithm for maintaining a @@ -55,27 +54,19 @@ return result; } - public Object put(Object key, Object value) { + public synchronized Object put(Object key, Object value) { softReferenceCache.put( key, value ); return strongReferenceCache.put( key, value ); } - public int size() { + public synchronized int size() { return strongReferenceCache.size(); } - public int softSize() { + public synchronized int softSize() { return softReferenceCache.size(); } - public Iterator entries() { - return strongReferenceCache.entrySet().iterator(); - } - - public Iterator softEntries() { - return softReferenceCache.entrySet().iterator(); - } - private void init() { strongReferenceCache = new LRUMap( strongReferenceCount ); } @@ -84,4 +75,9 @@ in.defaultReadObject(); init(); } + + public synchronized void clear() { + strongReferenceCache.clear(); + softReferenceCache.clear(); + } } |
From: <max...@us...> - 2006-02-15 13:32:12
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1046/src/org/hibernate/eclipse/console/wizards Modified Files: ConsoleConfigurationWizardPage.java Log Message: fixed missing exported package HBX-596 Rename label in Console Config wizard Index: ConsoleConfigurationWizardPage.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/ConsoleConfigurationWizardPage.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ConsoleConfigurationWizardPage.java 7 Feb 2006 16:17:49 -0000 1.18 +++ ConsoleConfigurationWizardPage.java 15 Feb 2006 13:31:57 -0000 1.19 @@ -249,7 +249,7 @@ } private UpDownListComposite buildMappingFileTable(Composite parent) { - mappingFilesViewer = new UpDownListComposite(parent, SWT.NONE, "Mapping files") { + mappingFilesViewer = new UpDownListComposite(parent, SWT.NONE, "Additonal mapping files (not listed in cfg.xml)") { protected Object[] handleAdd(int idx) { TableItem[] items = getTable().getItems(); IPath[] exclude = new IPath[items.length]; |
From: <max...@us...> - 2006-02-15 13:32:07
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1030/META-INF Modified Files: MANIFEST.MF Log Message: fixed missing exported package HBX-596 Rename label in Console Config wizard Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF/MANIFEST.MF,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- MANIFEST.MF 8 Feb 2006 08:00:44 -0000 1.33 +++ MANIFEST.MF 15 Feb 2006 13:31:53 -0000 1.34 @@ -231,6 +231,7 @@ org.hibernate.dialect.function, org.hibernate.eclipse, org.hibernate.eclipse.logging, + org.hibernate.eclipse.logging.xpl, org.hibernate.engine, org.hibernate.engine.query, org.hibernate.engine.transaction, |
From: <epb...@us...> - 2006-02-14 18:40:39
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7473/metadata/src/java/org/hibernate/cfg Modified Files: AnnotationBinder.java ClassPropertyHolder.java CollectionPropertyHolder.java ComponentPropertyHolder.java Ejb3JoinColumn.java PropertyHolder.java PropertyHolderBuilder.java PropertyPreloadedData.java Added Files: AbstractPropertyHolder.java Log Message: ANN-240 complete rework to embed overriding mechanism inside property holder --- NEW FILE: AbstractPropertyHolder.java --- //$Id: AbstractPropertyHolder.java,v 1.1 2006/02/14 18:40:31 epbernard Exp $ package org.hibernate.cfg; import java.util.HashMap; import java.util.Map; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Entity; import javax.persistence.MappedSuperclass; import org.hibernate.reflection.ReflectionManager; import org.hibernate.reflection.XAnnotatedElement; import org.hibernate.reflection.XClass; import org.hibernate.reflection.XProperty; import org.hibernate.util.StringHelper; /** * @author Emmanuel Bernard */ public abstract class AbstractPropertyHolder implements PropertyHolder { private PropertyHolder parent; private Map<String, Column[]> holderColumnOverride; private Map<String, Column[]> currentPropertyColumnOverride; private String path; public AbstractPropertyHolder(String path, PropertyHolder parent, XClass clazzToProcess) { this.path = path; this.parent = parent; this.holderColumnOverride = buildHierarchyColumnOverride( clazzToProcess ); } public String getPath() { return path; } /** * property can be null */ protected void setCurrentProperty(XProperty property) { if (property == null) { this.currentPropertyColumnOverride = null; } else { this.currentPropertyColumnOverride = buildColumnOverride( property, getPath() ); if (this.currentPropertyColumnOverride.size() == 0) { this.currentPropertyColumnOverride = null; } } } /** * Get column overriding, property first, then parent, then holder */ public Column[] getOverriddenColumn(String propertyName) { Column[] override = null; if (override == null && parent != null) { override = parent.getOverriddenColumn( propertyName ); } if (override == null && currentPropertyColumnOverride != null) { override = currentPropertyColumnOverride.get( propertyName ); } if (override == null && holderColumnOverride != null) { override = holderColumnOverride.get( propertyName ); } return override; } private Map<String, Column[]> buildHierarchyColumnOverride(XClass element) { XClass current = element; Map<String, Column[]> columnOverride = new HashMap<String, Column[]>(); while ( current != null && ! ReflectionManager.INSTANCE.toXClass( Object.class ).equals( current ) ) { if ( current.isAnnotationPresent( Entity.class) || current.isAnnotationPresent( MappedSuperclass.class) || current.isAnnotationPresent( Embeddable.class) ) { //FIXME is embeddable override? Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() ); currentOverride.putAll(columnOverride); //subclasses have precedence over superclasses columnOverride = currentOverride; } current = current.getSuperclass(); } return columnOverride.size() > 0 ? columnOverride : null; } private Map<String, Column[]> buildColumnOverride(XAnnotatedElement element, String path) { Map<String, Column[]> columnOverride = new HashMap<String, Column[]>(); if (element == null) return columnOverride; AttributeOverride singleOverride = element.getAnnotation( AttributeOverride.class ); AttributeOverrides multipleOverrides = element.getAnnotation( AttributeOverrides.class ); AttributeOverride[] overrides; if ( singleOverride != null ) { overrides = new AttributeOverride[]{singleOverride}; } else if ( multipleOverrides != null ) { overrides = multipleOverrides.value(); } else { overrides = null; } //fill overriden columns if ( overrides != null ) { for ( AttributeOverride depAttr : overrides ) { columnOverride.put( StringHelper.qualify( path, depAttr.name() ), new Column[]{depAttr.column()} ); } } return columnOverride; } } Index: AnnotationBinder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java,v retrieving revision 1.175 retrieving revision 1.176 diff -u -d -r1.175 -r1.176 --- AnnotationBinder.java 13 Feb 2006 19:14:35 -0000 1.175 +++ AnnotationBinder.java 14 Feb 2006 18:40:31 -0000 1.176 @@ -472,14 +472,13 @@ constraints, inheritanceState.hasDenormalizedTable() ? superEntity.getTable() : null ); } - Map<String, Column[]> columnOverride = PropertyHolderBuilder.buildHierarchyColumnOverride( - clazzToProcess, - persistentClass.getClassName() - ); +// Map<String, Column[]> columnOverride = PropertyHolderBuilder.buildHierarchyColumnOverride( +// clazzToProcess, +// persistentClass.getClassName() +// ); PropertyHolder propertyHolder = PropertyHolderBuilder.buildPropertyHolder( - //clazzToProcess, + clazzToProcess, persistentClass, - columnOverride, entityBinder.getSecondaryTables() ); @@ -592,7 +591,6 @@ propertyHolder, localGenerators, isComponent, - columnOverride, propertyAnnotated, propertyAccessor, entityBinder, null, @@ -609,7 +607,6 @@ propertyAccessor, false, entityBinder, true, - columnOverride, mappings, true ); persistentClass.setIdentifierMapper( mapper ); @@ -1053,7 +1050,6 @@ propertyHolder, localGenerators, isComponent, - columnOverride, propertyAnnotated, propertyAccessor, entityBinder, typeAnn, @@ -1291,12 +1287,8 @@ //if ( embeddableAnn != null && embeddableAnn.access() == AccessType.FIELD ) propertyAccess = false; boolean propertyAnnotated = entityBinder.isPropertyAnnotated( property ); String propertyAccessor = entityBinder.getPropertyAccessor( property ); - Map<String, Column[]> columnOverride = PropertyHolderBuilder.buildColumnOverride( - property, - StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) - ); bindComponent( - inferredData, propertyHolder, propertyAnnotated, propertyAccessor, entityBinder, isIdentifierMapper, columnOverride, + inferredData, propertyHolder, propertyAnnotated, propertyAccessor, entityBinder, isIdentifierMapper, mappings, isComponentEmbedded ); } @@ -1441,11 +1433,11 @@ PropertyHolder propertyHolder, boolean propertyAnnotated, String propertyAccessor, EntityBinder entityBinder, - boolean isIdentifierMapper, Map<String, Column[]> columnOverride, + boolean isIdentifierMapper, ExtendedMappings mappings, boolean isComponentEmbedded ) { Component comp = fillComponent( - propertyHolder, inferredData, propertyAnnotated, propertyAccessor, true, entityBinder, isIdentifierMapper, columnOverride, + propertyHolder, inferredData, propertyAnnotated, propertyAccessor, true, entityBinder, isIdentifierMapper, mappings, isComponentEmbedded ); @@ -1461,7 +1453,7 @@ PropertyHolder propertyHolder, PropertyData inferredData, boolean propertyAnnotated, String propertyAccessor, boolean isNullable, EntityBinder entityBinder, - boolean isIdentifierMapper, Map<String, Column[]> columnOverride, ExtendedMappings mappings, + boolean isIdentifierMapper, ExtendedMappings mappings, boolean isComponentEmbedded ) { Component comp = new Component( propertyHolder.getPersistentClass() ); @@ -1476,9 +1468,10 @@ } String subpath = StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ); log.debug( "Binding component with path: " + subpath ); - Map<String, Column[]> localColumnOverride = propertyHolder.mergeOverridenColumns( columnOverride ); - //TODO work on it - PropertyHolder subHolder = PropertyHolderBuilder.buildPropertyHolder( comp, subpath, localColumnOverride ); + PropertyHolder subHolder = PropertyHolderBuilder.buildPropertyHolder( + comp, subpath, + inferredData, propertyHolder + ); List<PropertyData> classElements = new ArrayList<PropertyData>(); XClass returnedClassOrElement = inferredData.getClassOrElement(); addElementsOfAClass( @@ -1515,7 +1508,6 @@ PropertyData inferredData, Ejb3Column[] columns, PropertyHolder propertyHolder, Map<String, IdGenerator> localGenerators, boolean isComposite, - Map<String, Column[]> columnOverride, boolean isPropertyAnnotated, String propertyAccessor, EntityBinder entityBinder, Type typeAnn, boolean isEmbedded, ExtendedMappings mappings @@ -1535,7 +1527,7 @@ SimpleValue id; if ( isComposite ) { id = fillComponent( - propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, false, columnOverride, mappings, + propertyHolder, inferredData, isPropertyAnnotated, propertyAccessor, false, entityBinder, false, mappings, false ); ( (Component) id ).setKey( true ); Index: ClassPropertyHolder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/ClassPropertyHolder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ClassPropertyHolder.java 27 Oct 2005 02:43:43 -0000 1.11 +++ ClassPropertyHolder.java 14 Feb 2006 18:40:31 -0000 1.12 @@ -3,46 +3,31 @@ import java.util.HashMap; import java.util.Map; -import javax.persistence.Column; +import org.hibernate.mapping.Component; +import org.hibernate.mapping.Join; import org.hibernate.mapping.KeyValue; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Table; -import org.hibernate.mapping.Join; -import org.hibernate.mapping.Component; +import org.hibernate.reflection.XClass; /** * @author Emmanuel Bernard */ -public class ClassPropertyHolder implements PropertyHolder { +public class ClassPropertyHolder extends AbstractPropertyHolder { private PersistentClass persistentClass; - private Map<String, Column[]> columnOverride; private Map<String, Join> joins; private transient Map<String, Join> joinsPerRealTableName; public ClassPropertyHolder( - PersistentClass persistentClass, Map<String, Column[]> columnOverride, Map<String, Join> joins + PersistentClass persistentClass, XClass clazzToProcess, Map<String, Join> joins ) { + super(persistentClass.getEntityName(), null, clazzToProcess); this.persistentClass = persistentClass; - this.columnOverride = columnOverride; this.joins = joins; } - public String getPath() { - return persistentClass.getEntityName(); - } - - public Column[] getOverriddenColumn(String propertyName) { - return columnOverride.get( propertyName ); - } - - public Map<String, Column[]> mergeOverridenColumns(Map<String, Column[]> localColumnOverride) { - Map<String, Column[]> merge = new HashMap<String, Column[]>( localColumnOverride ); - merge.putAll( columnOverride ); - return merge; - } - public String getEntityName() { return persistentClass.getEntityName(); } Index: CollectionPropertyHolder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/CollectionPropertyHolder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CollectionPropertyHolder.java 6 Sep 2005 22:13:36 -0000 1.5 +++ CollectionPropertyHolder.java 14 Feb 2006 18:40:31 -0000 1.6 @@ -1,27 +1,25 @@ //$Id$ package org.hibernate.cfg; -import java.util.HashMap; -import java.util.Map; -import javax.persistence.Column; - import org.hibernate.AssertionFailure; import org.hibernate.mapping.Collection; import org.hibernate.mapping.KeyValue; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Table; +import org.hibernate.reflection.XClass; +import org.hibernate.reflection.XProperty; /** * @author Emmanuel Bernard */ -public class CollectionPropertyHolder implements PropertyHolder { +public class CollectionPropertyHolder extends AbstractPropertyHolder { Collection collection; - private String path; - public CollectionPropertyHolder(Collection collection, String path) { + public CollectionPropertyHolder(Collection collection, String path, XClass clazzToProcess, XProperty property) { + super( path, null, clazzToProcess ); this.collection = collection; - this.path = path; + setCurrentProperty( property ); } public String getClassName() { @@ -48,19 +46,6 @@ return false; } - public String getPath() { - return path; - } - - public Column[] getOverriddenColumn(String propertyName) { - return null; - } - - public Map<String, Column[]> mergeOverridenColumns(Map<String, Column[]> localColumnOverride) { - Map<String, Column[]> columns = new HashMap<String, Column[]>(localColumnOverride); - return columns; - } - public String getEntityName() { return collection.getOwner().getEntityName(); } Index: ComponentPropertyHolder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/ComponentPropertyHolder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ComponentPropertyHolder.java 11 Nov 2005 00:03:10 -0000 1.8 +++ ComponentPropertyHolder.java 14 Feb 2006 18:40:31 -0000 1.9 @@ -1,36 +1,22 @@ //$Id$ package org.hibernate.cfg; -import java.util.HashMap; -import java.util.Map; -import javax.persistence.Column; - +import org.hibernate.AnnotationException; import org.hibernate.mapping.Component; import org.hibernate.mapping.KeyValue; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Table; -import org.hibernate.AnnotationException; /** * Component implementation of property holder * * @author Emmanuel Bernard */ -public class ComponentPropertyHolder implements PropertyHolder { +public class ComponentPropertyHolder extends AbstractPropertyHolder { //TODO introduce a overrideTable() method for columns held by sec table rather than the hack // joinsPerRealTableName in ClassPropertyHolder private Component component; - String path; - private Map<String, Column[]> columnOverride; - - public String getPath() { - return path; - } - - public Column[] getOverriddenColumn(String propertyName) { - return columnOverride.get( propertyName ); - } public String getEntityName() { return component.getComponentClassName(); @@ -56,10 +42,10 @@ addProperty( prop ); } - public ComponentPropertyHolder(Component component, String path, Map<String, Column[]> columnOverride) { + public ComponentPropertyHolder(Component component, String path, PropertyData inferredData, PropertyHolder parent) { + super(path, parent, inferredData.getPropertyClass() ); + setCurrentProperty( inferredData.getProperty() ); this.component = component; - this.path = path; - this.columnOverride = columnOverride; } public String getClassName() { @@ -85,10 +71,4 @@ public boolean isComponent() { return true; } - - public Map<String, Column[]> mergeOverridenColumns(Map<String, Column[]> localColumnOverride) { - Map<String, Column[]> merge = new HashMap<String, Column[]>( localColumnOverride ); - merge.putAll( columnOverride ); - return merge; - } } Index: Ejb3JoinColumn.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/Ejb3JoinColumn.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Ejb3JoinColumn.java 25 Jan 2006 21:48:21 -0000 1.32 +++ Ejb3JoinColumn.java 14 Feb 2006 18:40:31 -0000 1.33 @@ -239,7 +239,8 @@ * Override persistent class on oneToMany Cases for late settings */ public void setPersistentClass(PersistentClass persistentClass, Map<String, Join> joins) { - this.propertyHolder = PropertyHolderBuilder.buildPropertyHolder( persistentClass, joins ); + //FIXME shouldn't we deduce the classname from the persistentclasS? + this.propertyHolder = PropertyHolderBuilder.buildPropertyHolder( null, persistentClass, joins ); } public static void checkIfJoinColumn(Object columns, PropertyHolder holder, PropertyData property) { Index: PropertyHolder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/PropertyHolder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- PropertyHolder.java 6 Sep 2005 22:13:36 -0000 1.8 +++ PropertyHolder.java 14 Feb 2006 18:40:31 -0000 1.9 @@ -1,6 +1,5 @@ package org.hibernate.cfg; -import java.util.Map; import javax.persistence.Column; import org.hibernate.mapping.KeyValue; @@ -33,8 +32,6 @@ */ Column[] getOverriddenColumn(String propertyName); - Map<String, Column[]> mergeOverridenColumns(Map<String, Column[]> localColumnOverride); - String getEntityName(); void addProperty(Property prop, Ejb3Column[] columns); Index: PropertyHolderBuilder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/PropertyHolderBuilder.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- PropertyHolderBuilder.java 13 Feb 2006 18:18:25 -0000 1.10 +++ PropertyHolderBuilder.java 14 Feb 2006 18:40:31 -0000 1.11 @@ -17,6 +17,7 @@ import org.hibernate.reflection.XAnnotatedElement; import org.hibernate.reflection.XClass; import org.hibernate.reflection.ReflectionManager; +import org.hibernate.reflection.XProperty; import org.hibernate.util.StringHelper; /** @@ -29,14 +30,11 @@ } public static PropertyHolder buildPropertyHolder( - //XClass clazzToProcess, - PersistentClass persistentClass, Map<String, Column[]> columnOverride, Map<String, Join> joins + XClass clazzToProcess, + PersistentClass persistentClass, + Map<String, Join> joins ) { -// Map<String, Column[]> columnOverride = PropertyHolderBuilder.buildHierarchyColumnOverride( -// clazzToProcess, -// persistentClass.getClassName() -// ); - return (PropertyHolder) new ClassPropertyHolder( persistentClass, columnOverride, joins ); + return (PropertyHolder) new ClassPropertyHolder( persistentClass, clazzToProcess, joins ); } /** @@ -47,20 +45,20 @@ * @return PropertyHolder */ public static PropertyHolder buildPropertyHolder( - Component component, String path, Map<String, Column[]> columnOverride + Component component, String path, PropertyData inferredData, PropertyHolder parent ) { - return (PropertyHolder) new ComponentPropertyHolder( component, path, columnOverride ); + return (PropertyHolder) new ComponentPropertyHolder( component, path, inferredData, parent ); } /** * buid a property holder on top of a collection */ - public static PropertyHolder buildPropertyHolder(Collection collection, String path) { - return new CollectionPropertyHolder( collection, path ); + public static PropertyHolder buildPropertyHolder(Collection collection, String path, XClass clazzToProcess, XProperty property) { + return new CollectionPropertyHolder( collection, path, clazzToProcess, property); } public static PropertyHolder buildPropertyHolder(PersistentClass persistentClass, Map<String, Join> joins) { - return buildPropertyHolder( persistentClass, new HashMap<String, Column[]>(), joins ); + return buildPropertyHolder( null, persistentClass, joins ); } public static Map<String, Column[]> buildHierarchyColumnOverride(XClass element, String path) { @@ -70,7 +68,7 @@ if ( current.isAnnotationPresent(Entity.class) || current.isAnnotationPresent(MappedSuperclass.class) || current.isAnnotationPresent(Embeddable.class) ) { //FIXME is embeddable override? - Map<String, Column[]> currentOverride = buildColumnOverride( element, path ); + Map<String, Column[]> currentOverride = buildColumnOverride( current, path ); currentOverride.putAll(columnOverride); //subclasses have precedence over superclasses columnOverride = currentOverride; } Index: PropertyPreloadedData.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/PropertyPreloadedData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PropertyPreloadedData.java 13 Feb 2006 19:14:35 -0000 1.2 +++ PropertyPreloadedData.java 14 Feb 2006 18:40:31 -0000 1.3 @@ -43,6 +43,6 @@ } public XProperty getProperty() { - throw new UnsupportedOperationException(); + return null; //instead of UnsupportedOperationException } } |
From: <epb...@us...> - 2006-02-14 18:40:39
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/embedded In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7473/metadata/src/test/org/hibernate/test/annotations/embedded Modified Files: Deal.java SpreadDeal.java Added Files: NotonialDeal.java Log Message: ANN-240 complete rework to embed overriding mechanism inside property holder --- NEW FILE: NotonialDeal.java --- //$Id: NotonialDeal.java,v 1.1 2006/02/14 18:40:31 epbernard Exp $ package org.hibernate.test.annotations.embedded; import javax.persistence.AttributeOverrides; import javax.persistence.AttributeOverride; import javax.persistence.Column; import javax.persistence.MappedSuperclass; /** * @author Emmanuel Bernard */ @AttributeOverrides(value={ @AttributeOverride(name="swap.tenor", column=@Column(name="TENOR")), //should be ovvriden by deal @AttributeOverride(name="id", column=@Column(name="NOTONIALDEAL_ID")) }) @MappedSuperclass public class NotonialDeal extends Deal { /** * Notional amount of both IRSs. */ private double notional; public double getNotional() { return notional; } public void setNotional(double notional) { this.notional = notional; } } Index: Deal.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/embedded/Deal.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Deal.java 5 Jan 2006 13:49:51 -0000 1.4 +++ Deal.java 14 Feb 2006 18:40:31 -0000 1.5 @@ -15,19 +15,6 @@ */ private String id; - /** - * Notional amount of both IRSs. - */ - private double notional; - - public double getNotional() { - return notional; - } - - public void setNotional(double notional) { - this.notional = notional; - } - @Id public String getId() { return id; Index: SpreadDeal.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/test/org/hibernate/test/annotations/embedded/SpreadDeal.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SpreadDeal.java 2 Sep 2005 17:23:15 -0000 1.1 +++ SpreadDeal.java 14 Feb 2006 18:40:31 -0000 1.2 @@ -20,7 +20,7 @@ @AttributeOverride(name="swap.floatLeg.rateIndex", column=@Column(name="MEDIUM_FLOAT_RATEINDEX")), @AttributeOverride(name="swap.floatLeg.rateSpread", column=@Column(name="MEDIUM_FLOAT_RATESPREAD")) }) -public class SpreadDeal extends Deal { +public class SpreadDeal extends NotonialDeal { /** * Swap with the tenor. |
From: <epb...@us...> - 2006-02-14 18:40:38
|
Update of /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7473/metadata/src/java/org/hibernate/cfg/annotations Modified Files: CollectionBinder.java ListBinder.java Log Message: ANN-240 complete rework to embed overriding mechanism inside property holder Index: CollectionBinder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- CollectionBinder.java 13 Feb 2006 19:14:35 -0000 1.33 +++ CollectionBinder.java 14 Feb 2006 18:40:31 -0000 1.34 @@ -10,6 +10,8 @@ import javax.persistence.Embeddable; import javax.persistence.FetchType; import javax.persistence.MapKey; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -775,13 +777,11 @@ else { XClass elementClass; AnnotatedClassType classType; - PropertyHolder holder = PropertyHolderBuilder.buildPropertyHolder( - collValue, - collValue.getRole() - ); - Map<String, javax.persistence.Column[]> columnOverrides = PropertyHolderBuilder.buildColumnOverride( - property, StringHelper.qualify( holder.getPath(), "element" ) - ); +// Map<String, javax.persistence.Column[]> columnOverrides = PropertyHolderBuilder.buildColumnOverride( +// property, StringHelper.qualify( collValue.getRole(), "element" ) +// ); + //FIXME the "element" is lost + PropertyHolder holder = null; if ( BinderHelper.PRIMITIVE_NAMES.contains( collType ) ) { classType = AnnotatedClassType.NONE; elementClass = null; @@ -794,8 +794,17 @@ throw new AnnotationException( "Unable to find class: " + collType, e ); } classType = mappings.getClassType( elementClass ); + + holder = PropertyHolderBuilder.buildPropertyHolder( + collValue, + collValue.getRole(), + elementClass, + property + ); //force in case of attribute override - if ( isEmbedded || ( columnOverrides != null && ! columnOverrides.isEmpty() ) ) { + boolean attributeOverride = property.isAnnotationPresent(AttributeOverride.class) + || property.isAnnotationPresent( AttributeOverrides.class); + if ( isEmbedded || attributeOverride ) { classType = AnnotatedClassType.EMBEDDABLE; } } @@ -825,7 +834,7 @@ Component component = AnnotationBinder.fillComponent( holder, inferredData, isPropertyAnnotated, isPropertyAnnotated ? "property" : "field", true, entityBinder, false, - columnOverrides, mappings, false + mappings, false ); collValue.setElement( component ); } Index: ListBinder.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ListBinder.java 25 Jan 2006 21:48:20 -0000 1.22 +++ ListBinder.java 14 Feb 2006 18:40:31 -0000 1.23 @@ -24,6 +24,7 @@ import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.SimpleValue; import org.hibernate.reflection.XProperty; +import org.hibernate.reflection.XClass; /** * Bind a list @@ -75,7 +76,9 @@ if ( indexColumn.isImplicit() == false ) { PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder( this.collection, - IndexedCollection.DEFAULT_INDEX_COLUMN_NAME + IndexedCollection.DEFAULT_INDEX_COLUMN_NAME, + (XClass) null, + (XProperty) null ); List list = (List) this.collection; if ( ! list.isOneToMany() ) indexColumn.forceNotNull(); |