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: <one...@us...> - 2003-02-11 11:22:45
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv6707/hibernate/sql Modified Files: PostgreSQLDialect.java Log Message: added mappings for BLOB + CLOB Index: PostgreSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/sql/PostgreSQLDialect.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PostgreSQLDialect.java 24 Dec 2002 13:45:38 -0000 1.19 --- PostgreSQLDialect.java 11 Feb 2003 11:22:42 -0000 1.20 *************** *** 26,29 **** --- 26,31 ---- register( Types.TIMESTAMP, "TIMESTAMP" ); register( Types.VARBINARY, "BYTEA" ); + register( Types.CLOB, "TEXT" ); + register( Types.BLOB, "BYTEA" ); register( Types.NUMERIC, "NUMERIC" ); |
From: <one...@us...> - 2003-02-11 11:22:08
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect In directory sc8-pr-cvs1:/tmp/cvs-serv6343/hibernate/dialect Modified Files: PostgreSQLDialect.java Log Message: added mappings for BLOB + CLOB Index: PostgreSQLDialect.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/dialect/PostgreSQLDialect.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PostgreSQLDialect.java 26 Jan 2003 01:33:35 -0000 1.5 --- PostgreSQLDialect.java 11 Feb 2003 11:22:02 -0000 1.6 *************** *** 26,29 **** --- 26,31 ---- register( Types.TIMESTAMP, "TIMESTAMP" ); register( Types.VARBINARY, "BYTEA" ); + register( Types.CLOB, "TEXT" ); + register( Types.BLOB, "BYTEA" ); register( Types.NUMERIC, "NUMERIC" ); |
From: <one...@us...> - 2003-02-09 08:24:25
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools In directory sc8-pr-cvs1:/tmp/cvs-serv6459 Modified Files: SchemaUpdater.java Log Message: added setAutocommit() call Index: SchemaUpdater.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/tools/SchemaUpdater.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SchemaUpdater.java 24 Jan 2003 13:44:16 -0000 1.4 --- SchemaUpdater.java 9 Feb 2003 08:24:22 -0000 1.5 *************** *** 84,87 **** --- 84,89 ---- Connection connection = cp.getConnection(); + connection.commit(); + connection.setAutoCommit(true); JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect); Statement stmt; |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv24981/collection Modified Files: ArrayHolder.java Bag.java CollectionPersister.java List.java Map.java Set.java SortedMap.java SortedSet.java Log Message: fixed problem where <parent> was not being set after retrieval from cache Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ArrayHolder.java 9 Feb 2003 06:28:14 -0000 1.7 --- ArrayHolder.java 9 Feb 2003 07:41:15 -0000 1.8 *************** *** 172,176 **** ! public ArrayHolder(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { super(session); --- 172,176 ---- ! public ArrayHolder(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); *************** *** 180,184 **** for ( int i=0; i<cached.length; i++ ) { ! Array.set(array, i, persister.getElementType().assemble(cached[i], session, null) ); } --- 180,184 ---- for ( int i=0; i<cached.length; i++ ) { ! Array.set(array, i, persister.getElementType().assemble(cached[i], session, owner) ); } Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Bag.java 9 Feb 2003 06:28:14 -0000 1.6 --- Bag.java 9 Feb 2003 07:41:15 -0000 1.7 *************** *** 159,163 **** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ ! public Bag(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { super(session); --- 159,163 ---- * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ ! public Bag(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); *************** *** 165,169 **** Serializable[] array = (Serializable[]) disassembled; for ( int i=0; i<array.length; i++ ) { ! bag.add( persister.getElementType().assemble( array[i], session, null ) ); //TODO: fix the null!!! } initialized=true; --- 165,169 ---- Serializable[] array = (Serializable[]) disassembled; for ( int i=0; i<array.length; i++ ) { ! bag.add( persister.getElementType().assemble( array[i], session, owner ) ); } initialized=true; Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CollectionPersister.java 9 Feb 2003 06:28:14 -0000 1.9 --- CollectionPersister.java 9 Feb 2003 07:41:15 -0000 1.10 *************** *** 214,218 **** } ! public PersistentCollection getCachedCollection(Serializable id, SessionImplementor s) throws HibernateException, SQLException { if (cache==null) { return null; --- 214,218 ---- } ! public PersistentCollection getCachedCollection(Serializable id, Object owner, SessionImplementor s) throws HibernateException, SQLException { if (cache==null) { return null; *************** *** 224,228 **** } else { ! return collectionType.assembleCachedCollection(s, this, cached); } } --- 224,228 ---- } else { ! return collectionType.assembleCachedCollection(s, this, cached, owner); } } Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** List.java 9 Feb 2003 06:28:14 -0000 1.7 --- List.java 9 Feb 2003 07:41:15 -0000 1.8 *************** *** 316,320 **** } ! public List(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { super(session); --- 316,320 ---- } ! public List(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); *************** *** 322,326 **** Serializable[] array = (Serializable[]) disassembled; for ( int i=0; i<array.length; i++ ) { ! list.add( persister.getElementType().assemble( array[i], session, null ) ); //TODO: fix the null!!! } initialized=true; --- 322,326 ---- Serializable[] array = (Serializable[]) disassembled; for ( int i=0; i<array.length; i++ ) { ! list.add( persister.getElementType().assemble( array[i], session, owner ) ); } initialized=true; Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Map.java 9 Feb 2003 06:28:14 -0000 1.7 --- Map.java 9 Feb 2003 07:41:15 -0000 1.8 *************** *** 308,312 **** } ! public Map(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { super(session); --- 308,312 ---- } ! public Map(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); *************** *** 314,319 **** Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i+=2 ) map.put( ! persister.getIndexType().assemble( array[i], session, null ), ! persister.getElementType().assemble( array[i+1], session, null ) //TODO: fix the null!!!! ); initialized = true; --- 314,319 ---- Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i+=2 ) map.put( ! persister.getIndexType().assemble( array[i], session, owner ), ! persister.getElementType().assemble( array[i+1], session, owner ) //TODO: fix the null!!!! ); initialized = true; Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Set.java 9 Feb 2003 06:28:14 -0000 1.6 --- Set.java 9 Feb 2003 07:41:15 -0000 1.7 *************** *** 78,87 **** initialized = true; } ! public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { super(session); beforeInitialize(persister); Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i++ ) set.add( ! persister.getElementType().assemble( array[i], session, null ) //TODO: fix the null!!!! ); initialized = true; --- 78,87 ---- initialized = true; } ! public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); beforeInitialize(persister); Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i++ ) set.add( ! persister.getElementType().assemble( array[i], session, owner ) ); initialized = true; Index: SortedMap.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedMap.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SortedMap.java 9 Feb 2003 06:28:14 -0000 1.5 --- SortedMap.java 9 Feb 2003 07:41:15 -0000 1.6 *************** *** 38,42 **** } ! public SortedMap(SessionImplementor session, CollectionPersister persister, Comparator comparator, Serializable disassembled) throws HibernateException, SQLException { super(session); --- 38,42 ---- } ! public SortedMap(SessionImplementor session, CollectionPersister persister, Comparator comparator, Serializable disassembled, Object owner) throws HibernateException, SQLException { super(session); *************** *** 45,50 **** Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i+=2 ) map.put( ! persister.getIndexType().assemble( array[i], session, null ), ! persister.getElementType().assemble( array[i+1], session, null ) //TODO: fix the null!!!! ); initialized = true; --- 45,50 ---- Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i+=2 ) map.put( ! persister.getIndexType().assemble( array[i], session, owner ), ! persister.getElementType().assemble( array[i+1], session, owner ) ); initialized = true; Index: SortedSet.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SortedSet.java 9 Feb 2003 06:28:14 -0000 1.5 --- SortedSet.java 9 Feb 2003 07:41:15 -0000 1.6 *************** *** 136,140 **** CollectionPersister persister, Comparator comparator, ! Serializable disassembled) throws HibernateException, SQLException { --- 136,141 ---- CollectionPersister persister, Comparator comparator, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { *************** *** 144,148 **** Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i++ ) set.add( ! persister.getElementType().assemble( array[i], session, null ) //TODO: fix the null!!!! ); initialized = true; --- 145,149 ---- Serializable[] array = (Serializable[]) disassembled; for (int i=0; i<array.length; i++ ) set.add( ! persister.getElementType().assemble( array[i], session, owner ) ); initialized = true; |
From: <one...@us...> - 2003-02-09 07:41:28
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv24981/type Modified Files: AbstractType.java ArrayType.java BagType.java EntityType.java ListType.java ManyToOneType.java MapType.java OneToOneType.java PersistentCollectionType.java SetType.java SortedMapType.java SortedSetType.java Type.java Log Message: fixed problem where <parent> was not being set after retrieval from cache Index: AbstractType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/AbstractType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractType.java 2 Feb 2003 04:19:52 -0000 1.5 --- AbstractType.java 9 Feb 2003 07:41:16 -0000 1.6 *************** *** 65,69 **** } ! public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException { return value; --- 65,69 ---- } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException { return value; Index: ArrayType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ArrayType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ArrayType.java 9 Feb 2003 06:28:16 -0000 1.6 --- ArrayType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 65,72 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new ArrayHolder(session, persister, disassembled); } --- 65,73 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new ArrayHolder(session, persister, disassembled, owner); } Index: BagType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BagType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BagType.java 9 Feb 2003 06:28:16 -0000 1.6 --- BagType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 36,43 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new Bag(session, persister, disassembled); } --- 36,44 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new Bag(session, persister, disassembled, owner); } Index: EntityType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/EntityType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EntityType.java 2 Feb 2003 04:19:52 -0000 1.5 --- EntityType.java 9 Feb 2003 07:41:16 -0000 1.6 *************** *** 103,107 **** public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier(oid, session); } --- 103,107 ---- public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier(oid, session, owner); } *************** *** 115,119 **** public final Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier( hydrate(rs, names, session, owner), session ); } --- 115,119 ---- public final Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier( hydrate(rs, names, session, owner), session, owner ); } Index: ListType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ListType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ListType.java 9 Feb 2003 06:28:16 -0000 1.6 --- ListType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 32,39 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new List(session, persister, disassembled); } --- 32,40 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new List(session, persister, disassembled, owner); } Index: ManyToOneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ManyToOneType.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ManyToOneType.java 5 Jan 2003 02:11:24 -0000 1.3 --- ManyToOneType.java 9 Feb 2003 07:41:16 -0000 1.4 *************** *** 54,58 **** } ! public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException { --- 54,58 ---- } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException { Index: MapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/MapType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MapType.java 9 Feb 2003 06:28:16 -0000 1.6 --- MapType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 38,45 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new Map(session, persister, disassembled); } --- 38,46 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new Map(session, persister, disassembled, owner); } Index: OneToOneType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/OneToOneType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OneToOneType.java 2 Feb 2003 04:19:52 -0000 1.5 --- OneToOneType.java 9 Feb 2003 07:41:16 -0000 1.6 *************** *** 62,66 **** } ! public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException { if (value==null) return null; --- 62,66 ---- } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException { if (value==null) return null; Index: PersistentCollectionType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/PersistentCollectionType.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PersistentCollectionType.java 9 Feb 2003 06:28:16 -0000 1.7 --- PersistentCollectionType.java 9 Feb 2003 07:41:16 -0000 1.8 *************** *** 46,57 **** public Object nullSafeGet(ResultSet rs, String[] name, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier( hydrate(rs, name, session, owner), session ); } ! public Object getCollection(Serializable id, SessionImplementor session) throws HibernateException, SQLException { CollectionPersister persister = session.getFactory().getCollectionPersister(role); ! PersistentCollection collection = persister.getCachedCollection(id, session); if (collection!=null) { session.addInitializedCollection(collection, persister, id); --- 46,57 ---- public Object nullSafeGet(ResultSet rs, String[] name, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier( hydrate(rs, name, session, owner), session, owner ); } ! public Object getCollection(Serializable id, Object owner, SessionImplementor session) throws HibernateException, SQLException { CollectionPersister persister = session.getFactory().getCollectionPersister(role); ! PersistentCollection collection = persister.getCachedCollection(id, owner, session); if (collection!=null) { session.addInitializedCollection(collection, persister, id); *************** *** 111,115 **** public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier(cached, session); } --- 111,115 ---- public Object assemble(Serializable cached, SessionImplementor session, Object owner) throws HibernateException, SQLException { ! return resolveIdentifier(cached, session, owner); } *************** *** 154,158 **** } ! public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException { --- 154,158 ---- } ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException { *************** *** 161,165 **** } else { ! return getCollection( (Serializable) value, session); } } --- 161,165 ---- } else { ! return getCollection( (Serializable) value, owner, session); } } *************** *** 172,176 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException; } --- 172,177 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException; } Index: SetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SetType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SetType.java 9 Feb 2003 06:28:16 -0000 1.6 --- SetType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 32,38 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new Set(session, persister, disassembled); } --- 32,39 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new Set(session, persister, disassembled, owner); } Index: SortedMapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedMapType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SortedMapType.java 9 Feb 2003 06:28:16 -0000 1.6 --- SortedMapType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 39,46 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new SortedMap(session, persister, comparator, disassembled); } --- 39,47 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new SortedMap(session, persister, comparator, disassembled, owner); } Index: SortedSetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedSetType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SortedSetType.java 9 Feb 2003 06:28:16 -0000 1.6 --- SortedSetType.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 39,45 **** SessionImplementor session, CollectionPersister persister, ! Serializable disassembled) throws HibernateException, SQLException { ! return new SortedSet(session, persister, comparator, disassembled); } --- 39,46 ---- SessionImplementor session, CollectionPersister persister, ! Serializable disassembled, ! Object owner) throws HibernateException, SQLException { ! return new SortedSet(session, persister, comparator, disassembled, owner); } Index: Type.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/Type.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Type.java 2 Feb 2003 04:19:52 -0000 1.6 --- Type.java 9 Feb 2003 07:41:16 -0000 1.7 *************** *** 222,225 **** --- 222,226 ---- * @see Type#hydrate(ResultSet, String[], SessionImplementor, Object) * @param value an identifier or value returned by <tt>hydrate()</tt> + * @param owner the parent entity * @param session the session * @return the given value, or the value associated with the identifier *************** *** 227,231 **** * @throws SQLException */ ! public Object resolveIdentifier(Object value, SessionImplementor session) throws HibernateException, SQLException; } --- 228,232 ---- * @throws SQLException */ ! public Object resolveIdentifier(Object value, SessionImplementor session, Object owner) throws HibernateException, SQLException; } |
From: <one...@us...> - 2003-02-09 07:41:28
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv24981/impl Modified Files: SessionImpl.java Log Message: fixed problem where <parent> was not being set after retrieval from cache Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SessionImpl.java 9 Feb 2003 06:28:15 -0000 1.18 --- SessionImpl.java 9 Feb 2003 07:41:15 -0000 1.19 *************** *** 1775,1779 **** for ( int i=0; i<hydratedState.length; i++ ) { ! hydratedState[i] = types[i].resolveIdentifier( hydratedState[i], this ); } persister.setPropertyValues(object, hydratedState); --- 1775,1779 ---- for ( int i=0; i<hydratedState.length; i++ ) { ! hydratedState[i] = types[i].resolveIdentifier( hydratedState[i], this, object ); } persister.setPropertyValues(object, hydratedState); |
From: <one...@us...> - 2003-02-09 06:48:13
|
Update of /cvsroot/hibernate/Hibernate2/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9330 Added Files: dom4j.jar Log Message: added dom4j --- NEW FILE: dom4j.jar --- (This appears to be a binary file; contents omitted.) |
From: <one...@us...> - 2003-02-09 06:36:08
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv6948/hibernate/test Added Files: CompositeElement.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly --- NEW FILE: CompositeElement.java --- package net.sf.hibernate.test; import java.io.Serializable; /** * @author Administrator * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class CompositeElement implements Comparable, Serializable { private String foo; private String bar; /** * Returns the bar. * @return String */ public String getBar() { return bar; } /** * Returns the foo. * @return String */ public String getFoo() { return foo; } /** * Sets the bar. * @param bar The bar to set */ public void setBar(String bar) { this.bar = bar; } /** * Sets the foo. * @param foo The foo to set */ public void setFoo(String foo) { this.foo = foo; } /** * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Object o) { return ( (CompositeElement) o ).foo.compareTo(foo); } } |
From: <one...@us...> - 2003-02-09 06:28:47
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/collection Modified Files: ArrayHolder.java Bag.java CollectionPersister.java List.java Map.java ODMGCollection.java PersistentCollection.java Set.java SortedMap.java SortedSet.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: ArrayHolder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ArrayHolder.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ArrayHolder.java 2 Feb 2003 04:19:51 -0000 1.6 --- ArrayHolder.java 9 Feb 2003 06:28:14 -0000 1.7 *************** *** 172,184 **** ! public void assemble(CollectionPersister persister) throws HibernateException, SQLException { ! ! Object[] cached = (Object[]) array; array = Array.newInstance( persister.getElementClass(), cached.length ); for ( int i=0; i<cached.length; i++ ) { ! Array.set(array, i, persister.getElementType().assemble( (Serializable) cached[i], session, null) ); } --- 172,184 ---- ! public ArrayHolder(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { ! super(session); ! Serializable[] cached = (Serializable[]) disassembled; array = Array.newInstance( persister.getElementClass(), cached.length ); for ( int i=0; i<cached.length; i++ ) { ! Array.set(array, i, persister.getElementType().assemble(cached[i], session, null) ); } *************** *** 188,192 **** int length = temp.size(); ! Object[] result = new Object[length]; for ( int i=0; i<length; i++ ) { result[i] = persister.getElementType().disassemble( temp.get(i), session ); --- 188,192 ---- int length = temp.size(); ! Serializable[] result = new Serializable[length]; for ( int i=0; i<length; i++ ) { result[i] = persister.getElementType().disassemble( temp.get(i), session ); Index: Bag.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Bag.java 5 Jan 2003 02:11:20 -0000 1.5 --- Bag.java 9 Feb 2003 06:28:14 -0000 1.6 *************** *** 149,155 **** int length = bag.size(); ! ArrayList result = new ArrayList(length); for ( int i=0; i<length; i++ ) { ! result.add( persister.getElementType().disassemble( bag.get(i), session ) ); } return result; --- 149,155 ---- int length = bag.size(); ! Serializable[] result = new Serializable[length]; for ( int i=0; i<length; i++ ) { ! result[i] = persister.getElementType().disassemble( bag.get(i), session ); } return result; *************** *** 159,170 **** * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ ! public void assemble(CollectionPersister persister) throws HibernateException, SQLException { ! int length = bag.size(); ! java.util.List old = bag; beforeInitialize(persister); ! for ( int i=0; i<length; i++ ) { ! bag.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } } --- 159,171 ---- * @see net.sf.hibernate.collections.PersistentCollection#assemble(CollectionPersister, SessionImplementor) */ ! public Bag(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { ! super(session); beforeInitialize(persister); ! Serializable[] array = (Serializable[]) disassembled; ! for ( int i=0; i<array.length; i++ ) { ! bag.add( persister.getElementType().assemble( array[i], session, null ) ); //TODO: fix the null!!! } + initialized=true; } *************** *** 306,312 **** throw new UnsupportedOperationException("Bags don't have indexes"); } - - public Bag() {} - public DBag difference(DBag arg0) { --- 307,310 ---- Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CollectionPersister.java 30 Jan 2003 13:02:29 -0000 1.8 --- CollectionPersister.java 9 Feb 2003 06:28:14 -0000 1.9 *************** *** 2,7 **** package net.sf.hibernate.collection; - import java.io.InvalidObjectException; - import java.io.ObjectStreamException; import java.io.Serializable; import java.sql.PreparedStatement; --- 2,5 ---- *************** *** 50,91 **** */ ! public final class CollectionPersister implements Serializable, CollectionMetadata { ! private transient final String sqlSelectString; ! private transient final String sqlDeleteString; ! //private transient final String sqlSelectRowString; ! private transient final String sqlInsertRowString; ! private transient final String sqlUpdateRowString; ! private transient final String sqlDeleteRowString; ! private transient final String sqlOrderByString; ! private transient final boolean hasOrder; ! private transient final boolean isSet; ! private transient final Type keyType; ! private transient final Type indexType; ! private transient final Type elementType; ! private transient final String[] keyColumnNames; ! private transient final String[] indexColumnNames; ! private transient final String[] unquotedIndexColumnNames; ! private transient final String[] elementColumnNames; ! private transient final String[] unquotedElementColumnNames; ! private transient final String[] rowSelectColumnNames; ! private transient final Type rowSelectType; ! private transient final boolean primitiveArray; ! private transient final boolean array; ! private transient final boolean isOneToMany; ! private transient final String qualifiedTableName; ! private transient final boolean hasIndex; ! private transient final boolean isLazy; ! private transient final boolean isInverse; ! private transient final Class elementClass; ! private transient final CacheConcurrencyStrategy cache; ! private transient final PersistentCollectionType collectionType; ! private transient final int enableJoinedFetch; ! private transient final Class ownerClass; ! private transient final CollectionInitializer loader; private final String role; ! private final SessionFactoryImplementor factory; private static final Log log = LogFactory.getLog(CollectionPersister.class); --- 48,88 ---- */ ! public final class CollectionPersister implements CollectionMetadata { ! private final String sqlSelectString; ! private final String sqlDeleteString; ! private final String sqlInsertRowString; ! private final String sqlUpdateRowString; ! private final String sqlDeleteRowString; ! private final String sqlOrderByString; ! private final boolean hasOrder; ! private final boolean isSet; ! private final Type keyType; ! private final Type indexType; ! private final Type elementType; ! private final String[] keyColumnNames; ! private final String[] indexColumnNames; ! private final String[] unquotedIndexColumnNames; ! private final String[] elementColumnNames; ! private final String[] unquotedElementColumnNames; ! private final String[] rowSelectColumnNames; ! private final Type rowSelectType; ! private final boolean primitiveArray; ! private final boolean array; ! private final boolean isOneToMany; ! private final String qualifiedTableName; ! private final boolean hasIndex; ! private final boolean isLazy; ! private final boolean isInverse; ! private final Class elementClass; ! private final CacheConcurrencyStrategy cache; ! private final PersistentCollectionType collectionType; ! private final int enableJoinedFetch; ! private final Class ownerClass; ! private final CollectionInitializer loader; private final String role; ! //private final SessionFactoryImplementor factory; private static final Log log = LogFactory.getLog(CollectionPersister.class); *************** *** 97,101 **** role = collection.getRole(); ownerClass = collection.getOwnerClass(); - this.factory = factory; hasOrder = collection.getOrderByString()!=null; --- 94,97 ---- *************** *** 213,217 **** public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { ! if (cache!=null) cache.put( id, coll.disassemble(this), s.getTimestamp() ); } --- 209,215 ---- public void cache(Serializable id, PersistentCollection coll, SessionImplementor s) throws HibernateException { ! if (cache!=null) { ! cache.put( id, coll.disassemble(this), s.getTimestamp() ); ! } } *************** *** 226,232 **** } else { ! PersistentCollection coll = collectionType.wrap(s, cached); ! coll.assemble(this); ! return coll; } } --- 224,228 ---- } else { ! return collectionType.assembleCachedCollection(s, this, cached); } } *************** *** 656,668 **** public String getRole() { return role; - } - - Object readResolve() throws ObjectStreamException { - try { - return factory.getCollectionPersister(role); - } - catch (MappingException me) { - throw new InvalidObjectException( me.getMessage() ); - } } --- 652,655 ---- Index: List.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** List.java 2 Feb 2003 04:19:51 -0000 1.6 --- List.java 9 Feb 2003 06:28:14 -0000 1.7 *************** *** 315,340 **** } } ! public void assemble(CollectionPersister persister) throws HibernateException, SQLException { ! ! int length = list.size(); ! java.util.List old = list; beforeInitialize(persister); ! for ( int i=0; i<length; i++ ) { ! list.add( persister.getElementType().assemble( (Serializable) old.get(i), session, null ) ); } ! } ! public Serializable disassemble(CollectionPersister persister) throws HibernateException { int length = list.size(); ! ArrayList result = new ArrayList(length); for ( int i=0; i<length; i++ ) { ! result.add( persister.getElementType().disassemble( list.get(i), session ) ); } return result; - } public Iterator getDeletes(Type elemType) throws HibernateException { --- 315,341 ---- } } ! ! public List(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { ! super(session); beforeInitialize(persister); ! Serializable[] array = (Serializable[]) disassembled; ! for ( int i=0; i<array.length; i++ ) { ! list.add( persister.getElementType().assemble( array[i], session, null ) ); //TODO: fix the null!!! } ! initialized=true; } ! public Serializable disassemble(CollectionPersister persister) ! throws HibernateException { int length = list.size(); ! Serializable[] result = new Serializable[length]; for ( int i=0; i<length; i++ ) { ! result[i] = persister.getElementType().disassemble( list.get(i), session ); } return result; } + public Iterator getDeletes(Type elemType) throws HibernateException { *************** *** 362,367 **** return new Integer(i); } - - public List() {} /** --- 363,366 ---- Index: Map.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Map.java 2 Feb 2003 04:19:51 -0000 1.6 --- Map.java 9 Feb 2003 06:28:14 -0000 1.7 *************** *** 308,337 **** } ! public void assemble(CollectionPersister persister) throws HibernateException, SQLException { ! ! java.util.Map old = map; beforeInitialize(persister); ! Iterator iter = old.entrySet().iterator(); ! while ( iter.hasNext() ) { ! java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! map.put( ! persister.getIndexType().assemble( (Serializable) e.getKey(), session, null), ! persister.getElementType().assemble( (Serializable) e.getValue(), session, null ) ! ); ! } ! } public Serializable disassemble(CollectionPersister persister) throws HibernateException { ! HashMap result = new HashMap(); Iterator iter = map.entrySet().iterator(); while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result.put( ! persister.getIndexType().disassemble( e.getKey(), session ), ! persister.getElementType().disassemble( e.getValue(), session ) ! ); } return result; --- 308,332 ---- } ! public Map(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { ! super(session); beforeInitialize(persister); ! Serializable[] array = (Serializable[]) disassembled; ! for (int i=0; i<array.length; i+=2 ) map.put( ! persister.getIndexType().assemble( array[i], session, null ), ! persister.getElementType().assemble( array[i+1], session, null ) //TODO: fix the null!!!! ! ); ! initialized = true; } public Serializable disassemble(CollectionPersister persister) throws HibernateException { ! Serializable[] result = new Serializable[ map.size() * 2 ]; Iterator iter = map.entrySet().iterator(); + int i=0; while ( iter.hasNext() ) { java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); ! result[i++] = persister.getIndexType().disassemble( e.getKey(), session); ! result[i++] = persister.getElementType().disassemble( e.getValue(), session ); } return result; *************** *** 366,371 **** return ( (java.util.Map.Entry) entry ).getKey(); } - - public Map() {} public boolean equals(Object other) { --- 361,364 ---- Index: ODMGCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ODMGCollection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ODMGCollection.java 28 Jan 2003 10:22:19 -0000 1.6 --- ODMGCollection.java 9 Feb 2003 06:28:14 -0000 1.7 *************** *** 21,31 **** /** - * Constructor for ODMGCollection. - */ - public ODMGCollection() { - super(); - } - - /** * @see org.odmg.DCollection#existsElement(String) */ --- 21,24 ---- Index: PersistentCollection.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/PersistentCollection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PersistentCollection.java 30 Jan 2003 13:02:30 -0000 1.6 --- PersistentCollection.java 9 Feb 2003 06:28:14 -0000 1.7 *************** *** 174,178 **** public abstract Serializable disassemble(CollectionPersister persister) throws HibernateException; - public abstract void assemble(CollectionPersister persister) throws HibernateException, SQLException; public boolean needsRecreate(Type elemType) throws HibernateException { --- 174,177 ---- *************** *** 519,524 **** } - - public PersistentCollection() {} /** --- 518,521 ---- Index: Set.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Set.java 5 Jan 2003 02:11:20 -0000 1.5 --- Set.java 9 Feb 2003 06:28:14 -0000 1.6 *************** *** 78,81 **** --- 78,90 ---- initialized = true; } + public Set(SessionImplementor session, CollectionPersister persister, Serializable disassembled) throws HibernateException, SQLException { + super(session); + beforeInitialize(persister); + Serializable[] array = (Serializable[]) disassembled; + for (int i=0; i<array.length; i++ ) set.add( + persister.getElementType().assemble( array[i], session, null ) //TODO: fix the null!!!! + ); + initialized = true; + } /** *************** *** 243,271 **** } - - public void assemble(CollectionPersister persister) - throws HibernateException, SQLException { - - java.util.Set old = set; - beforeInitialize(persister); - Iterator iter = old.iterator(); - while ( iter.hasNext() ) set.add( - persister.getElementType().assemble( (Serializable) iter.next(), session, null ) - ); - - } - public Serializable disassemble(CollectionPersister persister) throws HibernateException { ! HashSet result = new HashSet(); Iterator iter = set.iterator(); ! while ( iter.hasNext() ) result.add( ! persister.getElementType().disassemble( iter.next(), session ) ! ); return result; ! } ! public Iterator getDeletes(Type elemType) throws HibernateException { --- 252,267 ---- } public Serializable disassemble(CollectionPersister persister) throws HibernateException { ! Serializable[] result = new Serializable[ set.size() ]; Iterator iter = set.iterator(); ! int i=0; ! while ( iter.hasNext() ) { ! result[i++] = persister.getElementType().disassemble( iter.next(), session ); ! } return result; ! } public Iterator getDeletes(Type elemType) throws HibernateException { *************** *** 319,324 **** throw new UnsupportedOperationException("Sets don't have indexes"); } - - public Set() {} /** --- 315,318 ---- Index: SortedMap.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedMap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SortedMap.java 5 Jan 2003 02:11:20 -0000 1.4 --- SortedMap.java 9 Feb 2003 06:28:14 -0000 1.5 *************** *** 4,7 **** --- 4,8 ---- import java.io.Serializable; + import java.sql.SQLException; import java.util.Iterator; import java.util.TreeMap; *************** *** 32,50 **** return clonedMap; } - - public Serializable disassemble(CollectionPersister persister) throws HibernateException { - - TreeMap result = new TreeMap(comparator); - Iterator iter = map.entrySet().iterator(); - while ( iter.hasNext() ) { - java.util.Map.Entry e = (java.util.Map.Entry) iter.next(); - result.put( e.getKey(), persister.getElementType().disassemble( e.getValue(), session ) ); - } - return result; } ! public SortedMap(SessionImplementor session) { super(session); } --- 33,52 ---- return clonedMap; } + public SortedMap(SessionImplementor session) { + super(session); } ! public SortedMap(SessionImplementor session, CollectionPersister persister, Comparator comparator, Serializable disassembled) ! throws HibernateException, SQLException { super(session); + this.comparator=comparator; + beforeInitialize(persister); + Serializable[] array = (Serializable[]) disassembled; + for (int i=0; i<array.length; i+=2 ) map.put( + persister.getIndexType().assemble( array[i], session, null ), + persister.getElementType().assemble( array[i+1], session, null ) //TODO: fix the null!!!! + ); + initialized = true; } *************** *** 194,199 **** } ! ! public SortedMap() {} } --- 196,200 ---- } ! } Index: SortedSet.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/SortedSet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SortedSet.java 5 Jan 2003 02:11:20 -0000 1.4 --- SortedSet.java 9 Feb 2003 06:28:14 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- import java.io.Serializable; + import java.sql.SQLException; import java.util.Iterator; import java.util.TreeSet; *************** *** 31,46 **** } - public Serializable disassemble(CollectionPersister persister) - throws HibernateException { - - TreeSet result = new TreeSet(comparator); - Iterator iter = set.iterator(); - while ( iter.hasNext() ) result.add( - persister.getElementType().disassemble( iter.next(), session ) - ); - return result; - - } - public void setComparator(Comparator comparator) { this.comparator = comparator; --- 32,35 ---- *************** *** 142,147 **** } ! ! public SortedSet() {} } --- 131,152 ---- } ! ! public SortedSet( ! SessionImplementor session, ! CollectionPersister persister, ! Comparator comparator, ! Serializable disassembled) ! throws HibernateException, SQLException { ! ! this(session); ! this.comparator=comparator; ! beforeInitialize(persister); ! Serializable[] array = (Serializable[]) disassembled; ! for (int i=0; i<array.length; i++ ) set.add( ! persister.getElementType().assemble( array[i], session, null ) //TODO: fix the null!!!! ! ); ! initialized = true; ! } ! } |
From: <one...@us...> - 2003-02-09 06:28:47
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/engine Modified Files: CollectionSnapshot.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: CollectionSnapshot.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/engine/CollectionSnapshot.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CollectionSnapshot.java 30 Jan 2003 13:03:12 -0000 1.1 --- CollectionSnapshot.java 9 Feb 2003 06:28:15 -0000 1.2 *************** *** 5,10 **** public interface CollectionSnapshot extends Serializable { ! public Serializable getLoadedKey(); ! public String getLoadedPersisterRole(); public Serializable getSnapshot(); public boolean getDirty(); --- 5,10 ---- public interface CollectionSnapshot extends Serializable { ! public Serializable getKey(); ! public String getRole(); public Serializable getSnapshot(); public boolean getDirty(); |
From: <one...@us...> - 2003-02-09 06:28:47
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/cfg Modified Files: Binder.java Configuration.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: Binder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Binder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Binder.java 2 Feb 2003 00:29:06 -0000 1.5 --- Binder.java 9 Feb 2003 06:28:14 -0000 1.6 *************** *** 50,57 **** import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.Document; ! import org.w3c.dom.NamedNodeMap; ! import org.w3c.dom.Node; ! import org.w3c.dom.NodeList; class Binder { --- 50,56 ---- import org.apache.commons.logging.Log; [...1328 lines suppressed...] Binder.bindArray(node, array, prefix, mappings); --- 1027,1031 ---- }; private static final CollectionType ARRAY = new CollectionType("array") { ! public Collection create(Element node, String prefix, PersistentClass owner, Mappings mappings) throws MappingException { Array array = new Array(owner); Binder.bindArray(node, array, prefix, mappings); *************** *** 1078,1082 **** }; private static final CollectionType PRIMITIVE_ARRAY = new CollectionType("primitive-array") { ! public Collection create(Node node, String prefix, PersistentClass owner, Mappings mappings) throws MappingException { PrimitiveArray array = new PrimitiveArray(owner); Binder.bindArray(node, array, prefix, mappings); --- 1034,1038 ---- }; private static final CollectionType PRIMITIVE_ARRAY = new CollectionType("primitive-array") { ! public Collection create(Element node, String prefix, PersistentClass owner, Mappings mappings) throws MappingException { PrimitiveArray array = new PrimitiveArray(owner); Binder.bindArray(node, array, prefix, mappings); Index: Configuration.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/cfg/Configuration.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Configuration.java 3 Feb 2003 12:11:36 -0000 1.14 --- Configuration.java 9 Feb 2003 06:28:14 -0000 1.15 *************** *** 12,22 **** import java.io.InputStream; import java.io.Serializable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; - import org.w3c.dom.NamedNodeMap; - import org.w3c.dom.Node; - import org.w3c.dom.NodeList; import org.xml.sax.InputSource; --- 12,22 ---- import java.io.InputStream; import java.io.Serializable; + import java.io.StringReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.dom4j.Attribute; + import org.dom4j.Element; import org.w3c.dom.Document; import org.xml.sax.InputSource; *************** *** 129,133 **** log.info("Mapping file: " + xmlFile); try { ! add( XMLHelper.parseFile(xmlFile) ); } catch (Exception e) { --- 129,133 ---- log.info("Mapping file: " + xmlFile); try { ! add( XMLHelper.createSAXReader(xmlFile).read(xmlFile) ); } catch (Exception e) { *************** *** 145,149 **** if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + xml); try { ! add( XMLHelper.parseString(xml) ); } catch (Exception e) { --- 145,149 ---- if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + xml); try { ! add( XMLHelper.createSAXReader("XML String").read( new StringReader(xml) ) ); } catch (Exception e) { *************** *** 161,165 **** if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + doc); try { ! add(doc); } catch (Exception e) { --- 161,165 ---- if ( log.isDebugEnabled() ) log.debug("Mapping XML:\n" + doc); try { ! add( XMLHelper.createDOMReader().read(doc) ); } catch (Exception e) { *************** *** 170,174 **** } ! private void add(Document doc) throws Exception { try { Binder.bindRoot( doc, createMappings() ); --- 170,174 ---- } ! private void add(org.dom4j.Document doc) throws Exception { try { Binder.bindRoot( doc, createMappings() ); *************** *** 194,198 **** public Configuration addInputStream(InputStream xmlInputStream) throws MappingException { try { ! add( XMLHelper.parseInputSource( new InputSource(xmlInputStream) ) ); return this; } --- 194,198 ---- public Configuration addInputStream(InputStream xmlInputStream) throws MappingException { try { ! add( XMLHelper.createSAXReader("XML InputStream").read( new InputSource(xmlInputStream) ) ); return this; } *************** *** 602,616 **** } ! private void addProperties(Node parent) { ! NodeList children = parent.getChildNodes(); ! for ( int i=0; i<children.getLength(); i++ ) { ! Node node = children.item(i); ! if ( node.getNodeName().equals("property") ) { ! String name = node.getAttributes().getNamedItem("name").getNodeValue(); ! String value = node.getFirstChild().getNodeValue(); ! log.debug(name + "=" + value); ! properties.setProperty(name, value); ! if ( !name.startsWith("hibernate") ) properties.setProperty("hibernate." + name, value); ! } } Environment.verifyProperties(properties); --- 602,614 ---- } ! private void addProperties(Element parent) { ! Iterator iter = parent.elementIterator("property"); ! while ( iter.hasNext() ) { ! Element node = (Element) iter.next(); ! String name = node.attributeValue("name"); ! String value = node.getText(); ! log.debug(name + "=" + value); ! properties.setProperty(name, value); ! if ( !name.startsWith("hibernate") ) properties.setProperty("hibernate." + name, value); } Environment.verifyProperties(properties); *************** *** 653,659 **** InputStream stream = getConfigurationInputStream(resource); ! Document doc; try { ! doc = XMLHelper.parseInputSource( new InputSource(stream) ); } catch (Exception e) { --- 651,657 ---- InputStream stream = getConfigurationInputStream(resource); ! org.dom4j.Document doc; try { ! doc = XMLHelper.createSAXReader(resource).read( new InputSource(stream) ); } catch (Exception e) { *************** *** 662,699 **** } ! Node sfNode = doc.getDocumentElement().getElementsByTagName("session-factory").item(0); ! String name = sfNode.getAttributes().getNamedItem("name").getNodeValue(); properties.setProperty(Environment.SESSION_FACTORY_NAME, name); addProperties(sfNode); ! NodeList mapElements = sfNode.getChildNodes(); ! for ( int j=0; j<mapElements.getLength(); j++ ) { ! Node mapElement = mapElements.item(j); ! NamedNodeMap atts = mapElement.getAttributes(); ! if ( "mapping".equals( mapElement.getNodeName() ) ) { ! Node rsrc = atts.getNamedItem("resource"); ! Node file = atts.getNamedItem("file"); ! Node jar = atts.getNamedItem("jar"); if (rsrc!=null) { log.debug(name + "<-" + rsrc); try { ! addResource( rsrc.getNodeValue(), Thread.currentThread().getContextClassLoader() ); } catch (MappingException me) { ! addResource( rsrc.getNodeValue(), Environment.class.getClassLoader() ); } } else if ( jar!=null ) { log.debug(name + "<-" + jar); ! addJar( jar.getNodeValue() ); } else { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); log.debug(name + "<-" + file); ! addFile( file.getNodeValue() ); } } ! else if ( "jcs-class-cache".equals( mapElement.getNodeName() ) ) { ! String className = atts.getNamedItem("class").getNodeValue(); final Class clazz; try { --- 660,697 ---- } ! Element sfNode = doc.getRootElement().element("session-factory"); ! String name = sfNode.attributeValue("name"); properties.setProperty(Environment.SESSION_FACTORY_NAME, name); addProperties(sfNode); ! Iterator elements = sfNode.elementIterator(); ! while ( elements.hasNext() ) { ! Element mapElement = (Element) elements.next(); ! String elemname = mapElement.getName(); ! if ( "mapping".equals(elemname) ) { ! Attribute rsrc = mapElement.attribute("resource"); ! Attribute file = mapElement.attribute("file"); ! Attribute jar = mapElement.attribute("jar"); if (rsrc!=null) { log.debug(name + "<-" + rsrc); try { ! addResource( rsrc.getValue(), Thread.currentThread().getContextClassLoader() ); } catch (MappingException me) { ! addResource( rsrc.getValue(), Environment.class.getClassLoader() ); } } else if ( jar!=null ) { log.debug(name + "<-" + jar); ! addJar( jar.getValue() ); } else { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); log.debug(name + "<-" + file); ! addFile( file.getValue() ); } } ! else if ( "jcs-class-cache".equals(elemname) ) { ! String className = mapElement.attributeValue("class"); final Class clazz; try { *************** *** 710,725 **** throw new MappingException("You may only specify a cache for root <class> mappings"); } ! Node regionNode = atts.getNamedItem("region"); String region = className; ! if (regionNode!=null) region = regionNode.getNodeValue(); ! pc.setCache( createJCSCache( atts.getNamedItem("usage").getNodeValue(), region, pc ) ); } ! else if ( "jcs-collection-cache".equals( mapElement.getNodeName() ) ) { ! String role = atts.getNamedItem("collection").getNodeValue(); Collection c = (Collection) getCollectionMapping(role); ! Node regionNode = atts.getNamedItem("region"); String region = role; ! if (regionNode!=null) region = regionNode.getNodeValue(); ! c.setCache( createJCSCache( atts.getNamedItem("usage").getNodeValue(), region, c.getOwner() ) ); } } --- 708,723 ---- throw new MappingException("You may only specify a cache for root <class> mappings"); } ! Attribute regionNode = mapElement.attribute("region"); String region = className; ! if (regionNode!=null) region = regionNode.getValue(); ! pc.setCache( createJCSCache( mapElement.attributeValue("usage"), region, pc ) ); } ! else if ( "jcs-collection-cache".equals(elemname) ) { ! String role = mapElement.attributeValue("collection"); Collection c = (Collection) getCollectionMapping(role); ! Attribute regionNode = mapElement.attribute("region"); String region = role; ! if (regionNode!=null) region = regionNode.getValue(); ! c.setCache( createJCSCache( mapElement.attributeValue("usage"), region, c.getOwner() ) ); } } |
From: <one...@us...> - 2003-02-09 06:28:47
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate Modified Files: FlushMode.java LockMode.java UserType.java hibernate-mapping-2.0.dtd Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: FlushMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/FlushMode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FlushMode.java 5 Jan 2003 02:11:19 -0000 1.3 --- FlushMode.java 9 Feb 2003 06:28:14 -0000 1.4 *************** *** 49,53 **** } ! Object readResolve() { return instances.get( new Integer(level) ); } --- 49,53 ---- } ! private Object readResolve() { return instances.get( new Integer(level) ); } Index: LockMode.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/LockMode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LockMode.java 5 Jan 2003 02:11:19 -0000 1.3 --- LockMode.java 9 Feb 2003 06:28:14 -0000 1.4 *************** *** 77,81 **** } ! Object readResolve() { return instances.get( new Integer(level) ); } --- 77,81 ---- } ! private Object readResolve() { return instances.get( new Integer(level) ); } Index: UserType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/UserType.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UserType.java 19 Jan 2003 11:47:07 -0000 1.4 --- UserType.java 9 Feb 2003 06:28:14 -0000 1.5 *************** *** 18,21 **** --- 18,25 ---- * default constructor.<br> * <br> + * The actual class mapped by a <tt>UserType</tt> may be just + * about anything. However, if it is to be cacheable by JCS, it + * must be serializable.<br> + * <br> * Alternatively, custom types could implement <tt>Type</tt> * directly or extend one of the abstract classes in Index: hibernate-mapping-2.0.dtd =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/hibernate-mapping-2.0.dtd,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** hibernate-mapping-2.0.dtd 28 Jan 2003 10:22:18 -0000 1.13 --- hibernate-mapping-2.0.dtd 9 Feb 2003 06:28:14 -0000 1.14 *************** *** 71,74 **** --- 71,75 ---- <!ATTLIST discriminator column CDATA #IMPLIED> <!-- default: "class"|none --> <!ATTLIST discriminator type CDATA "string"> + <!ATTLIST discriminator not-null (true|false) "true"> <!ATTLIST discriminator length CDATA #IMPLIED> |
From: <one...@us...> - 2003-02-09 06:28:20
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/xml Modified Files: XMLDatabinder.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: XMLDatabinder.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/xml/XMLDatabinder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** XMLDatabinder.java 14 Jan 2003 13:42:19 -0000 1.5 --- XMLDatabinder.java 9 Feb 2003 06:28:17 -0000 1.6 *************** *** 2,6 **** package net.sf.hibernate.xml; ! import java.io.StringReader; import java.io.StringWriter; import java.lang.reflect.Array; --- 2,6 ---- package net.sf.hibernate.xml; ! import java.io.IOException; import java.io.StringWriter; import java.lang.reflect.Array; *************** *** 21,25 **** import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamResult; - import javax.xml.transform.stream.StreamSource; import net.sf.hibernate.Databinder; --- 21,24 ---- *************** *** 45,53 **** import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.jdom.Document; ! import org.jdom.Element; ! import org.jdom.JDOMException; ! import org.jdom.output.DOMOutputter; ! import org.jdom.output.XMLOutputter; /** --- 44,55 ---- import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.dom4j.Document; ! import org.dom4j.DocumentException; ! import org.dom4j.DocumentHelper; ! import org.dom4j.Element; ! import org.dom4j.io.DOMWriter; ! import org.dom4j.io.DocumentSource; ! import org.dom4j.io.OutputFormat; ! import org.dom4j.io.XMLWriter; /** *************** *** 78,88 **** } ! private Document toJDOMDocument() throws HibernateException { this.associatedObjects = new HashSet(); this.processedObjects = new HashSet(); ! Element root = new Element("hibernate-generic"); ! root.setAttribute("datetime", Hibernate.TIMESTAMP.toXML( new Date(), factory) ); ! Document doc = new Document(root); Iterator iter = null; --- 80,90 ---- } ! private Document toDocument() throws HibernateException { this.associatedObjects = new HashSet(); this.processedObjects = new HashSet(); ! Document doc = DocumentHelper.createDocument(); ! Element root = doc.addElement("hibernate-generic"); ! root.setAttributeValue("datetime", Hibernate.TIMESTAMP.toXML( new Date(), factory) ); Iterator iter = null; *************** *** 92,102 **** while ( iter.hasNext() ) { Object object = iter.next(); ! Element objectElem = new Element("object"); ! root.addContent(objectElem); if ((object = maybeInitializeIfProxy(object, objectElem)) != null) { String className = object.getClass().getName(); ! objectElem.setAttribute( "class", StringHelper.unqualify(className) ); ! objectElem.setAttribute( "package", StringHelper.qualifier(className) ); ClassPersister persister = getPersister( object.getClass() ); //ID --- 94,103 ---- while ( iter.hasNext() ) { Object object = iter.next(); ! Element objectElem = root.addElement("object"); if ((object = maybeInitializeIfProxy(object, objectElem)) != null) { String className = object.getClass().getName(); ! objectElem.setAttributeValue( "class", StringHelper.unqualify(className) ); ! objectElem.setAttributeValue( "package", StringHelper.qualifier(className) ); ClassPersister persister = getPersister( object.getClass() ); //ID *************** *** 105,113 **** String idValue = idType.toXML( persister.getIdentifier(object), factory ); //objectElem.setAttribute("uid", idValue); ! Element idElem = new Element("uid"); ! idElem.setAttribute( "name", persister.getIdentifierPropertyName() ); ! idElem.setAttribute( "type", idType.getName() ); ! idElem.addContent(idValue); ! objectElem.addContent(idElem); } //PROPERTIES --- 106,113 ---- String idValue = idType.toXML( persister.getIdentifier(object), factory ); //objectElem.setAttribute("uid", idValue); ! Element idElem = objectElem.addElement("uid"); ! idElem.setAttributeValue( "name", persister.getIdentifierPropertyName() ); ! idElem.setAttributeValue( "type", idType.getName() ); ! idElem.setText(idValue); } //PROPERTIES *************** *** 117,121 **** //This approach wont work for components + collections for ( int i=0; i<types.length; i++ ) { ! objectElem.addContent( renderProperty( names[i], types[i], values[i], "component", "property", "collection", true ) ); } } --- 117,121 ---- //This approach wont work for components + collections for ( int i=0; i<types.length; i++ ) { ! objectElem.add( renderProperty( names[i], types[i], values[i], "component", "property", "collection", true ) ); } } *************** *** 140,153 **** if (li.isUninitialized() && !this.initializeLazy) { ! element.setAttribute("proxy", "uninitialized"); ! element.setAttribute( "uid", li.getIdentifier().toString() ); return null; } if (li.isUninitialized()) { ! element.setAttribute("proxy", "now-initialized"); } else { ! element.setAttribute("proxy", "initialized"); } --- 140,153 ---- if (li.isUninitialized() && !this.initializeLazy) { ! element.setAttributeValue("proxy", "uninitialized"); ! element.setAttributeValue( "uid", li.getIdentifier().toString() ); return null; } if (li.isUninitialized()) { ! element.setAttributeValue("proxy", "now-initialized"); } else { ! element.setAttributeValue("proxy", "initialized"); } *************** *** 156,163 **** public String toGenericXML() throws HibernateException { ! XMLOutputter outputter = new XMLOutputter(); ! outputter.setNewlines(true); ! outputter.setIndent(true); ! return outputter.outputString( toJDOMDocument() ); } --- 156,169 ---- public String toGenericXML() throws HibernateException { ! StringWriter writer = new StringWriter(); ! XMLWriter outputter = new XMLWriter( writer, OutputFormat.createPrettyPrint() ); ! //outputter.setNewlines(true); ! try { ! outputter.write( toDocument() ); ! } ! catch (IOException ioe) { ! throw new HibernateException("could not XML to String", ioe); ! } ! return writer.toString(); } *************** *** 165,171 **** if ( type.isComponentType() ) { AbstractComponentType componenttype = (AbstractComponentType) type; ! Element componentElem = new Element(componentName); ! if ( name!=null) componentElem.setAttribute( "name", name ); ! if (doType) componentElem.setAttribute( "class", type.getName() ); if ( value!=null ) { String[] properties = componenttype.getPropertyNames(); --- 171,177 ---- if ( type.isComponentType() ) { AbstractComponentType componenttype = (AbstractComponentType) type; ! Element componentElem = DocumentHelper.createElement(componentName); ! if ( name!=null) componentElem.setAttributeValue( "name", name ); ! if (doType) componentElem.setAttributeValue( "class", type.getName() ); if ( value!=null ) { String[] properties = componenttype.getPropertyNames(); *************** *** 173,177 **** Type[] subtypes = componenttype.getSubtypes(); for ( int j=0; j<properties.length; j++ ) { ! componentElem.addContent( renderProperty( properties[j], subtypes[j], subvalues[j], "component", "property", "collection", true ) ); } } --- 179,183 ---- Type[] subtypes = componenttype.getSubtypes(); for ( int j=0; j<properties.length; j++ ) { ! componentElem.add( renderProperty( properties[j], subtypes[j], subvalues[j], "component", "property", "collection", true ) ); } } *************** *** 182,205 **** String role = collectiontype.getRole(); CollectionPersister persister = factory.getCollectionPersister(role); ! Element collectionElem = new Element(collectionName); ! if (name!=null) collectionElem.setAttribute( "name", name ); if ( persister.isArray() ) { collectionElem.setName("array"); } else { ! if (doType) collectionElem.setAttribute( "class", type.getName() ); } Type elemType = persister.getElementType(); ! collectionElem.setAttribute( "element-type", elemType.getName() ); if (value!=null) { // arrays can't be lazily initialized if ( persister.isArray() ) { ! collectionElem.setAttribute( "index-type", "integer" ); int length = Array.getLength(value); for ( int i=0; i<length; i++ ) { Element elemElement = renderProperty(null, elemType, Array.get(value, i), "composite-element", "element", "subcollection", false); ! elemElement.setAttribute( "index", Integer.toString(i) ); ! collectionElem.addContent(elemElement); } } --- 188,211 ---- String role = collectiontype.getRole(); CollectionPersister persister = factory.getCollectionPersister(role); ! Element collectionElem = DocumentHelper.createElement(collectionName); ! if (name!=null) collectionElem.setAttributeValue( "name", name ); if ( persister.isArray() ) { collectionElem.setName("array"); } else { ! if (doType) collectionElem.setAttributeValue( "class", type.getName() ); } Type elemType = persister.getElementType(); ! collectionElem.setAttributeValue( "element-type", elemType.getName() ); if (value!=null) { // arrays can't be lazily initialized if ( persister.isArray() ) { ! collectionElem.setAttributeValue( "index-type", "integer" ); int length = Array.getLength(value); for ( int i=0; i<length; i++ ) { Element elemElement = renderProperty(null, elemType, Array.get(value, i), "composite-element", "element", "subcollection", false); ! elemElement.setAttributeValue( "index", Integer.toString(i) ); ! collectionElem.add(elemElement); } } *************** *** 209,231 **** if ( persister.isLazy() && !this.initializeLazy && !persistentCollection.wasInitialized() ) { ! collectionElem.setAttribute("lazy", "uninitialized"); } else { if ( persistentCollection.wasInitialized() ) { ! collectionElem.setAttribute("lazy", "initialized"); } else { ! collectionElem.setAttribute("lazy", "now-initialized"); } // Try to do this next bit polymorphically, instead of the following: if ( type instanceof ListType ) { ! collectionElem.setAttribute( "index-type", "integer" ); Iterator iter = ( (List) value ).iterator(); int i=0; while ( iter.hasNext() ) { Element elemElement = renderProperty(null, elemType, iter.next(), "composite-element", "element", "subcollection", false); ! elemElement.setAttribute( "index", Integer.toString(i++) ); ! collectionElem.addContent(elemElement); } } --- 215,237 ---- if ( persister.isLazy() && !this.initializeLazy && !persistentCollection.wasInitialized() ) { ! collectionElem.setAttributeValue("lazy", "uninitialized"); } else { if ( persistentCollection.wasInitialized() ) { ! collectionElem.setAttributeValue("lazy", "initialized"); } else { ! collectionElem.setAttributeValue("lazy", "now-initialized"); } // Try to do this next bit polymorphically, instead of the following: if ( type instanceof ListType ) { ! collectionElem.setAttributeValue( "index-type", "integer" ); Iterator iter = ( (List) value ).iterator(); int i=0; while ( iter.hasNext() ) { Element elemElement = renderProperty(null, elemType, iter.next(), "composite-element", "element", "subcollection", false); ! elemElement.setAttributeValue( "index", Integer.toString(i++) ); ! collectionElem.add(elemElement); } } *************** *** 234,243 **** while ( iter.hasNext() ) { Element elemElement = renderProperty(null, elemType, iter.next(), "composite-element", "element", "subcollection", false); ! collectionElem.addContent(elemElement); } } else if ( type instanceof MapType ) { Type indexType = persister.getIndexType(); ! collectionElem.setAttribute( "index-type", indexType.getName() ); Iterator iter = ( (Map) value ).entrySet().iterator(); while ( iter.hasNext() ) { --- 240,249 ---- while ( iter.hasNext() ) { Element elemElement = renderProperty(null, elemType, iter.next(), "composite-element", "element", "subcollection", false); ! collectionElem.add(elemElement); } } else if ( type instanceof MapType ) { Type indexType = persister.getIndexType(); ! collectionElem.setAttributeValue( "index-type", indexType.getName() ); Iterator iter = ( (Map) value ).entrySet().iterator(); while ( iter.hasNext() ) { *************** *** 245,250 **** Object idx = e.getKey(); Element elemElement = renderProperty(null, elemType, e.getValue(), "composite-element", "element", "subcollection", false); ! elemElement.setAttribute( "index", indexType.toXML(idx, factory) ); //index not allowed to be null currently ! collectionElem.addContent(elemElement); } } --- 251,256 ---- Object idx = e.getKey(); Element elemElement = renderProperty(null, elemType, e.getValue(), "composite-element", "element", "subcollection", false); ! elemElement.setAttributeValue( "index", indexType.toXML(idx, factory) ); //index not allowed to be null currently ! collectionElem.add(elemElement); } } *************** *** 255,268 **** } else if ( type.isEntityType() ) { ! Element referenceElem = new Element(propertyName); ! if ( name!=null) referenceElem.setAttribute( "name", name ); ! //propertyElem.setAttribute( "value", types[i].toXML( values[i] ) ); if ( ( value = maybeInitializeIfProxy(value, referenceElem) ) != null) { if ( getPersister( value.getClass() ).hasIdentifierProperty() ) ! referenceElem.setAttribute( "uid", type.toXML( value, factory ) ); String className = value.getClass().getName(); ! referenceElem.setAttribute( "class", StringHelper.unqualify(className) ); ! referenceElem.setAttribute( "package", StringHelper.qualifier(className) ); // avoid duplications (including objects that have a field referencing to themselves) --- 261,274 ---- } else if ( type.isEntityType() ) { ! Element referenceElem = DocumentHelper.createElement(propertyName); ! if ( name!=null) referenceElem.setAttributeValue( "name", name ); ! //propertyElem.setAttributeValue( "value", types[i].toXML( values[i] ) ); if ( ( value = maybeInitializeIfProxy(value, referenceElem) ) != null) { if ( getPersister( value.getClass() ).hasIdentifierProperty() ) ! referenceElem.setAttributeValue( "uid", type.toXML( value, factory ) ); String className = value.getClass().getName(); ! referenceElem.setAttributeValue( "class", StringHelper.unqualify(className) ); ! referenceElem.setAttributeValue( "package", StringHelper.qualifier(className) ); // avoid duplications (including objects that have a field referencing to themselves) *************** *** 271,283 **** } } ! if (doType) referenceElem.setAttribute( "type", type.getName() ); return referenceElem; } else { ! Element propertyElem = new Element(propertyName); ! if ( name!=null) propertyElem.setAttribute( "name", name ); ! //propertyElem.setAttribute( "value", types[i].toXML( values[i] ) ); ! if ( value!=null ) propertyElem.addContent( type.toXML( value, factory ) ); ! if (doType) propertyElem.setAttribute( "type", type.getName() ); return propertyElem; } --- 277,289 ---- } } ! if (doType) referenceElem.setAttributeValue( "type", type.getName() ); return referenceElem; } else { ! Element propertyElem = DocumentHelper.createElement(propertyName); ! if ( name!=null) propertyElem.setAttributeValue( "name", name ); ! //propertyElem.setAttributeValue( "value", types[i].toXML( values[i] ) ); ! if ( value!=null ) propertyElem.setText( type.toXML( value, factory ) ); ! if (doType) propertyElem.setAttributeValue( "type", type.getName() ); return propertyElem; } *************** *** 285,292 **** public String toXML() throws HibernateException, TransformerException { ! // According to this link it is faster to pass Xalan a stream than ! // a DOM tree: ! // http://www-106.ibm.com/developerworks/xml/library/x-tipjdom.html ! Source source = new StreamSource( new StringReader( toGenericXML() ) ); StringWriter writer = new StringWriter(); Result result = new StreamResult(writer); --- 291,296 ---- public String toXML() throws HibernateException, TransformerException { ! ! Source source = new DocumentSource( toDocument() ); StringWriter writer = new StringWriter(); Result result = new StreamResult(writer); *************** *** 314,318 **** public org.w3c.dom.Document toDOM() throws HibernateException, TransformerException { ! Source source = new StreamSource( new StringReader( toGenericXML() ) ); DOMResult result = new DOMResult(); transform.transform(source, result); --- 318,322 ---- public org.w3c.dom.Document toDOM() throws HibernateException, TransformerException { ! Source source = new DocumentSource( toDocument() ); DOMResult result = new DOMResult(); transform.transform(source, result); *************** *** 331,340 **** public org.w3c.dom.Document toGenericDOM() throws HibernateException { ! DOMOutputter outputter = new DOMOutputter(); try { ! return outputter.output( toJDOMDocument() ); } ! catch (JDOMException jde) { ! throw new HibernateException( "JDOM Exception", jde ); } } --- 335,344 ---- public org.w3c.dom.Document toGenericDOM() throws HibernateException { ! DOMWriter outputter = new DOMWriter(); try { ! return outputter.write( toDocument() ); } ! catch (DocumentException jde) { ! throw new HibernateException( "Could not transform XML to a DOM", jde ); } } |
From: <one...@us...> - 2003-02-09 06:28:19
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/util Modified Files: XMLHelper.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: XMLHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/util/XMLHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** XMLHelper.java 27 Jan 2003 07:12:04 -0000 1.4 --- XMLHelper.java 9 Feb 2003 06:28:17 -0000 1.5 *************** *** 2,62 **** package net.sf.hibernate.util; - import java.io.ByteArrayInputStream; - import java.io.IOException; - - import javax.xml.parsers.DocumentBuilder; - import javax.xml.parsers.DocumentBuilderFactory; - import javax.xml.parsers.ParserConfigurationException; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.w3c.dom.Document; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; - import org.xml.sax.InputSource; - import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public final class XMLHelper { ! private static final Log log = LogFactory.getLog(XMLHelper.class); ! private static final EntityResolver dtdResolver = new DTDEntityResolver(); ! ! private XMLHelper() { //cannot be instantiated } ! public static Document parseFile(String fileName) throws IOException, SAXException, ParserConfigurationException { ! return parseInputSource( new InputSource(fileName) ); } ! public static Document parseInputSource(InputSource source) throws IOException, SAXException, ParserConfigurationException { ! DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); ! factory.setValidating(true); ! //factory.setIgnoringComments(true); ! DocumentBuilder builder = factory.newDocumentBuilder(); ! builder.setEntityResolver(dtdResolver); ! ! final String file = (source.getSystemId()==null) ? "unknown system id" : source.getSystemId(); ! ! log.info("Parsing XML: " + file); ! ! builder.setErrorHandler( new ErrorHandler() { ! public void error(SAXParseException error) { ! log.error( "Error parsing XML: " + file + '(' + error.getLineNumber() + ')', error ); ! } ! public void fatalError(SAXParseException error) { ! error(error); ! } ! public void warning(SAXParseException error) { ! log.warn( "Warning parsing XML: " + file + '(' + error.getLineNumber() + ')', error ); ! } ! } ); ! ! return builder.parse(source).getDocumentElement().getOwnerDocument(); ! } ! public static Document parseString(String xml) throws IOException, SAXException, ParserConfigurationException { ! return parseInputSource( new InputSource( new ByteArrayInputStream( xml.getBytes() ) ) ); } --- 2,49 ---- package net.sf.hibernate.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; ! import org.dom4j.io.DOMReader; ! import org.dom4j.io.SAXReader; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXParseException; public final class XMLHelper { ! public static SAXReader createSAXReader(String file) { ! SAXReader reader = new SAXReader(); ! reader.setEntityResolver(dtdResolver); ! reader.setErrorHandler( new ErrorLogger(file) ); ! reader.setMergeAdjacentText(true); ! reader.setValidation(true); ! return reader; } ! public static DOMReader createDOMReader() { ! DOMReader reader = new DOMReader(); ! return reader; } ! private static final Log log = LogFactory.getLog(XMLHelper.class); ! private static final EntityResolver dtdResolver = new DTDEntityResolver(); + public static class ErrorLogger implements ErrorHandler { + private String file; + ErrorLogger(String file) { + this.file=file; + } + public void error(SAXParseException error) { + log.error( "Error parsing XML: " + file + '(' + error.getLineNumber() + ')', error ); + } + public void fatalError(SAXParseException error) { + error(error); + } + public void warning(SAXParseException error) { + log.warn( "Warning parsing XML: " + file + '(' + error.getLineNumber() + ')', error ); + } + }; ! private XMLHelper() { //cannot be instantiated } |
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/type Modified Files: ArrayType.java BagType.java ListType.java MapType.java PersistentCollectionType.java SetType.java SortedMapType.java SortedSetType.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: ArrayType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ArrayType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ArrayType.java 19 Jan 2003 11:47:08 -0000 1.5 --- ArrayType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 62,65 **** --- 62,74 ---- } + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) + throws HibernateException, SQLException { + + return new ArrayHolder(session, persister, disassembled); + } + } Index: BagType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/BagType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BagType.java 19 Jan 2003 11:47:08 -0000 1.5 --- BagType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 2,5 **** --- 2,8 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.Bag; *************** *** 18,33 **** CollectionPersister persister) throws HibernateException { - return new Bag(session); - } - - public Class getReturnedClass() { - return java.util.Collection.class; - } ! public PersistentCollection wrap(SessionImplementor session, Object collection) { ! return new Bag( session, (java.util.Collection) collection ); ! } } --- 21,46 ---- CollectionPersister persister) throws HibernateException { ! return new Bag(session); ! } + public Class getReturnedClass() { + return java.util.Collection.class; } + + public PersistentCollection wrap(SessionImplementor session, Object collection) { + return new Bag( session, (java.util.Collection) collection ); + } + + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) + throws HibernateException, SQLException { + + return new Bag(session, persister, disassembled); + } + + } Index: ListType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/ListType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ListType.java 19 Jan 2003 11:47:08 -0000 1.5 --- ListType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 2,5 **** --- 2,9 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; + + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.List; *************** *** 25,28 **** --- 29,41 ---- } + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) + throws HibernateException, SQLException { + + return new List(session, persister, disassembled); + } + } Index: MapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/MapType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MapType.java 19 Jan 2003 11:47:08 -0000 1.5 --- MapType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 2,7 **** --- 2,10 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; import java.util.Iterator; + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.Map; *************** *** 31,34 **** --- 34,47 ---- return new Map( session, (java.util.Map) collection ); } + + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) + throws HibernateException, SQLException { + + return new Map(session, persister, disassembled); + } + } Index: PersistentCollectionType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/PersistentCollectionType.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PersistentCollectionType.java 2 Feb 2003 04:19:52 -0000 1.6 --- PersistentCollectionType.java 9 Feb 2003 06:28:16 -0000 1.7 *************** *** 169,172 **** --- 169,177 ---- } + public abstract PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) throws HibernateException, SQLException; + } Index: SetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SetType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SetType.java 19 Jan 2003 11:47:08 -0000 1.5 --- SetType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 2,5 **** --- 2,9 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; + + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; *************** *** 25,28 **** --- 29,40 ---- } + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) throws HibernateException, SQLException { + + return new Set(session, persister, disassembled); + } + } Index: SortedMapType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedMapType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SortedMapType.java 19 Jan 2003 11:47:08 -0000 1.5 --- SortedMapType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 3,8 **** --- 3,11 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; import java.util.Comparator; + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; *************** *** 33,36 **** --- 36,48 ---- } + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) + throws HibernateException, SQLException { + + return new SortedMap(session, persister, comparator, disassembled); + } + } Index: SortedSetType.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/type/SortedSetType.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SortedSetType.java 19 Jan 2003 11:47:08 -0000 1.5 --- SortedSetType.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 3,8 **** --- 3,11 ---- package net.sf.hibernate.type; + import java.io.Serializable; + import java.sql.SQLException; import java.util.Comparator; + import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.collection.PersistentCollection; *************** *** 28,33 **** --- 31,45 ---- return java.util.SortedSet.class; } + public PersistentCollection wrap(SessionImplementor session, Object collection) { return new SortedSet( session, (java.util.SortedSet) collection ); + } + + public PersistentCollection assembleCachedCollection( + SessionImplementor session, + CollectionPersister persister, + Serializable disassembled) throws HibernateException, SQLException { + + return new SortedSet(session, persister, comparator, disassembled); } |
From: <one...@us...> - 2003-02-09 06:28:19
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/test Modified Files: ABC.hbm.xml ABCProxy.hbm.xml ABCProxyTest.java ABCTest.java Baz.hbm.xml Baz.java Container.hbm.xml Container.java FooBar.hbm.xml FooBarTest.java FooStatus.java Many.hbm.xml One.hbm.xml ParentChildTest.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: ABC.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ABC.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ABC.hbm.xml 28 Jan 2003 10:22:21 -0000 1.3 --- ABC.hbm.xml 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 7,15 **** <generator class="vm"/> </id> ! <discriminator column="clazz" type="integer"/> <property name="name"/> <subclass name="net.sf.hibernate.test.B" discriminator-value="-1"> <property name="count" column="count_"/> ! <subclass name="net.sf.hibernate.test.C1" discriminator-value="1"> <property name="address" column="c1"/> <one-to-one name="d"/> --- 7,15 ---- <generator class="vm"/> </id> ! <discriminator column="clazz" type="integer" not-null="false"/> <property name="name"/> <subclass name="net.sf.hibernate.test.B" discriminator-value="-1"> <property name="count" column="count_"/> ! <subclass name="net.sf.hibernate.test.C1" discriminator-value="null"> <property name="address" column="c1"/> <one-to-one name="d"/> Index: ABCProxy.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ABCProxy.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ABCProxy.hbm.xml 28 Jan 2003 10:22:21 -0000 1.3 --- ABCProxy.hbm.xml 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 9,13 **** <discriminator column="clazz" type="integer"/> <property name="name"/> ! <subclass name="net.sf.hibernate.test.B" discriminator-value="-1" proxy="net.sf.hibernate.test.B"> <property name="count" column="count_"/> <subclass name="net.sf.hibernate.test.C1" discriminator-value="1" proxy="net.sf.hibernate.test.C1"> --- 9,13 ---- <discriminator column="clazz" type="integer"/> <property name="name"/> ! <subclass name="net.sf.hibernate.test.B" discriminator-value="null" proxy="net.sf.hibernate.test.B"> <property name="count" column="count_"/> <subclass name="net.sf.hibernate.test.C1" discriminator-value="1" proxy="net.sf.hibernate.test.C1"> Index: ABCProxyTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ABCProxyTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ABCProxyTest.java 5 Jan 2003 02:11:23 -0000 1.3 --- ABCProxyTest.java 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 119,122 **** --- 119,127 ---- s.close(); + s = sessions.openSession(); + t = s.beginTransaction(); + s.find("from b in class B"); + t.commit(); + s.close(); } Index: ABCTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ABCTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ABCTest.java 5 Jan 2003 02:11:23 -0000 1.3 --- ABCTest.java 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 69,72 **** --- 69,78 ---- t.commit(); s.close(); + + s = sessions.openSession(); + t = s.beginTransaction(); + s.find("from b in class B"); + t.commit(); + s.close(); } Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.hbm.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Baz.hbm.xml 2 Feb 2003 00:29:06 -0000 1.9 --- Baz.hbm.xml 9 Feb 2003 06:28:16 -0000 1.10 *************** *** 158,161 **** --- 158,180 ---- <one-to-many class = "net.sf.hibernate.test.Glarch"/> </map> + + <set name="cached" sort="natural" table="cached_set"> + <jcs-cache usage="read-write"/> + <key column="baz"/> + <composite-element class="net.sf.hibernate.test.CompositeElement"> + <property name="foo"/> + <property name="bar"/> + </composite-element> + </set> + + <map name="cachedMap" sort="natural" table="cached_map"> + <jcs-cache usage="read-write"/> + <key column="baz"/> + <index-many-to-many column="another_baz" class="net.sf.hibernate.test.Baz"/> + <composite-element class="net.sf.hibernate.test.CompositeElement"> + <property name="foo"/> + <property name="bar"/> + </composite-element> + </map> </class> Index: Baz.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Baz.java 1 Feb 2003 10:42:29 -0000 1.5 --- Baz.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 5,9 **** import java.util.*; ! public class Baz implements Named, Serializable { private SortedSet stringSet; private Map stringDateMap; --- 5,9 ---- import java.util.*; ! public class Baz implements Named, Serializable, Comparable { private SortedSet stringSet; private Map stringDateMap; *************** *** 12,16 **** private FooProxy[] fooArray; private String[] stringArray; ! private String Code; private List customs; private List topComponents; --- 12,16 ---- private FooProxy[] fooArray; private String[] stringArray; ! private String code; private List customs; private List topComponents; *************** *** 29,32 **** --- 29,34 ---- private List fees; private Collection fooBag; + private Set cached; + private Map cachedMap; Baz() {} *************** *** 70,77 **** public String getCode() { ! return Code; } public void setCode(String code) { ! Code = code; } --- 72,79 ---- public String getCode() { ! return code; } public void setCode(String code) { ! this.code = code; } *************** *** 118,121 **** --- 120,134 ---- bag.add("duplicate"); bag.add("unique"); + cached = new TreeSet(); + CompositeElement ce = new CompositeElement(); + ce.setFoo("foo"); + ce.setBar("bar"); + CompositeElement ce2 = new CompositeElement(); + ce2.setFoo("fooxxx"); + ce2.setBar("barxxx"); + cached.add(ce); + cached.add(ce2); + cachedMap = new TreeMap(); + cachedMap.put(this, ce); } *************** *** 244,247 **** --- 257,299 ---- public void setFooBag(Collection fooBag) { this.fooBag = fooBag; + } + + /** + * Returns the cached. + * @return Set + */ + public Set getCached() { + return cached; + } + + /** + * Sets the cached. + * @param cached The cached to set + */ + public void setCached(Set cached) { + this.cached = cached; + } + + /** + * Returns the cachedMap. + * @return Map + */ + public Map getCachedMap() { + return cachedMap; + } + + /** + * Sets the cachedMap. + * @param cachedMap The cachedMap to set + */ + public void setCachedMap(Map cachedMap) { + this.cachedMap = cachedMap; + } + + /** + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object o) { + return ( (Baz) o ).code.compareTo(code); } Index: Container.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Container.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Container.hbm.xml 28 Jan 2003 10:22:21 -0000 1.3 --- Container.hbm.xml 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 37,40 **** --- 37,49 ---- </composite-element> </set> + <bag name="cascades" cascade="all" table="abcd"> + <key column="container_id"/> + <composite-element class="net.sf.hibernate.test.Container$ContainerInnerClass"> + <property name="name"/> + <many-to-one name="simple" cascade="all"/> + <many-to-one name="one" cascade="all" not-null="true"/> + <many-to-one name="many" cascade="all" not-null="true"/> + </composite-element> + </bag> <bag name="bag" inverse="true" cascade="save-update" table="CCBAG"> <key column="container_id"/> Index: Container.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Container.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Container.java 5 Jan 2003 02:11:23 -0000 1.3 --- Container.java 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 84,87 **** --- 84,88 ---- private List components; private Set composites; + private Collection cascades; private long id; private Collection bag; *************** *** 295,298 **** --- 296,315 ---- } + /** + * Returns the cascades. + * @return Collection + */ + public Collection getCascades() { + return cascades; + } + + /** + * Sets the cascades. + * @param cascades The cascades to set + */ + public void setCascades(Collection cascades) { + this.cascades = cascades; + } + } Index: FooBar.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBar.hbm.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FooBar.hbm.xml 2 Feb 2003 06:41:05 -0000 1.7 --- FooBar.hbm.xml 9 Feb 2003 06:28:16 -0000 1.8 *************** *** 3,7 **** <hibernate-mapping> - <class name="net.sf.hibernate.test.Foo" --- 3,6 ---- *************** *** 99,103 **** name="net.sf.hibernate.test.Abstract" proxy="net.sf.hibernate.test.AbstractProxy" ! discriminator-value="A"> <set name="abstracts"> <key column="abstract_id"/> --- 98,102 ---- name="net.sf.hibernate.test.Abstract" proxy="net.sf.hibernate.test.AbstractProxy" ! discriminator-value="null"> <set name="abstracts"> <key column="abstract_id"/> Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** FooBarTest.java 3 Feb 2003 10:28:47 -0000 1.19 --- FooBarTest.java 9 Feb 2003 06:28:16 -0000 1.20 *************** *** 130,133 **** --- 130,156 ---- } + public void testCollectionCache() throws Exception { + Session s = sessions.openSession(); + Baz baz = new Baz(); + baz.setDefaults(); + s.save(baz); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + s.load( Baz.class, baz.getCode() ); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + baz = (Baz) s.load( Baz.class, baz.getCode() ); + s.delete(baz); + s.flush(); + s.connection().commit(); + s.close(); + } + public void testAssociationId() throws Exception { Session s = sessions.openSession(); *************** *** 1987,1991 **** assertTrue( binder.toDOM()!=null, "dom" ); assertTrue( binder.toGenericDOM()!=null, "generic dom" ); ! s.delete(foo); s.delete(baz); --- 2010,2014 ---- assertTrue( binder.toDOM()!=null, "dom" ); assertTrue( binder.toGenericDOM()!=null, "generic dom" ); ! s.delete(foo); s.delete(baz); Index: FooStatus.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooStatus.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FooStatus.java 5 Jan 2003 02:11:23 -0000 1.3 --- FooStatus.java 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 28,32 **** } ! Object readResolve() { return fromInt(code); } --- 28,32 ---- } ! private Object readResolve() { return fromInt(code); } Index: Many.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Many.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Many.hbm.xml 28 Jan 2003 10:22:21 -0000 1.3 --- Many.hbm.xml 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 5,10 **** <hibernate-mapping> <class name="net.sf.hibernate.test.Many" table="many"> ! <id name="key" column="many_key"> ! <generator class="hilo" /> </id> <many-to-one name="one" column="one_key" class="net.sf.hibernate.test.One"/> --- 5,10 ---- <hibernate-mapping> <class name="net.sf.hibernate.test.Many" table="many"> ! <id name="key" column="many_key" unsaved-value="0"> ! <generator class="native" /> </id> <many-to-one name="one" column="one_key" class="net.sf.hibernate.test.One"/> Index: One.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/One.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** One.hbm.xml 28 Jan 2003 10:22:21 -0000 1.3 --- One.hbm.xml 9 Feb 2003 06:28:16 -0000 1.4 *************** *** 5,10 **** <hibernate-mapping> <class name="net.sf.hibernate.test.One" table="one"> ! <id name="key" column="one_key"> ! <generator class="hilo" /> </id> <property column="one_value" name="value"/> --- 5,10 ---- <hibernate-mapping> <class name="net.sf.hibernate.test.One" table="one"> ! <id name="key" column="one_key" unsaved-value="0"> ! <generator class="native" /> </id> <property column="one_value" name="value"/> Index: ParentChildTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/ParentChildTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParentChildTest.java 12 Jan 2003 14:45:38 -0000 1.4 --- ParentChildTest.java 9 Feb 2003 06:28:16 -0000 1.5 *************** *** 345,348 **** --- 345,394 ---- } + public void testCascadeCompositeElements() throws Exception { + Container c = new Container(); + List list = new ArrayList(); + c.setCascades(list); + Container.ContainerInnerClass cic = new Container.ContainerInnerClass(); + cic.setMany( new Many() ); + cic.setOne( new One() ); + list.add(cic); + Session s = sessions.openSession(); + s.save(c); + s.flush(); + s.connection().commit(); + s.close(); + s=sessions.openSession(); + c = (Container) s.iterate("from c in class Container").next(); + cic = (Container.ContainerInnerClass) c.getCascades().iterator().next(); + assertTrue( cic.getMany()!=null && cic.getOne()!=null ); + assertTrue( c.getCascades().size()==1 ); + s.delete(c); + s.flush(); + s.connection().commit(); + s.close(); + + c = new Container(); + s = sessions.openSession(); + s.save(c); + list = new ArrayList(); + c.setCascades(list); + cic = new Container.ContainerInnerClass(); + cic.setMany( new Many() ); + cic.setOne( new One() ); + list.add(cic); + s.flush(); + s.connection().commit(); + s.close(); + s=sessions.openSession(); + c = (Container) s.iterate("from c in class Container").next(); + cic = (Container.ContainerInnerClass) c.getCascades().iterator().next(); + assertTrue( cic.getMany()!=null && cic.getOne()!=null ); + assertTrue( c.getCascades().size()==1 ); + s.delete(c); + s.flush(); + s.connection().commit(); + s.close(); + } + public void testBag() throws Exception { Session s = sessions.openSession(); |
From: <one...@us...> - 2003-02-09 06:28:19
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/tool/hbm2ddl Modified Files: SchemaUpdate.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: SchemaUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/tool/hbm2ddl/SchemaUpdate.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SchemaUpdate.java 26 Jan 2003 01:33:36 -0000 1.5 --- SchemaUpdate.java 9 Feb 2003 06:28:16 -0000 1.6 *************** *** 81,84 **** --- 81,86 ---- public void execute(boolean script) throws SQLException, HibernateException { Connection connection = cp.getConnection(); + connection.commit(); + connection.setAutoCommit(true); JdbcDatabaseInfo info = new JdbcDatabaseInfo(connection, dialect); Statement stmt; |
From: <one...@us...> - 2003-02-09 06:28:19
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/sql Modified Files: InFragment.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: InFragment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/InFragment.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InFragment.java 20 Jan 2003 18:45:18 -0000 1.1 --- InFragment.java 9 Feb 2003 06:28:16 -0000 1.2 *************** *** 42,46 **** } else { ! buf.append("=").append( values.iterator().next() ); } return buf.toString(); --- 42,52 ---- } else { ! String value = (String) values.iterator().next(); ! if ( "null".equals(value) ) { ! buf.append(" is null"); ! } ! else { ! buf.append("=").append( values.iterator().next() ); ! } } return buf.toString(); |
From: <one...@us...> - 2003-02-09 06:28:18
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/proxy Modified Files: SerializableProxy.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: SerializableProxy.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/SerializableProxy.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SerializableProxy.java 13 Jan 2003 13:03:51 -0000 1.6 --- SerializableProxy.java 9 Feb 2003 06:28:16 -0000 1.7 *************** *** 31,35 **** } ! Object readResolve() { try { return CGLIBLazyInitializer.getProxy( --- 31,35 ---- } ! private Object readResolve() { try { return CGLIBLazyInitializer.getProxy( |
From: <one...@us...> - 2003-02-09 06:28:18
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/persister Modified Files: ClassPersister.java EntityPersister.java NormalizedEntityPersister.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: ClassPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/ClassPersister.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ClassPersister.java 28 Jan 2003 10:22:20 -0000 1.6 --- ClassPersister.java 9 Feb 2003 06:28:15 -0000 1.7 *************** *** 28,32 **** * @see EntityPersister */ ! public interface ClassPersister extends Serializable { /** --- 28,32 ---- * @see EntityPersister */ ! public interface ClassPersister { /** Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** EntityPersister.java 2 Feb 2003 06:41:05 -0000 1.15 --- EntityPersister.java 9 Feb 2003 06:28:15 -0000 1.16 *************** *** 15,20 **** import net.sf.hibernate.mapping.Value; - import java.io.InvalidObjectException; - import java.io.ObjectStreamException; import java.io.Serializable; import java.sql.PreparedStatement; --- 15,18 ---- *************** *** 27,30 **** --- 25,29 ---- import java.util.Map; + import org.apache.commons.lang.ObjectUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; *************** *** 60,92 **** private final SessionFactoryImplementor factory; ! private transient final String qualifiedTableName; ! private transient final String[] tableNames; ! private transient final String deleteString; ! private transient final String insertString; ! private transient final String updateString; ! private transient final String identityInsertString; ! private transient final int[] propertyColumnSpans; ! private transient final boolean[] definedOnSubclass; ! private transient final String[][] propertyColumnNames; ! private transient final String[][] propertyColumnAliases; ! private transient final String[][] subclassPropertyColumnNameClosure; ! private transient final String discriminatorColumnName; ! private transient final String[] subclassColumnClosure; ! private transient final String[] subclassColumnAliasClosure; ! private transient final Type[] subclassPropertyTypeClosure; ! private transient final Class[] subclassClosure; ! private transient final boolean hasColumns; ! private transient final int[] joinedFetch; ! private transient final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private transient final DiscriminatorType discriminatorType; ! private transient final String discriminatorSQLString; ! protected transient final Map loaders = new HashMap(); ! protected transient final Map lockers = new HashMap(); private static final String[] STRING_ARRAY = {}; --- 59,91 ---- private final SessionFactoryImplementor factory; ! private final String qualifiedTableName; ! private final String[] tableNames; ! private final String deleteString; ! private final String insertString; ! private final String updateString; ! private final String identityInsertString; ! private final int[] propertyColumnSpans; ! private final boolean[] definedOnSubclass; ! private final String[][] propertyColumnNames; ! private final String[][] propertyColumnAliases; ! private final String[][] subclassPropertyColumnNameClosure; ! private final String discriminatorColumnName; ! private final String[] subclassColumnClosure; ! private final String[] subclassColumnAliasClosure; ! private final Type[] subclassPropertyTypeClosure; ! private final Class[] subclassClosure; ! private final boolean hasColumns; ! private final int[] joinedFetch; ! private final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private final DiscriminatorType discriminatorType; ! private final String discriminatorSQLString; ! protected final Map loaders = new HashMap(); ! protected final Map lockers = new HashMap(); private static final String[] STRING_ARRAY = {}; *************** *** 196,200 **** public Class getSubclassForDiscriminatorValue(Object value) { ! return (Class) subclassesByDiscriminatorValue.get(value); } --- 195,204 ---- public Class getSubclassForDiscriminatorValue(Object value) { ! if (value==null) { ! return (Class) subclassesByDiscriminatorValue.get(ObjectUtils.NULL); ! } ! else { ! return (Class) subclassesByDiscriminatorValue.get(value); ! } } *************** *** 617,622 **** try { discriminatorType = (DiscriminatorType) model.getDiscriminator().getType(); ! discriminatorValue = discriminatorType.stringToObject( model.getDiscriminatorValue() ); ! discriminatorSQLString = discriminatorType.objectToSQLString(discriminatorValue); } catch (ClassCastException cce) { --- 621,632 ---- try { discriminatorType = (DiscriminatorType) model.getDiscriminator().getType(); ! if ( "null".equals( model.getDiscriminatorValue() ) ) { ! discriminatorValue = null; ! discriminatorSQLString = "null"; ! } ! else { ! discriminatorValue = discriminatorType.stringToObject( model.getDiscriminatorValue() ); ! discriminatorSQLString = discriminatorType.objectToSQLString(discriminatorValue); ! } } catch (ClassCastException cce) { *************** *** 733,754 **** subclassClosure = new Class[subclassSpan]; subclassClosure[0] = mappedClass; ! if ( model.isPolymorphic() ) subclassesByDiscriminatorValue.put( discriminatorValue, mappedClass ); // SUBCLASSES ! iter = model.getSubclassIterator(); ! int k=1; ! while ( iter.hasNext() ) { ! Subclass sc = (Subclass) iter.next(); ! subclassClosure[k] = sc.getPersistentClass(); ! try { ! if ( model.isPolymorphic() ) subclassesByDiscriminatorValue.put( ! discriminatorType.stringToObject( sc.getDiscriminatorValue() ), ! sc.getPersistentClass() ! ); ! } ! catch (Exception e) { ! throw new MappingException("Error parsing discriminator value", e); } - k++; } --- 743,777 ---- subclassClosure = new Class[subclassSpan]; subclassClosure[0] = mappedClass; ! if ( model.isPolymorphic() ) { ! if (discriminatorValue==null) { ! subclassesByDiscriminatorValue.put(ObjectUtils.NULL, mappedClass); ! } ! else { ! subclassesByDiscriminatorValue.put(discriminatorValue, mappedClass); ! } ! } // SUBCLASSES ! if ( model.isPolymorphic() ) { ! iter = model.getSubclassIterator(); ! int k=1; ! while ( iter.hasNext() ) { ! Subclass sc = (Subclass) iter.next(); ! subclassClosure[k++] = sc.getPersistentClass(); ! if ( "null".equals( sc.getDiscriminatorValue() ) ) { ! subclassesByDiscriminatorValue.put( ObjectUtils.NULL, sc.getPersistentClass() ); ! } ! else { ! try { ! subclassesByDiscriminatorValue.put( ! discriminatorType.stringToObject( sc.getDiscriminatorValue() ), ! sc.getPersistentClass() ! ); ! } ! catch (Exception e) { ! throw new MappingException("Error parsing discriminator value", e); ! } ! } } } *************** *** 781,795 **** } ! ! Object readResolve() throws ObjectStreamException { ! try { ! return factory.getPersister( getMappedClass() ); ! } ! catch (MappingException me) { ! throw new InvalidObjectException( me.getMessage() ); ! } ! } ! ! public String[] getTableNames() { return tableNames; --- 804,808 ---- } ! public String[] getTableNames() { return tableNames; Index: NormalizedEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/NormalizedEntityPersister.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NormalizedEntityPersister.java 2 Feb 2003 06:41:05 -0000 1.8 --- NormalizedEntityPersister.java 9 Feb 2003 06:28:15 -0000 1.9 *************** *** 14,19 **** import net.sf.hibernate.mapping.Table; - import java.io.InvalidObjectException; - import java.io.ObjectStreamException; import java.io.Serializable; import java.sql.PreparedStatement; --- 14,17 ---- *************** *** 62,107 **** private final SessionFactoryImplementor factory; ! private transient final String qualifiedTableName; ! private transient final String[] tableNames; ! private transient final String[][] tableKeyColumns; ! private transient final String[] subclassTableNameClosure; ! private transient final String[][] subclassTableKeyColumns; ! private transient final boolean[] isClassOrSuperclassTable; ! private transient final String[] deleteStrings; ! private transient final String[] insertStrings; ! private transient final String[] identityInsertStrings; ! private transient final String[] updateStrings; ! private transient final int[] joinedFetch; ! private transient final int[] propertyColumnSpans; ! private transient final int[] propertyTables; ! private transient final boolean[] hasColumns; ! private transient final String[][] propertyColumnNames; ! private transient final String[][] propertyColumnNameAliases; ! private transient final boolean[] definedOnSubclass; ! private transient final String[][] subclassPropertyColumnNameClosure; ! private transient final int[] subclassPropertyTableNumberClosure; ! private transient final String[] subclassColumnClosure; ! private transient final String[] subclassColumnClosureAliases; ! private transient final int[] subclassColumnTableNumberClosure; ! private transient final Type[] subclassPropertyTypeClosure; ! private transient final Class[] subclassClosure; ! private transient final HashMap tableNumberByPropertyPath = new HashMap(); ! private transient final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private transient final String[] discriminators; ! private transient final String[] notNullColumns; ! private transient final int[] tableNumbers; ! private transient final DiscriminatorType discriminatorType; ! private transient final String discriminatorSQLString; ! private transient final String discriminatorColumnName; ! protected transient UniqueEntityLoader loader; ! //protected transient final Map loaders = new HashMap(); ! protected transient final Map lockers = new HashMap(); private static final String[] STRING_ARRAY = {}; --- 60,105 ---- private final SessionFactoryImplementor factory; ! private final String qualifiedTableName; ! private final String[] tableNames; ! private final String[][] tableKeyColumns; ! private final String[] subclassTableNameClosure; ! private final String[][] subclassTableKeyColumns; ! private final boolean[] isClassOrSuperclassTable; ! private final String[] deleteStrings; ! private final String[] insertStrings; ! private final String[] identityInsertStrings; ! private final String[] updateStrings; ! private final int[] joinedFetch; ! private final int[] propertyColumnSpans; ! private final int[] propertyTables; ! private final boolean[] hasColumns; ! private final String[][] propertyColumnNames; ! private final String[][] propertyColumnNameAliases; ! private final boolean[] definedOnSubclass; ! private final String[][] subclassPropertyColumnNameClosure; ! private final int[] subclassPropertyTableNumberClosure; ! private final String[] subclassColumnClosure; ! private final String[] subclassColumnClosureAliases; ! private final int[] subclassColumnTableNumberClosure; ! private final Type[] subclassPropertyTypeClosure; ! private final Class[] subclassClosure; ! private final HashMap tableNumberByPropertyPath = new HashMap(); ! private final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private final String[] discriminators; ! private final String[] notNullColumns; ! private final int[] tableNumbers; ! private final DiscriminatorType discriminatorType; ! private final String discriminatorSQLString; ! private final String discriminatorColumnName; ! protected UniqueEntityLoader loader; ! //protected final Map loaders = new HashMap(); ! protected final Map lockers = new HashMap(); private static final String[] STRING_ARRAY = {}; *************** *** 927,939 **** columnNamesByPropertyPath.put(path, names); - } - - Object readResolve() throws ObjectStreamException { - try { - return factory.getPersister( getMappedClass() ); - } - catch (MappingException me) { - throw new InvalidObjectException( me.getMessage() ); - } } --- 925,928 ---- |
From: <one...@us...> - 2003-02-09 06:28:18
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/jmx Modified Files: SessionFactoryStub.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: SessionFactoryStub.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/jmx/SessionFactoryStub.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SessionFactoryStub.java 26 Jan 2003 01:33:35 -0000 1.5 --- SessionFactoryStub.java 9 Feb 2003 06:28:15 -0000 1.6 *************** *** 88,92 **** //readResolveObject ! Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); --- 88,92 ---- //readResolveObject ! private Object readResolve() throws ObjectStreamException { // look for the instance by uuid Object result = SessionFactoryObjectFactory.getInstance(uuid); |
From: <one...@us...> - 2003-02-09 06:28:18
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv20713/hibernate/impl Modified Files: SessionFactoryImpl.java SessionImpl.java Log Message: standardised on dom4j fixed bugs in collection caching (sometimes an exception occurred) allowed null discriminators set autocommit to true in SchemaUpdate collections now deserialize correctly Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SessionFactoryImpl.java 3 Feb 2003 12:11:36 -0000 1.8 --- SessionFactoryImpl.java 9 Feb 2003 06:28:15 -0000 1.9 *************** *** 41,45 **** import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cache.Timestamper; ! import net.sf.hibernate.cfg.*; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.connection.ConnectionProvider; --- 41,46 ---- import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cache.Timestamper; ! import net.sf.hibernate.cfg.Configuration; ! import net.sf.hibernate.cfg.Environment; import net.sf.hibernate.collection.CollectionPersister; import net.sf.hibernate.connection.ConnectionProvider; *************** *** 77,81 **** * Concrete implementation of a SessionFactory * ! * IMMUTABLE */ --- 78,82 ---- * Concrete implementation of a SessionFactory * ! * IMMUTABLE (except for caches) */ *************** *** 452,456 **** } ! Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid --- 453,457 ---- } ! private Object readResolve() throws ObjectStreamException { log.trace("Resolving serialized SessionFactory"); // look for the instance by uuid Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SessionImpl.java 3 Feb 2003 10:28:47 -0000 1.17 --- SessionImpl.java 9 Feb 2003 06:28:15 -0000 1.18 *************** *** 136,140 **** } ! Object readResolve() throws ObjectStreamException { if ( name.equals(LOADED.name) ) return LOADED; if ( name.equals(DELETED.name) ) return DELETED; --- 136,140 ---- } ! private Object readResolve() throws ObjectStreamException { if ( name.equals(LOADED.name) ) return LOADED; if ( name.equals(DELETED.name) ) return DELETED; *************** *** 164,168 **** LockMode lockMode; ! LockMode nextLockMode; Status status; Serializable id; --- 164,168 ---- LockMode lockMode; ! transient LockMode nextLockMode; Status status; Serializable id; *************** *** 171,176 **** boolean existsInDatabase; Object lastVersion; ! Object nextVersion; ! ClassPersister persister; // for convenience to save some lookups EntityEntry(Status status, Object[] loadedState, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, ClassPersister persister) { --- 171,177 ---- boolean existsInDatabase; Object lastVersion; ! transient Object nextVersion; ! transient ClassPersister persister; // for convenience to save some lookups ! String className; EntityEntry(Status status, Object[] loadedState, Serializable id, Object version, LockMode lockMode, boolean existsInDatabase, ClassPersister persister) { *************** *** 182,185 **** --- 183,187 ---- this.lockMode = lockMode; this.persister = persister; + if (persister!=null) className = persister.getClassName(); } // called after a *successful* flush *************** *** 214,221 **** boolean initialized; transient CollectionPersister currentPersister; ! CollectionPersister loadedPersister; transient Serializable currentKey; Serializable loadedKey; Serializable snapshot; // session-start/post-flush persistent state CollectionEntry() { this.dirty = false; --- 216,224 ---- boolean initialized; transient CollectionPersister currentPersister; ! transient CollectionPersister loadedPersister; transient Serializable currentKey; Serializable loadedKey; Serializable snapshot; // session-start/post-flush persistent state + private String role; CollectionEntry() { this.dirty = false; *************** *** 226,236 **** this.initialized = initialized; this.loadedKey = loadedID; ! this.loadedPersister = loadedPersister; } CollectionEntry(CollectionSnapshot cs, SessionFactoryImplementor factory) throws MappingException { this.dirty = cs.getDirty(); this.snapshot = cs.getSnapshot(); ! this.loadedKey = cs.getLoadedKey(); ! this.loadedPersister = factory.getCollectionPersister( cs.getLoadedPersisterRole() ); this.initialized = true; } --- 229,241 ---- this.initialized = initialized; this.loadedKey = loadedID; ! setLoadedPersister(loadedPersister); } CollectionEntry(CollectionSnapshot cs, SessionFactoryImplementor factory) throws MappingException { this.dirty = cs.getDirty(); this.snapshot = cs.getSnapshot(); ! this.loadedKey = cs.getKey(); ! setLoadedPersister( ! factory.getCollectionPersister( cs.getRole() ) ! ); this.initialized = true; } *************** *** 270,274 **** if (!processed) throw new AssertionFailure("Hibernate has a bug processing collections"); loadedKey = currentKey; ! loadedPersister = currentPersister; dirty = false; if ( initialized && ( doremove || dorecreate || doupdate ) ) { --- 275,279 ---- if (!processed) throw new AssertionFailure("Hibernate has a bug processing collections"); loadedKey = currentKey; ! setLoadedPersister(currentPersister); dirty = false; if ( initialized && ( doremove || dorecreate || doupdate ) ) { *************** *** 279,287 **** return dirty; } ! public Serializable getLoadedKey() { return loadedKey; } ! public String getLoadedPersisterRole() { ! return loadedPersister.getRole(); } public Serializable getSnapshot() { --- 284,292 ---- return dirty; } ! public Serializable getKey() { return loadedKey; } ! public String getRole() { ! return role; } public Serializable getSnapshot() { *************** *** 291,295 **** dirty = true; } ! } --- 296,303 ---- dirty = true; } ! private void setLoadedPersister(CollectionPersister persister) { ! loadedPersister=persister; ! if (persister!=null) role=persister.getRole(); ! } } *************** *** 306,313 **** // different things. ! Iterator iter = collections.entrySet().iterator(); //TODO:fix this when we have Identity sets while ( iter.hasNext() ) { try { ! ( (PersistentCollection) ( (Map.Entry) iter.next() ).getKey() ).setSession(this); } catch (HibernateException he) { --- 314,326 ---- // different things. ! Iterator iter = collections.entrySet().iterator(); while ( iter.hasNext() ) { try { ! Map.Entry e = (Map.Entry) iter.next(); ! ( (PersistentCollection) e.getKey() ).setSession(this); ! CollectionEntry ce = (CollectionEntry) e.getValue(); ! ce.setLoadedPersister( ! factory.getCollectionPersister( ce.getRole() ) ! ); } catch (HibernateException he) { *************** *** 325,328 **** --- 338,352 ---- } } + + iter = entries.entrySet().iterator(); + while ( iter.hasNext() ) { + EntityEntry e = (EntityEntry) ( (Map.Entry) iter.next() ).getValue(); + try { + e.persister = factory.getPersister(e.className); + } + catch (MappingException me) { + throw new InvalidObjectException( me.getMessage() ); + } + } } *************** *** 956,960 **** if ( coll.wasInitialized() ) { CollectionSnapshot cs = coll.getCollectionSnapshot(); ! if (cs!=null && cs.getLoadedPersisterRole().equals( persister.getRole() ) && cs.getLoadedKey().equals(id) ) { if ( coll.setSession(this) ) addInitializedCollection(coll, cs); } --- 980,984 ---- if ( coll.wasInitialized() ) { CollectionSnapshot cs = coll.getCollectionSnapshot(); ! if (cs!=null && cs.getRole().equals( persister.getRole() ) && cs.getKey().equals(id) ) { if ( coll.setSession(this) ) addInitializedCollection(coll, cs); } |
From: <one...@us...> - 2003-02-05 12:21:52
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv5084 Modified Files: demo.sh demo.bat Log Message: added commons-beanutils to cp Index: demo.sh =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/demo.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** demo.sh 13 Jan 2003 09:11:52 -0000 1.2 --- demo.sh 5 Feb 2003 12:21:48 -0000 1.3 *************** *** 1,3 **** #!/bin/sh JDBC_DRIVER=/opt/pgsql/lib/postgresql-jdbc3-7.3.jar ! java -cp ./src:$JDBC_DRIVER:./lib/commons-logging.jar:./lib/commons-collections.jar:./lib/commons-lang.jar:./lib/cglib.jar:./lib/bcel.jar:./lib/odmg.jar:./lib/jdom.jar:./lib/xml-apis.jar:./lib/xerces.jar:./lib/xalan.jar:./hibernate.jar net.sf.hibernate.eg.NetworkDemo --- 1,3 ---- #!/bin/sh JDBC_DRIVER=/opt/pgsql/lib/postgresql-jdbc3-7.3.jar ! java -cp ./src:$JDBC_DRIVER:./lib/commons-logging.jar:./lib/commons-collections.jar:./lib/commons-lang.jar:./lib/commons-beanutils.jar:./lib/cglib.jar:./lib/bcel.jar:./lib/odmg.jar:./lib/jdom.jar:./lib/xml-apis.jar:./lib/xerces.jar:./lib/xalan.jar:./hibernate.jar net.sf.hibernate.eg.NetworkDemo Index: demo.bat =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/demo.bat,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** demo.bat 1 Jan 2003 13:42:55 -0000 1.1.1.1 --- demo.bat 5 Feb 2003 12:21:48 -0000 1.2 *************** *** 1,2 **** set JDBC_DRIVER=C:\Progra~1\SQLLIB\java\db2java.zip ! java -cp src;%JDBC_DRIVER%;lib\commons-logging.jar;lib\commons-collections.jar;lib\commons-lang.jar;lib\cglib.jar;lib\bcel.jar;lib\odmg.jar;lib\jdom.jar;lib\xml-apis.jar;lib\xerces.jar;lib\xalan.jar;hibernate.jar net.sf.hibernate.eg.NetworkDemo --- 1,2 ---- set JDBC_DRIVER=C:\Progra~1\SQLLIB\java\db2java.zip ! java -cp src;%JDBC_DRIVER%;lib\commons-logging.jar;lib\commons-collections.jar;lib\commons-beanutils.jar;lib\commons-lang.jar;lib\cglib.jar;lib\bcel.jar;lib\odmg.jar;lib\jdom.jar;lib\xml-apis.jar;lib\xerces.jar;lib\xalan.jar;hibernate.jar net.sf.hibernate.eg.NetworkDemo |
From: <one...@us...> - 2003-02-03 12:20:32
|
Update of /cvsroot/hibernate/Hibernate2 In directory sc8-pr-cvs1:/tmp/cvs-serv8988 Modified Files: build.xml Log Message: remove properties files from jar added an example cfg.xml Index: build.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/build.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build.xml 27 Jan 2003 13:03:51 -0000 1.5 --- build.xml 3 Feb 2003 12:20:29 -0000 1.6 *************** *** 50,53 **** --- 50,55 ---- <exclude name="build.xml"/> <exclude name="net/sf/hibernate/tool/hbm2java/test/*"/> + <exclude name="**/*.properties"/> + <exclude name="**/*.ccf"/> </patternset> |
From: <one...@us...> - 2003-02-03 12:20:32
|
Update of /cvsroot/hibernate/Hibernate2/src In directory sc8-pr-cvs1:/tmp/cvs-serv8988/src Added Files: hibernate.cfg.xml Log Message: remove properties files from jar added an example cfg.xml --- NEW FILE: hibernate.cfg.xml --- <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd"> <hibernate-configuration> <session-factory name="foo"> <property name="show_sql">true</property> <mapping resource="net/sf/hibernate/test/Simple.hbm.xml"/> <jcs-class-cache class="net.sf.hibernate.test.Simple" region="Simple" usage="read-write"/> </session-factory> </hibernate-configuration> |