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-04-19 03:26:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping In directory sc8-pr-cvs1:/tmp/cvs-serv24602/hibernate/mapping Modified Files: Property.java Log Message: * SessionFactory.close() now unbinds from JNDI * added Session.remove() * got rid of another unnecessry collection delete() Index: Property.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/mapping/Property.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Property.java 8 Apr 2003 09:49:31 -0000 1.10 --- Property.java 19 Apr 2003 03:26:09 -0000 1.11 *************** *** 64,68 **** } else if ( cascade.equals("save-update") ) { ! return Cascades.STYLE_EXCEPT_DELETE; } else if ( cascade.equals("delete") ) { --- 64,68 ---- } else if ( cascade.equals("save-update") ) { ! return Cascades.STYLE_SAVE_UPDATE; } else if ( cascade.equals("delete") ) { |
From: <one...@us...> - 2003-04-18 05:10:23
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection In directory sc8-pr-cvs1:/tmp/cvs-serv16387/hibernate/collection Modified Files: CollectionPersister.java Log Message: * code cleanups * collection where attribute now used for collection removal Index: CollectionPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/CollectionPersister.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CollectionPersister.java 6 Apr 2003 10:11:07 -0000 1.18 --- CollectionPersister.java 18 Apr 2003 05:09:49 -0000 1.19 *************** *** 31,35 **** import net.sf.hibernate.sql.Insert; import net.sf.hibernate.sql.SelectFragment; - import net.sf.hibernate.sql.SimpleSelect; import net.sf.hibernate.sql.Update; import net.sf.hibernate.type.EntityType; --- 31,34 ---- *************** *** 52,56 **** public final class CollectionPersister implements CollectionMetadata { ! private final String sqlSelectString; private final String sqlDeleteString; private final String sqlInsertRowString; --- 51,55 ---- public final class CollectionPersister implements CollectionMetadata { ! //private final String sqlSelectString; private final String sqlDeleteString; private final String sqlInsertRowString; *************** *** 185,194 **** } ! sqlSelectString = sqlSelectString(); ! sqlDeleteString = sqlDeleteString(); //sqlSelectRowString = sqlSelectRowString(); ! sqlInsertRowString = sqlInsertRowString(); ! sqlUpdateRowString = sqlUpdateRowString(); ! sqlDeleteRowString = sqlDeleteRowString(); isLazy = collection.isLazy(); --- 184,193 ---- } ! //sqlSelectString = sqlSelectString(); ! sqlDeleteString = generateDeleteString(); //sqlSelectRowString = sqlSelectRowString(); ! sqlInsertRowString = generateInsertRowString(); ! sqlUpdateRowString = generateUpdateRowString(); ! sqlDeleteRowString = generateDeleteRowString(); isLazy = collection.isLazy(); *************** *** 246,250 **** --- 245,262 ---- } + private static final java.util.Set keywords = new HashSet(); + static { + keywords.add("and"); + keywords.add("or"); + keywords.add("not"); + keywords.add("like"); + keywords.add("is"); + keywords.add("null"); + } + public String getSQLWhereString(String alias) { + // takes the where condition provided in the mapping + // attribute and interpolates the alias + //TODO: make this a bit nicer/quicker StringTokenizer tokens = new StringTokenizer(sqlWhereString, " =><!", true); StringBuffer result = new StringBuffer(); *************** *** 261,279 **** } - private static final java.util.Set keywords = new HashSet(); - static { - keywords.add("and"); - keywords.add("or"); - keywords.add("not"); - keywords.add("like"); - keywords.add("is"); - keywords.add("null"); - } - public String getSQLOrderByString(String alias) { StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); StringBuffer result = new StringBuffer(); while ( tokens.hasMoreTokens() ) { ! result.append(alias).append(StringHelper.DOT).append( tokens.nextToken().trim() ); if ( tokens.hasMoreTokens() ) result.append(StringHelper.COMMA_SPACE); } --- 273,286 ---- } public String getSQLOrderByString(String alias) { + // takes order by clause provided in the mapping + // attribute and interpolates the alias + //TODO: make this a bit nicer/quicker StringTokenizer tokens = new StringTokenizer(sqlOrderByString, ","); StringBuffer result = new StringBuffer(); while ( tokens.hasMoreTokens() ) { ! result.append(alias) ! .append(StringHelper.DOT) ! .append( tokens.nextToken().trim() ); if ( tokens.hasMoreTokens() ) result.append(StringHelper.COMMA_SPACE); } *************** *** 293,300 **** } - private String getSQLSelectString() { - return sqlSelectString; - } - private String getSQLDeleteString() { return sqlDeleteString; --- 300,303 ---- *************** *** 380,385 **** } ! private String sqlSelectString() { ! //TODO: Jon Lipsky's patch to allow a Map from id's to objects SimpleSelect select = new SimpleSelect() .setTableName(qualifiedTableName) --- 383,388 ---- } ! /*private String sqlSelectString() { ! //we no longer have Jon Lipsky's patch to allow a Map from id's to objects SimpleSelect select = new SimpleSelect() .setTableName(qualifiedTableName) *************** *** 387,412 **** if (hasIndex) select.addColumns(indexColumnNames); select.addCondition( keyColumnNames, "=?" ); if (hasOrder) select.setOrderBy(sqlOrderByString); return select.toStatementString(); ! } ! private String sqlDeleteString() { if (isOneToMany) { Update update = new Update() .setTableName(qualifiedTableName) ! .addColumns(keyColumnNames, "null"); if (hasIndex) update.addColumns(indexColumnNames, "null"); ! return update.setPrimaryKeyColumnNames(keyColumnNames) ! .toStatementString(); } else { ! return new Delete() .setTableName(qualifiedTableName) ! .setPrimaryKeyColumnNames(keyColumnNames) ! .toStatementString(); } } ! private String sqlInsertRowString() { if (isOneToMany) { Update update = new Update() --- 390,418 ---- if (hasIndex) select.addColumns(indexColumnNames); select.addCondition( keyColumnNames, "=?" ); + if (hasWhere) select.addWhereToken( " and " + sqlWhereString ); if (hasOrder) select.setOrderBy(sqlOrderByString); return select.toStatementString(); ! }*/ ! private String generateDeleteString() { if (isOneToMany) { Update update = new Update() .setTableName(qualifiedTableName) ! .addColumns(keyColumnNames, "null") ! .setPrimaryKeyColumnNames(keyColumnNames); if (hasIndex) update.addColumns(indexColumnNames, "null"); ! if (hasWhere) update.setWhere(sqlWhereString); ! return update.toStatementString(); } else { ! Delete delete = new Delete() .setTableName(qualifiedTableName) ! .setPrimaryKeyColumnNames(keyColumnNames); ! if (hasWhere) delete.setWhere(sqlWhereString); ! return delete.toStatementString(); } } ! private String generateInsertRowString() { if (isOneToMany) { Update update = new Update() *************** *** 427,431 **** } ! private String sqlUpdateRowString() { if (isOneToMany) { return null; --- 433,437 ---- } ! private String generateUpdateRowString() { if (isOneToMany) { return null; *************** *** 440,444 **** } ! private String sqlDeleteRowString() { String[] pkColumns = ArrayHelper.join(keyColumnNames, rowSelectColumnNames); if (isOneToMany) { --- 446,450 ---- } ! private String generateDeleteRowString() { String[] pkColumns = ArrayHelper.join(keyColumnNames, rowSelectColumnNames); if (isOneToMany) { |
From: <one...@us...> - 2003-04-18 05:09:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv16387/hibernate/test Modified Files: Baz.hbm.xml FooBarTest.java Log Message: * code cleanups * collection where attribute now used for collection removal Index: Baz.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Baz.hbm.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Baz.hbm.xml 5 Apr 2003 07:13:38 -0000 1.17 --- Baz.hbm.xml 18 Apr 2003 05:09:51 -0000 1.18 *************** *** 179,183 **** </map> ! <map name="stringGlarchMap" where="baz_map_index > 'a' and tha_key is not null" cascade="all"> <key column="baz_map_id"/> <index column="baz_map_index" type="string"/> --- 179,183 ---- </map> ! <map name="stringGlarchMap" where="baz_map_index > 'a' and tha_key is not null" cascade="all"> <key column="baz_map_id"/> <index column="baz_map_index" type="string"/> Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** FooBarTest.java 17 Apr 2003 08:09:13 -0000 1.55 --- FooBarTest.java 18 Apr 2003 05:09:51 -0000 1.56 *************** *** 352,355 **** --- 352,359 ---- s.delete("from Foo foo"); s.delete(baz); + int rows=s.connection().createStatement().executeUpdate( + "delete from fooArray where id_='" + baz.getCode() + "' and i>=8" + ); + assertTrue(rows==1); s.flush(); s.connection().commit(); *************** *** 808,811 **** --- 812,817 ---- s.delete( baz.getTopGlarchez().get( new Character('G') ) ); s.delete( baz.getTopGlarchez().get( new Character('H') ) ); + int rows = s.connection().createStatement().executeUpdate("update glarchez set baz_map_id=null where baz_map_index='a'"); + assertTrue(rows==1); assertTrue( s.delete("from bar in class net.sf.hibernate.test.Bar")==1 ); FooProxy[] arr = baz.getFooArray(); |
From: <one...@us...> - 2003-04-18 05:09:54
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv16387/hibernate/persister Modified Files: EntityPersister.java NormalizedEntityPersister.java Log Message: * code cleanups * collection where attribute now used for collection removal Index: EntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/EntityPersister.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** EntityPersister.java 6 Apr 2003 02:28:57 -0000 1.24 --- EntityPersister.java 18 Apr 2003 05:09:50 -0000 1.25 *************** *** 52,57 **** /** * The default implementation of the <tt>ClassPersister</tt> interface. ! * Implements the "table-per-class hierarchy" mapping strategy for an entity ! * class.<br> */ public class EntityPersister extends AbstractEntityPersister implements Queryable { --- 52,57 ---- /** * The default implementation of the <tt>ClassPersister</tt> interface. ! * Implements the "table-per-class-hierarchy" mapping strategy for an entity ! * class. */ public class EntityPersister extends AbstractEntityPersister implements Queryable { *************** *** 59,87 **** 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 boolean forceDiscriminator; private final String[] subclassColumnClosure; private final String[] subclassColumnAliasClosure; private final Type[] subclassPropertyTypeClosure; ! private final Class[] subclassClosure; ! private final boolean hasUpdateableColumns; ! private final int[] joinedFetch; private final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private final DiscriminatorType discriminatorType; private final String discriminatorSQLString; --- 59,95 ---- private final SessionFactoryImplementor factory; + // the class hierarchy structure private final String qualifiedTableName; private final String[] tableNames; + private final boolean hasUpdateableColumns; + private final Class[] subclassClosure; ! // SQL strings ! private final String sqlDeleteString; ! private final String sqlInsertString; ! private final String sqlUpdateString; ! private final String sqlIdentityInsertString; + // properties of this class, including inherited properties private final int[] propertyColumnSpans; ! private final boolean[] propertyDefinedOnSubclass; private final String[][] propertyColumnNames; private final String[][] propertyColumnAliases; ! // the closure of all columns used by the entire hierarchy including ! // subclasses and superclasses of this class private final String[] subclassColumnClosure; private final String[] subclassColumnAliasClosure; + + // the closure of all properties in the entire hierarchy including + // subclasses and superclasses of this class + private final String[][] subclassPropertyColumnNameClosure; private final Type[] subclassPropertyTypeClosure; ! private final int[] subclassPropertyEnableJoinedFetch; + // discriminator column private final HashMap subclassesByDiscriminatorValue = new HashMap(); ! private final boolean forceDiscriminator; ! private final String discriminatorColumnName; private final DiscriminatorType discriminatorType; private final String discriminatorSQLString; *************** *** 163,167 **** public boolean isDefinedOnSubclass(int i) { ! return definedOnSubclass[i]; } --- 171,175 ---- public boolean isDefinedOnSubclass(int i) { ! return propertyDefinedOnSubclass[i]; } *************** *** 171,175 **** public int enableJoinedFetch(int i) { ! return joinedFetch[i]; } --- 179,183 ---- public int enableJoinedFetch(int i) { ! return subclassPropertyEnableJoinedFetch[i]; } *************** *** 227,232 **** * The query that deletes a row by id (and version) */ ! protected final String sqlDelete() { ! return deleteString; } --- 235,240 ---- * The query that deletes a row by id (and version) */ ! protected final String getSQLDeleteString() { ! return sqlDeleteString; } *************** *** 234,239 **** * The query that inserts a row with a given id */ ! protected final String sqlInsert() { ! return insertString; } --- 242,247 ---- * The query that inserts a row with a given id */ ! protected final String getSQLInsertString() { ! return sqlInsertString; } *************** *** 241,246 **** * The query that inserts a row, letting the database generate an id */ ! protected final String sqlIdentityInsert() { ! return identityInsertString; } --- 249,254 ---- * The query that inserts a row, letting the database generate an id */ ! protected final String getSQLIdentityInsertString() { ! return sqlIdentityInsertString; } *************** *** 248,253 **** * The query that updates a row by id (and version) */ ! protected final String sqlUpdate() { ! return updateString; } --- 256,261 ---- * The query that updates a row by id (and version) */ ! protected final String getSQLUpdateString() { ! return sqlUpdateString; } *************** *** 427,431 **** // Render the SQL query ! PreparedStatement statement = session.getBatcher().prepareBatchStatement( sqlInsert() ); try { --- 435,439 ---- // Render the SQL query ! PreparedStatement statement = session.getBatcher().prepareBatchStatement( getSQLInsertString() ); try { *************** *** 458,462 **** // Render the SQL query ! PreparedStatement statement = session.getBatcher().prepareStatement( sqlIdentityInsert() ); try { --- 466,470 ---- // Render the SQL query ! PreparedStatement statement = session.getBatcher().prepareStatement( getSQLIdentityInsertString() ); try { *************** *** 513,520 **** final PreparedStatement statement;// = session.getPreparedStatement( sqlDelete() ); if ( isVersioned() ) { ! statement = session.getBatcher().prepareStatement( sqlDelete() ); } else { ! statement = session.getBatcher().prepareBatchStatement( sqlDelete() ); } --- 521,528 ---- final PreparedStatement statement;// = session.getPreparedStatement( sqlDelete() ); if ( isVersioned() ) { ! statement = session.getBatcher().prepareStatement( getSQLDeleteString() ); } else { ! statement = session.getBatcher().prepareBatchStatement( getSQLDeleteString() ); } *************** *** 564,568 **** } else { ! update(id, fields, getPropertyUpdateability(), oldVersion, object, sqlUpdate(), session); } } --- 572,576 ---- } else { ! update(id, fields, getPropertyUpdateability(), oldVersion, object, getSQLUpdateString(), session); } } *************** *** 729,747 **** subclassColumnAliasClosure = (String[]) aliases.toArray(STRING_ARRAY); ! joinedFetch = new int[ joinedFetchesList.size() ]; iter = joinedFetchesList.iterator(); int j=0; ! while ( iter.hasNext() ) joinedFetch[j++] = ( (Integer) iter.next() ).intValue(); ! definedOnSubclass = new boolean[ definedBySubclass.size() ]; iter = definedBySubclass.iterator(); j=0; ! while ( iter.hasNext() ) definedOnSubclass[j++] = ( (Boolean) iter.next() ).booleanValue(); ! deleteString = generateDeleteString(); ! insertString = generateInsertString( false, getPropertyInsertability() ); ! identityInsertString = isIdentifierAssignedByInsert() ? generateInsertString( true, getPropertyInsertability() ) : null; ! updateString = generateUpdateString( getPropertyUpdateability() ); String lockString = generateLockString(); --- 737,755 ---- subclassColumnAliasClosure = (String[]) aliases.toArray(STRING_ARRAY); ! subclassPropertyEnableJoinedFetch = new int[ joinedFetchesList.size() ]; iter = joinedFetchesList.iterator(); int j=0; ! while ( iter.hasNext() ) subclassPropertyEnableJoinedFetch[j++] = ( (Integer) iter.next() ).intValue(); ! propertyDefinedOnSubclass = new boolean[ definedBySubclass.size() ]; iter = definedBySubclass.iterator(); j=0; ! while ( iter.hasNext() ) propertyDefinedOnSubclass[j++] = ( (Boolean) iter.next() ).booleanValue(); ! sqlDeleteString = generateDeleteString(); ! sqlInsertString = generateInsertString( false, getPropertyInsertability() ); ! sqlIdentityInsertString = isIdentifierAssignedByInsert() ? generateInsertString( true, getPropertyInsertability() ) : null; ! sqlUpdateString = generateUpdateString( getPropertyUpdateability() ); String lockString = generateLockString(); Index: NormalizedEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/NormalizedEntityPersister.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NormalizedEntityPersister.java 6 Apr 2003 10:11:10 -0000 1.17 --- NormalizedEntityPersister.java 18 Apr 2003 05:09:50 -0000 1.18 *************** *** 60,93 **** 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; --- 60,105 ---- private final SessionFactoryImplementor factory; + // the class hierarchy structure private final String qualifiedTableName; private final String[] tableNames; private final String[][] tableKeyColumns; + + private final Class[] subclassClosure; private final String[] subclassTableNameClosure; private final String[][] subclassTableKeyColumns; private final boolean[] isClassOrSuperclassTable; ! // SQL strings ! private final String[] sqlDeleteStrings; ! private final String[] sqlInsertStrings; ! private final String[] sqlIdentityInsertStrings; ! private final String[] sqlUpdateStrings; ! // properties of this class, including inherited properties private final int[] propertyColumnSpans; private final int[] propertyTables; ! private final boolean[] propertyHasColumns; private final String[][] propertyColumnNames; private final String[][] propertyColumnNameAliases; ! ! // the closure of all properties in the entire hierarchy including ! // subclasses and superclasses of this class private final String[][] subclassPropertyColumnNameClosure; private final int[] subclassPropertyTableNumberClosure; + private final Type[] subclassPropertyTypeClosure; + private final int[] subclassPropertyEnableJoinedFetch; + private final boolean[] propertyDefinedOnSubclass; + private final HashMap tableNumberByPropertyPath = new HashMap(); + + // the closure of all columns used by the entire hierarchy including + // subclasses and superclasses of this class private final String[] subclassColumnClosure; private final String[] subclassColumnClosureAliases; private final int[] subclassColumnTableNumberClosure; + // subclass discrimination works by assigning particular + // values to certain combinations of null primary key + // values in the outer join using an SQL CASE private final HashMap subclassesByDiscriminatorValue = new HashMap(); private final String[] discriminators; *************** *** 100,106 **** protected UniqueEntityLoader loader; - //protected final Map loaders = new HashMap(); protected final Map lockers = new HashMap(); private static final String[] STRING_ARRAY = {}; private static final Type[] TYPE_ARRAY = {}; --- 112,119 ---- protected UniqueEntityLoader loader; protected final Map lockers = new HashMap(); + private final boolean[] allProperties; + private static final String[] STRING_ARRAY = {}; private static final Type[] TYPE_ARRAY = {}; *************** *** 158,162 **** public boolean isDefinedOnSubclass(int i) { ! return definedOnSubclass[i]; } --- 171,175 ---- public boolean isDefinedOnSubclass(int i) { ! return propertyDefinedOnSubclass[i]; } *************** *** 201,205 **** public int enableJoinedFetch(int i) { ! return joinedFetch[i]; } --- 214,218 ---- public int enableJoinedFetch(int i) { ! return subclassPropertyEnableJoinedFetch[i]; } *************** *** 215,243 **** /** ! * The query that deletes a row by id (and version) */ ! protected final String[] sqlDelete() { ! return deleteStrings; } /** ! * The query that inserts a row with a given id */ ! protected final String[] sqlInsert() { ! return insertStrings; } /** ! * The query that inserts a row, letting the database generate an id */ ! protected final String[] sqlIdentityInsert() { ! return identityInsertStrings; } /** ! * The query that updates a row by id (and version) */ ! protected final String[] sqlUpdate() { ! return updateStrings; } --- 228,256 ---- /** ! * The queries that delete rows by id (and version) */ ! protected final String[] getSQLDeleteStrings() { ! return sqlDeleteStrings; } /** ! * The queries that insert rows with a given id */ ! protected final String[] getSQLInsertStrings() { ! return sqlInsertStrings; } /** ! * The queries that insert rows, letting the database generate an id */ ! protected final String[] getSQLIdentityInsertStrings() { ! return sqlIdentityInsertStrings; } /** ! * The queries that update rows by id (and version) */ ! protected final String[] getSQLUpdateStrings() { ! return sqlUpdateStrings; } *************** *** 245,249 **** /** ! * Generate the SQL that deletes a row by id (and version) */ protected String[] generateDeleteStrings() { --- 258,262 ---- /** ! * Generate the SQL that deletes rows by id (and version) */ protected String[] generateDeleteStrings() { *************** *** 260,264 **** /** ! * Generate the SQL that inserts a row */ protected String[] generateInsertStrings(boolean identityInsert, boolean[] includeProperty) { --- 273,277 ---- /** ! * Generate the SQL that inserts rows */ protected String[] generateInsertStrings(boolean identityInsert, boolean[] includeProperty) { *************** *** 290,294 **** /** ! * Generate the SQL that updates a row by id (and version) */ protected String[] generateUpdateStrings(boolean[] includeProperty) { --- 303,307 ---- /** ! * Generate the SQL that updates rows by id (and version) */ protected String[] generateUpdateStrings(boolean[] includeProperty) { *************** *** 426,436 **** } - //TODO: precalculate this - private boolean[] allProperties() { - boolean[] result = new boolean[hydrateSpan]; - Arrays.fill(result, true); - return result; - } - /** * Persist an object --- 439,442 ---- *************** *** 448,452 **** for ( int i=0; i<tableNames.length; i++ ) { ! statements[i] = session.getBatcher().prepareStatement( sqlInsert()[i] ); } --- 454,458 ---- for ( int i=0; i<tableNames.length; i++ ) { ! statements[i] = session.getBatcher().prepareStatement( getSQLInsertStrings()[i] ); } *************** *** 481,489 **** } ! String[] sql = sqlIdentityInsert(); PreparedStatement statement = session.getBatcher().prepareStatement( sql[0] ); try { ! dehydrate(null, fields, allProperties(), 0, statement, session); statement.executeUpdate(); } --- 487,495 ---- } ! String[] sql = getSQLIdentityInsertStrings(); PreparedStatement statement = session.getBatcher().prepareStatement( sql[0] ); try { ! dehydrate(null, fields, allProperties, 0, statement, session); statement.executeUpdate(); } *************** *** 525,529 **** try { ! dehydrate(id, fields, allProperties(), i, statement, session); statement.executeUpdate(); } --- 531,535 ---- try { ! dehydrate(id, fields, allProperties, i, statement, session); statement.executeUpdate(); } *************** *** 556,560 **** for ( int i=0; i<tableNames.length; i++ ) { ! statements[i] = session.getBatcher().prepareStatement( sqlDelete()[i] ); } --- 562,566 ---- for ( int i=0; i<tableNames.length; i++ ) { ! statements[i] = session.getBatcher().prepareStatement( getSQLDeleteStrings()[i] ); } *************** *** 591,595 **** boolean[] tableUpdateNeeded; if (dirtyFields==null) { ! tableUpdateNeeded = hasColumns; // for objects that came in via update() } else { --- 597,601 ---- boolean[] tableUpdateNeeded; if (dirtyFields==null) { ! tableUpdateNeeded = propertyHasColumns; // for objects that came in via update() } else { *************** *** 613,617 **** } else { ! update(id, fields, getPropertyUpdateability(), tableUpdateNeeded, oldVersion, object, sqlUpdate(), session); } } --- 619,623 ---- } else { ! update(id, fields, getPropertyUpdateability(), tableUpdateNeeded, oldVersion, object, getSQLUpdateStrings(), session); } } *************** *** 811,827 **** subclassPropertyColumnNameClosure = (String[][]) propColumns.toArray( new String[ propColumns.size() ][] ); ! joinedFetch = new int[ joinedFetchesList.size() ]; iter = joinedFetchesList.iterator(); int j=0; ! while ( iter.hasNext() ) joinedFetch[j++] = ( (Integer) iter.next() ).intValue(); ! definedOnSubclass = new boolean[ definedBySubclass.size() ]; iter = definedBySubclass.iterator(); j=0; ! while ( iter.hasNext() ) definedOnSubclass[j++] = ( (Boolean) iter.next() ).booleanValue(); ! deleteStrings = generateDeleteStrings(); ! insertStrings = generateInsertStrings( false, getPropertyInsertability() ); ! identityInsertStrings = isIdentifierAssignedByInsert() ? generateInsertStrings( true, getPropertyInsertability() ) : null; ! updateStrings = generateUpdateStrings( getPropertyUpdateability() ); String lockString = generateLockString(); --- 817,833 ---- subclassPropertyColumnNameClosure = (String[][]) propColumns.toArray( new String[ propColumns.size() ][] ); ! subclassPropertyEnableJoinedFetch = new int[ joinedFetchesList.size() ]; iter = joinedFetchesList.iterator(); int j=0; ! while ( iter.hasNext() ) subclassPropertyEnableJoinedFetch[j++] = ( (Integer) iter.next() ).intValue(); ! propertyDefinedOnSubclass = new boolean[ definedBySubclass.size() ]; iter = definedBySubclass.iterator(); j=0; ! while ( iter.hasNext() ) propertyDefinedOnSubclass[j++] = ( (Boolean) iter.next() ).booleanValue(); ! sqlDeleteStrings = generateDeleteStrings(); ! sqlInsertStrings = generateInsertStrings( false, getPropertyInsertability() ); ! sqlIdentityInsertStrings = isIdentifierAssignedByInsert() ? generateInsertStrings( true, getPropertyInsertability() ) : null; ! sqlUpdateStrings = generateUpdateStrings( getPropertyUpdateability() ); String lockString = generateLockString(); *************** *** 880,887 **** } ! hasColumns = new boolean[updateStrings.length]; ! for ( int m=0; m<updateStrings.length; m++ ) { ! hasColumns[m] = updateStrings[m]!=null; } } --- 886,896 ---- } ! propertyHasColumns = new boolean[sqlUpdateStrings.length]; ! for ( int m=0; m<sqlUpdateStrings.length; m++ ) { ! propertyHasColumns[m] = sqlUpdateStrings[m]!=null; } + + allProperties = new boolean[hydrateSpan]; + Arrays.fill(allProperties, true); } *************** *** 964,968 **** // work on some dbs. Also it doesn't work if there // are multiple columns of results because it ! // is not accounting for the suffix. // return new String[] { getDiscriminatorColumnName() }; --- 973,977 ---- // work on some dbs. Also it doesn't work if there // are multiple columns of results because it ! // is not accounting for the suffix: // return new String[] { getDiscriminatorColumnName() }; |
From: <one...@us...> - 2003-04-18 05:09:54
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql In directory sc8-pr-cvs1:/tmp/cvs-serv16387/hibernate/sql Modified Files: Delete.java Update.java Log Message: * code cleanups * collection where attribute now used for collection removal Index: Delete.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/Delete.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Delete.java 20 Jan 2003 18:45:18 -0000 1.1 --- Delete.java 18 Apr 2003 05:09:51 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- private String[] primaryKeyColumnNames; private String versionColumnName; + private String where; public Delete setTableName(String tableName) { *************** *** 25,28 **** --- 26,33 ---- .append( StringHelper.join("=? and ", primaryKeyColumnNames) ) .append("=?"); + if (where!=null) { + buf.append(" and ") + .append(where); + } if (versionColumnName!=null) { buf.append(" and ") *************** *** 32,36 **** return buf.toString(); } ! public Delete setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) { this.primaryKeyColumnNames = primaryKeyColumnNames; --- 37,46 ---- return buf.toString(); } ! ! public Delete setWhere(String where) { ! this.where=where; ! return this; ! } ! public Delete setPrimaryKeyColumnNames(String[] primaryKeyColumnNames) { this.primaryKeyColumnNames = primaryKeyColumnNames; Index: Update.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/sql/Update.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Update.java 20 Jan 2003 18:45:18 -0000 1.1 --- Update.java 18 Apr 2003 05:09:51 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- private String primaryKeyColumnNames[]; private String versionColumnName; + private String where; private Map columns = new SequencedHashMap(); *************** *** 53,56 **** --- 54,62 ---- } + public Update setWhere(String where) { + this.where=where; + return this; + } + public String toStatementString() { StringBuffer buf = new StringBuffer( columns.size()*15 + tableName.length() + 10 ); *************** *** 69,72 **** --- 75,82 ---- .append( StringHelper.join("=? and ", primaryKeyColumnNames) ) .append("=?"); + if (where!=null) { + buf.append(" and ") + .append(where); + } if (versionColumnName!=null) { buf.append(" and ") |
From: <one...@us...> - 2003-04-17 08:09:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv15041/hibernate/test Modified Files: FooBarTest.java Log Message: allow polymorphic embedded composite-id classes add a test for outer-join=true Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** FooBarTest.java 15 Apr 2003 09:32:59 -0000 1.54 --- FooBarTest.java 17 Apr 2003 08:09:13 -0000 1.55 *************** *** 59,62 **** --- 59,91 ---- } + public void testForceOuterJoin() throws Exception { + Session s = sessions.openSession(); + Glarch g = new Glarch(); + FooComponent fc = new FooComponent(); + fc.setGlarch(g); + FooProxy f = new Foo(); + FooProxy f2 = new Foo(); + f.setComponent(fc); + f.setFoo(f2); + s.save(f2); + Serializable id = s.save(f); + Serializable gid = s.getIdentifier( f.getComponent().getGlarch() ); + s.flush(); + s.connection().commit(); + s.close(); + + s = sessions.openSession(); + f = (FooProxy) s.load(Foo.class, id); + assertFalse( Hibernate.isInitialized(f) ); + assertTrue( Hibernate.isInitialized( f.getComponent().getGlarch() ) ); //outer-join="true" + assertFalse( Hibernate.isInitialized( f.getFoo() ) ); //outer-join="auto" + assertEquals( s.getIdentifier( f.getComponent().getGlarch() ), gid ); + s.delete(f); + s.delete( f.getFoo() ); + s.flush(); + s.connection().commit(); + s.close(); + } + public void testEmptyCollection() throws Exception { Session s = sessions.openSession(); |
From: <one...@us...> - 2003-04-17 08:09:17
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv15041/hibernate/persister Modified Files: AbstractEntityPersister.java Log Message: allow polymorphic embedded composite-id classes add a test for outer-join=true Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AbstractEntityPersister.java 15 Apr 2003 04:19:16 -0000 1.21 --- AbstractEntityPersister.java 17 Apr 2003 08:09:12 -0000 1.22 *************** *** 40,43 **** --- 40,44 ---- import net.sf.hibernate.sql.SelectFragment; import net.sf.hibernate.type.AbstractComponentType; + import net.sf.hibernate.type.ComponentType; import net.sf.hibernate.type.IdentifierType; import net.sf.hibernate.type.Type; *************** *** 236,240 **** public void setIdentifier(Object object, Serializable id) throws HibernateException { ! if (identifierSetter!=null) { identifierSetter.set(object, id); } --- 237,245 ---- public void setIdentifier(Object object, Serializable id) throws HibernateException { ! if (hasEmbeddedIdentifier) { ! ComponentType copier = (ComponentType) identifierType; ! copier.setPropertyValues( object, copier.getPropertyValues(id) ); ! } ! else if (identifierSetter!=null) { identifierSetter.set(object, id); } *************** *** 245,249 **** */ public Object instantiate(Serializable id) throws HibernateException { ! if (hasEmbeddedIdentifier) { return id; } --- 250,254 ---- */ public Object instantiate(Serializable id) throws HibernateException { ! if ( hasEmbeddedIdentifier && id.getClass()==mappedClass ) { return id; } |
From: <one...@us...> - 2003-04-16 15:07:02
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/connection In directory sc8-pr-cvs1:/tmp/cvs-serv18954/connection Modified Files: DatasourceConnectionProvider.java Log Message: throw an exception instead of npe Index: DatasourceConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/connection/DatasourceConnectionProvider.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DatasourceConnectionProvider.java 27 Oct 2002 03:11:33 -0000 1.12 --- DatasourceConnectionProvider.java 16 Apr 2003 15:06:55 -0000 1.13 *************** *** 28,33 **** public void configure(Properties props) throws HibernateException { ! String jndi_name = props.getProperty(Environment.DATASOURCE); ! if (jndi_name==null) { String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; log.fatal(msg); --- 28,33 ---- public void configure(Properties props) throws HibernateException { ! String jndiName = props.getProperty(Environment.DATASOURCE); ! if (jndiName==null) { String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; log.fatal(msg); *************** *** 39,49 **** try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndi_name); } catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndi_name, e ); throw new HibernateException( "Could not find datasource", e ); } ! log.info( "Using datasource: " + jndi_name ); } --- 39,50 ---- try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndiName); } catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndiName, e ); throw new HibernateException( "Could not find datasource", e ); } ! if (ds==null) throw new HibernateException( "Could not find datasource" + jndiName ); ! log.info( "Using datasource: " + jndiName ); } |
From: <one...@us...> - 2003-04-16 15:06:08
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection In directory sc8-pr-cvs1:/tmp/cvs-serv18620/hibernate/connection Modified Files: DatasourceConnectionProvider.java Log Message: throw an exception instead of npe Index: DatasourceConnectionProvider.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/connection/DatasourceConnectionProvider.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DatasourceConnectionProvider.java 21 Mar 2003 12:03:36 -0000 1.6 --- DatasourceConnectionProvider.java 16 Apr 2003 15:05:54 -0000 1.7 *************** *** 31,36 **** public void configure(Properties props) throws HibernateException { ! String jndi_name = props.getProperty(Environment.DATASOURCE); ! if (jndi_name==null) { String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; log.fatal(msg); --- 31,36 ---- public void configure(Properties props) throws HibernateException { ! String jndiName = props.getProperty(Environment.DATASOURCE); ! if (jndiName==null) { String msg = "datasource JNDI name was not specified by property " + Environment.DATASOURCE; log.fatal(msg); *************** *** 42,52 **** try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndi_name); } catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndi_name, e ); throw new HibernateException( "Could not find datasource", e ); } ! log.info( "Using datasource: " + jndi_name ); } --- 42,53 ---- try { ! ds = (DataSource) NamingHelper.getInitialContext(props).lookup(jndiName); } catch (Exception e) { ! log.fatal( "Could not find datasource: " + jndiName, e ); throw new HibernateException( "Could not find datasource", e ); } ! if (ds==null) throw new HibernateException( "Could not find datasource: " + jndiName ); ! log.info( "Using datasource: " + jndiName ); } |
From: <one...@us...> - 2003-04-16 06:31:25
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv13811/loader Modified Files: Loader.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: Loader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader/Loader.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Loader.java 20 Mar 2003 13:58:46 -0000 1.36 --- Loader.java 16 Apr 2003 06:30:51 -0000 1.37 *************** *** 143,148 **** final List results = new ArrayList(); //new cirrus.hibernate.collections.List(this); ! final PreparedStatement st = prepareQueryStatement( getSQLString(), values, types, selection, false, session ); ! final ResultSet rs = getResultSet(st, namedParams, selection, session); try { --- 143,148 ---- final List results = new ArrayList(); //new cirrus.hibernate.collections.List(this); ! final PreparedStatement st = prepareQueryStatement( getSQLString(), values, types, namedParams, selection, false, session ); ! final ResultSet rs = getResultSet(st, selection, session); try { *************** *** 411,415 **** * Obtain a <tt>PreparedStatement</tt> and bind JDBC-style <tt>?</tt> parameters */ ! protected final PreparedStatement prepareQueryStatement(String sql, Object[] values, Type[] types, QueryImpl.RowSelection selection, boolean scroll, SessionImplementor session) throws SQLException, HibernateException { boolean scrollable = selection!=null && --- 411,415 ---- * Obtain a <tt>PreparedStatement</tt> and bind JDBC-style <tt>?</tt> parameters */ ! protected final PreparedStatement prepareQueryStatement(String sql, Object[] values, Type[] types, Map namedParams, QueryImpl.RowSelection selection, boolean scroll, SessionImplementor session) throws SQLException, HibernateException { boolean scrollable = selection!=null && *************** *** 420,424 **** try { ! if (selection!=null && selection.timeout!=null) st.setQueryTimeout( selection.timeout.intValue() ); --- 420,424 ---- try { ! if (selection!=null && selection.timeout!=null) st.setQueryTimeout( selection.timeout.intValue() ); *************** *** 429,432 **** --- 429,434 ---- } + bindNamedParameters(st, namedParams, types.length, session); + } catch (SQLException sqle) { *************** *** 468,474 **** * returning an SQL <tt>ResultSet</tt> */ ! private final ResultSet getResultSet(PreparedStatement st, Map namedParams, QueryImpl.RowSelection selection, SessionImplementor session) throws SQLException, HibernateException { try { - bindNamedParameters(st, namedParams, session); setMaxRows(st, selection); ResultSet rs = st.executeQuery(); --- 470,475 ---- * returning an SQL <tt>ResultSet</tt> */ ! private final ResultSet getResultSet(PreparedStatement st, QueryImpl.RowSelection selection, SessionImplementor session) throws SQLException, HibernateException { try { setMaxRows(st, selection); ResultSet rs = st.executeQuery(); *************** *** 481,488 **** throw sqle; } - catch (HibernateException he) { - closePreparedStatement(st, selection, session); - throw he; - } } --- 482,485 ---- *************** *** 491,495 **** * superclass and should be implemented by subclasses (queries) which allow named parameters. */ ! protected void bindNamedParameters(PreparedStatement st, Map namedParams, SessionImplementor session) throws SQLException, HibernateException {} /** --- 488,492 ---- * superclass and should be implemented by subclasses (queries) which allow named parameters. */ ! protected void bindNamedParameters(PreparedStatement st, Map namedParams, int start, SessionImplementor session) throws SQLException, HibernateException {} /** |
From: <one...@us...> - 2003-04-16 06:31:23
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv13811/impl Modified Files: FilterImpl.java QueryImpl.java SessionImpl.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: FilterImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/FilterImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FilterImpl.java 26 Nov 2002 03:35:42 -0000 1.2 --- FilterImpl.java 16 Apr 2003 06:30:50 -0000 1.3 *************** *** 2,7 **** --- 2,9 ---- import java.sql.SQLException; + import java.util.HashMap; import java.util.Iterator; import java.util.List; + import java.util.Map; import cirrus.hibernate.HibernateException; *************** *** 24,42 **** /** ! * @see cirrus.hibernate.Query#iterate() */ ! public Iterator iterate() throws SQLException, HibernateException { ! values.add(0, null); ! types.add(0, null); ! return session.iterateFilter(collection, queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } ! /** ! * @see cirrus.hibernate.Query#list() */ ! public List list() throws SQLException, HibernateException { ! values.add(0, null); ! types.add(0, null); ! return session.filter(collection, queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } --- 26,44 ---- /** ! * @see net.sf.hibernate.Query#iterate() */ ! public Iterator iterate() throws HibernateException, SQLException { ! Map namedParams = new HashMap( getNamedParams() ); ! String query = bindParameterLists(namedParams); ! return getSession().iterateFilter(collection, query, valueArray(), typeArray(), getSelection(), namedParams); } ! /** ! * @see net.sf.hibernate.Query#list() */ ! public List list() throws HibernateException, SQLException { ! Map namedParams = new HashMap( getNamedParams() ); ! String query = bindParameterLists(namedParams); ! return getSession().filter(collection, query, valueArray(), typeArray(), getSelection(), namedParams); } *************** *** 48,50 **** --- 50,68 ---- } + private Type[] typeArray() { + List typeList = getTypes(); + int size = typeList.size(); + Type[] result = new Type[size+1]; + for (int i=0; i<size; i++) result[i+1] = (Type) typeList.get(i); + return result; + } + + private Object[] valueArray() { + List valueList = getValues(); + int size = valueList.size(); + Object[] result = new Object[size+1]; + for (int i=0; i<size; i++) result[i+1] = valueList.get(i); + return result; + } + } Index: QueryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/QueryImpl.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** QueryImpl.java 13 Mar 2003 02:52:19 -0000 1.26 --- QueryImpl.java 16 Apr 2003 06:30:50 -0000 1.27 *************** *** 35,42 **** String queryString; ! RowSelection selection; ! ArrayList values = new ArrayList(4); ! ArrayList types = new ArrayList(4); ! Map namedParams = new HashMap(4); public QueryImpl(String queryString, SessionImplementor session) { --- 35,43 ---- String queryString; ! private RowSelection selection; ! private ArrayList values = new ArrayList(4); ! private ArrayList types = new ArrayList(4); ! private Map namedParameters = new HashMap(4); ! private Map namedParameterLists = new HashMap(4); public QueryImpl(String queryString, SessionImplementor session) { *************** *** 63,75 **** public Iterator iterate() throws SQLException, HibernateException { ! return session.iterate(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } public ScrollableResults scroll() throws SQLException, HibernateException { ! return session.scroll(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } public List list() throws SQLException, HibernateException { ! return session.find(queryString, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } --- 64,82 ---- public Iterator iterate() throws SQLException, HibernateException { ! Map namedParams = new HashMap(namedParameters); ! String query = bindParameterLists(namedParams); ! return session.iterate(query, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } public ScrollableResults scroll() throws SQLException, HibernateException { ! Map namedParams = new HashMap(namedParameters); ! String query = bindParameterLists(namedParams); ! return session.scroll(query, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } public List list() throws SQLException, HibernateException { ! Map namedParams = new HashMap(namedParameters); ! String query = bindParameterLists(namedParams); ! return session.find(query, values.toArray(), (Type[]) types.toArray(NO_TYPES), selection, namedParams); } *************** *** 235,239 **** public void setParameter(String name, Object val, Type type) { ! namedParams.put(name, new TypedValue(type, val) ); } --- 242,246 ---- public void setParameter(String name, Object val, Type type) { ! namedParameters.put(name, new TypedValue(type, val) ); } *************** *** 308,324 **** public void setParameterList(String name, Collection vals, Type type) throws HibernateException { ! ! StringBuffer list = new StringBuffer(16); ! Iterator iter = vals.iterator(); ! int i=0; ! while ( iter.hasNext() ) { ! String alias = name + i++ + '_'; ! setParameter(alias, iter.next(), type); ! list.append( ':' + alias ); ! if ( iter.hasNext() ) list.append(", "); ! } ! queryString = StringHelper.replaceOnce( queryString, ':' + name, list.toString() ); } ! public void setParameterList(String name, Collection vals) throws HibernateException, SQLException { setParameterList(name, vals, guessType( vals.iterator().next() ) ); --- 315,321 ---- public void setParameterList(String name, Collection vals, Type type) throws HibernateException { ! namedParameterLists.put( name, new TypedValue(type, vals) ); } ! public void setParameterList(String name, Collection vals) throws HibernateException, SQLException { setParameterList(name, vals, guessType( vals.iterator().next() ) ); *************** *** 346,348 **** --- 343,391 ---- } + SessionImplementor getSession() { + return session; + } + + ArrayList getValues() { + return values; + } + + ArrayList getTypes() { + return types; + } + + Map getNamedParams() { + return namedParameters; + } + + RowSelection getSelection() { + return selection; + } + + protected String bindParameterLists(Map namedParams) { + Iterator iter = namedParameterLists.entrySet().iterator(); + String query = queryString; + while ( iter.hasNext() ) { + Map.Entry me = (Map.Entry) iter.next(); + query = bindParameterList( queryString, (String) me.getKey(), (TypedValue) me.getValue(), namedParams ); + } + return query; + } + private String bindParameterList(String queryString, String name, TypedValue typedList, Map namedParams) { + Collection vals = (Collection) typedList.value; + Type type = typedList.type; + StringBuffer list = new StringBuffer(16); + Iterator iter = vals.iterator(); + int i=0; + while ( iter.hasNext() ) { + String alias = name + i++ + "_"; + namedParams.put(alias, new TypedValue( type, iter.next() ) ); + list.append( ':' + alias ); + if ( iter.hasNext() ) list.append(", "); + } + + return StringHelper.replace( queryString, ':' + name, list.toString() ); + } + + } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/impl/SessionImpl.java,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** SessionImpl.java 20 Mar 2003 13:58:45 -0000 1.165 --- SessionImpl.java 16 Apr 2003 06:30:50 -0000 1.166 *************** *** 648,652 **** ! if (object==self) return false; // was a reference to self, so don't need to nullify // See if the entity is already bound to this session, if not look at the --- 648,652 ---- ! if (object==self) return earlyInsert; // was a reference to self, so don't need to nullify (unless id is generated by identity column) // See if the entity is already bound to this session, if not look at the |
From: <one...@us...> - 2003-04-16 06:31:23
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/cfg In directory sc8-pr-cvs1:/tmp/cvs-serv13811/cfg Modified Files: Configuration.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: Configuration.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/cfg/Configuration.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Configuration.java 8 Oct 2002 14:39:21 -0000 1.13 --- Configuration.java 16 Apr 2003 06:30:50 -0000 1.14 *************** *** 54,57 **** --- 54,59 ---- * * @see Hibernate#configure() + * @see Environment + * @see SessionFactory */ public class Configuration { |
From: <one...@us...> - 2003-04-16 06:31:23
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate In directory sc8-pr-cvs1:/tmp/cvs-serv13811 Modified Files: Environment.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: Environment.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/Environment.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** Environment.java 27 Jan 2003 13:48:53 -0000 1.84 --- Environment.java 16 Apr 2003 06:30:49 -0000 1.85 *************** *** 39,43 **** public final class Environment { ! private static final String VERSION = "1.2.3"; /** --- 39,43 ---- public final class Environment { ! private static final String VERSION = "1.2.4"; /** |
From: <one...@us...> - 2003-04-16 06:30:58
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv13811/test Modified Files: FooBarTest.java MasterDetailTest.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/FooBarTest.java,v retrieving revision 1.243 retrieving revision 1.244 diff -C2 -d -r1.243 -r1.244 *** FooBarTest.java 4 Apr 2003 13:58:16 -0000 1.243 --- FooBarTest.java 16 Apr 2003 06:30:54 -0000 1.244 *************** *** 1251,1254 **** --- 1251,1255 ---- s = sessions.openSession(); g = (GlarchProxy) s.load(Glarch.class, gid); + assertFalse( g instanceof Glarch ); assertTrue( g.getStrings().size()==1 ); assertTrue( g.getProxyArray().length==1 ); Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/test/MasterDetailTest.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** MasterDetailTest.java 9 Jan 2003 09:40:20 -0000 1.43 --- MasterDetailTest.java 16 Apr 2003 06:30:55 -0000 1.44 *************** *** 13,16 **** --- 13,18 ---- import java.io.ObjectOutputStream; import java.io.Serializable; + import java.util.ArrayList; + import java.util.Collection; import java.util.HashSet; import java.util.Iterator; *************** *** 87,90 **** --- 89,93 ---- Serializable did = s.save(d1); Detail d2 = new Detail(); + d2.setI(12); d2.setMaster(master); assertTrue( s.save(d2)!=null, "generated id returned"); *************** *** 131,134 **** --- 134,152 ---- assertTrue( s.createFilter( master.getDetails(), "select this.master" ).list().size()==2 ); + + Query f = s.createFilter( master.getDetails(), "select max(this.i) where this.i < :top and this.i>=:bottom" ); + f.setInteger("top", 100); + f.setInteger("bottom", 0); + assertEquals( f.iterate().next(), new Integer(12) ); + f.setInteger("top", 2); + assertEquals( f.iterate().next(), new Integer(0) ); + + f = s.createFilter( master.getDetails(), "select max(this.i) where this.i not in (:list)" ); + Collection coll = new ArrayList(); + coll.add( new Integer(-666) ); + coll.add( new Integer(22) ); + coll.add( new Integer(0) ); + f.setParameterList("list", coll); + assertEquals( f.iterate().next(), new Integer(12) ); iter = master.getDetails().iterator(); |
From: <one...@us...> - 2003-04-16 06:30:57
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/query In directory sc8-pr-cvs1:/tmp/cvs-serv13811/query Modified Files: QueryTranslator.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: QueryTranslator.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/query/QueryTranslator.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** QueryTranslator.java 4 Mar 2003 10:43:06 -0000 1.53 --- QueryTranslator.java 16 Apr 2003 06:30:54 -0000 1.54 *************** *** 781,785 **** ! protected void bindNamedParameters(PreparedStatement ps, Map namedParams, SessionImplementor session) throws SQLException, HibernateException { if (namedParams!=null) { Iterator iter = namedParams.entrySet().iterator(); --- 781,785 ---- ! protected void bindNamedParameters(PreparedStatement ps, Map namedParams, int start, SessionImplementor session) throws SQLException, HibernateException { if (namedParams!=null) { Iterator iter = namedParams.entrySet().iterator(); *************** *** 790,794 **** int[] locs = getNamedParameterLocs(name); for ( int i=0; i<locs.length; i++ ) { ! typedval.type.nullSafeSet( ps, typedval.value, locs[i], session ); } } --- 790,794 ---- int[] locs = getNamedParameterLocs(name); for ( int i=0; i<locs.length; i++ ) { ! typedval.type.nullSafeSet( ps, typedval.value, locs[i] + start, session ); } } *************** *** 798,804 **** public Iterator iterate(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, false, session ); try { - bindNamedParameters(st, namedParams, session); setMaxRows(st, selection); ResultSet rs = st.executeQuery(); --- 798,803 ---- public Iterator iterate(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, namedParams, selection, false, session ); try { setMaxRows(st, selection); ResultSet rs = st.executeQuery(); *************** *** 815,821 **** public ScrollableResults scroll(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, selection, true, session ); try { - bindNamedParameters(st, namedParams, session); setMaxRows(st, selection); ResultSet rs = st.executeQuery(); --- 814,819 ---- public ScrollableResults scroll(Object[] values, Type[] types, QueryImpl.RowSelection selection, Map namedParams, SessionImplementor session) throws HibernateException, SQLException { ! PreparedStatement st = prepareQueryStatement( getScalarSelectSQL(), values, types, namedParams, selection, true, session ); try { setMaxRows(st, selection); ResultSet rs = st.executeQuery(); *************** *** 841,845 **** } ArrayList list = new ArrayList(); ! PreparedStatement st = prepareQueryStatement( getSelectIdentifiersSQL(), values, types, null, false, session ); try { ResultSet rs = st.executeQuery(); --- 839,843 ---- } ArrayList list = new ArrayList(); ! PreparedStatement st = prepareQueryStatement( getSelectIdentifiersSQL(), values, types, null, null, false, session ); try { ResultSet rs = st.executeQuery(); |
From: <one...@us...> - 2003-04-16 06:30:57
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/proxy In directory sc8-pr-cvs1:/tmp/cvs-serv13811/proxy Modified Files: CGLIBLazyInitializer.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: CGLIBLazyInitializer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/proxy/CGLIBLazyInitializer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CGLIBLazyInitializer.java 26 Nov 2002 03:35:44 -0000 1.6 --- CGLIBLazyInitializer.java 16 Apr 2003 06:30:54 -0000 1.7 *************** *** 24,28 **** try { return (HibernateProxy) Enhancer.enhance( ! persistentClass, interfaces, new CGLIBLazyInitializer(persistentClass, interfaces, id, getIdentifierMethod, session), --- 24,28 ---- try { return (HibernateProxy) Enhancer.enhance( ! (interfaces.length==1) ? persistentClass : null, interfaces, new CGLIBLazyInitializer(persistentClass, interfaces, id, getIdentifierMethod, session), |
From: <one...@us...> - 2003-04-16 06:30:56
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister In directory sc8-pr-cvs1:/tmp/cvs-serv13811/persister Modified Files: AbstractEntityPersister.java Log Message: bugfixes from 2.0 stream * now uses interface proxies correctly * bugfixes to Filters * reference to self for a native id Index: AbstractEntityPersister.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/persister/AbstractEntityPersister.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AbstractEntityPersister.java 4 Apr 2003 13:58:12 -0000 1.22 --- AbstractEntityPersister.java 16 Apr 2003 06:30:52 -0000 1.23 *************** *** 492,497 **** try { proxyGetter = ReflectHelper.getGetter( ! //model.getProxyInterface(), //for old dynamic proxies ! mappedClass, identifierPropertyName ).getMethod(); --- 492,496 ---- try { proxyGetter = ReflectHelper.getGetter( ! model.getProxyInterface(), identifierPropertyName ).getMethod(); |
From: <one...@us...> - 2003-04-16 06:20:51
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv11881/hibernate/test Modified Files: MasterDetailTest.java Log Message: added test code Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetailTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MasterDetailTest.java 16 Apr 2003 04:54:32 -0000 1.8 --- MasterDetailTest.java 16 Apr 2003 06:20:43 -0000 1.9 *************** *** 8,11 **** --- 8,12 ---- import java.io.Serializable; import java.util.ArrayList; + import java.util.Collection; import java.util.HashSet; import java.util.Iterator; *************** *** 107,110 **** --- 108,112 ---- Serializable did = s.save(d1); Detail d2 = new Detail(); + d2.setI(12); d2.setMaster(master); assertTrue( s.save(d2)!=null, "generated id returned"); *************** *** 167,170 **** --- 169,187 ---- assertTrue( s.createFilter( master.getDetails(), "select this.master" ).list().size()==2 ); + + Query f = s.createFilter( master.getDetails(), "select max(this.i) where this.i < :top and this.i>=:bottom" ); + f.setInteger("top", 100); + f.setInteger("bottom", 0); + assertEquals( f.iterate().next(), new Integer(12) ); + f.setInteger("top", 2); + assertEquals( f.iterate().next(), new Integer(0) ); + + f = s.createFilter( master.getDetails(), "select max(this.i) where this.i not in (:list)" ); + Collection coll = new ArrayList(); + coll.add( new Integer(-666) ); + coll.add( new Integer(22) ); + coll.add( new Integer(0) ); + f.setParameterList("list", coll); + assertEquals( f.iterate().next(), new Integer(12) ); iter = master.getDetails().iterator(); |
From: <one...@us...> - 2003-04-16 06:20:50
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv11881/hibernate/impl Modified Files: QueryImpl.java Log Message: added test code Index: QueryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/QueryImpl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** QueryImpl.java 8 Apr 2003 09:49:30 -0000 1.13 --- QueryImpl.java 16 Apr 2003 06:20:42 -0000 1.14 *************** *** 380,384 **** } - public Query setParameterList(String name, Collection vals) throws HibernateException { setParameterList(name, vals, guessType( vals.iterator().next() ) ); --- 380,383 ---- |
From: <one...@us...> - 2003-04-16 04:54:37
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv19760/hibernate/impl Modified Files: ScheduledCollectionRemove.java SessionImpl.java Log Message: removed unnecessary collection delete when collection snapshot is empty Index: ScheduledCollectionRemove.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionRemove.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ScheduledCollectionRemove.java 2 Feb 2003 04:19:51 -0000 1.5 --- ScheduledCollectionRemove.java 16 Apr 2003 04:54:32 -0000 1.6 *************** *** 9,21 **** import net.sf.hibernate.engine.SessionImplementor; ! final class ScheduledCollectionRemove extends ScheduledCollectionAction implements SessionImpl.Executable { ! public ScheduledCollectionRemove(CollectionPersister persister, Serializable id, SessionImplementor session) { super(persister, id, session); } public void execute() throws SQLException, HibernateException { persister.softlock(id); ! persister.remove(id, session); } --- 9,24 ---- import net.sf.hibernate.engine.SessionImplementor; ! final class ScheduledCollectionRemove extends ScheduledCollectionAction implements SessionImpl.Executable { ! private boolean emptySnapshot; ! ! public ScheduledCollectionRemove(CollectionPersister persister, Serializable id, boolean emptySnapshot, SessionImplementor session) { super(persister, id, session); + this.emptySnapshot = emptySnapshot; } public void execute() throws SQLException, HibernateException { persister.softlock(id); ! if (!emptySnapshot) persister.remove(id, session); } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** SessionImpl.java 16 Apr 2003 01:13:27 -0000 1.34 --- SessionImpl.java 16 Apr 2003 04:54:32 -0000 1.35 *************** *** 11,14 **** --- 11,15 ---- import java.io.ObjectStreamException; import java.io.Serializable; + import java.lang.reflect.Array; import java.sql.SQLException; import java.sql.Connection; *************** *** 311,314 **** --- 312,324 ---- return snapshot; } + public boolean snapshotIsEmpty() { + //TODO: implementation here is non-extensible ... + //should use polymorphism + return initialized && snapshot!=null && ( + ( snapshot instanceof Collection && ( (Collection) snapshot ).size()==0 ) || // if snapshot is a collection + ( snapshot instanceof Map && ( (Map) snapshot ).size()==0 ) || // if snapshot is a map + ( snapshot.getClass().isArray() && Array.getLength(snapshot)==0 )// if snapshot is an array + ); + } public void setDirty() { dirty = true; *************** *** 1025,1029 **** private void removeCollection(CollectionPersister role, Serializable id) { ! collectionRemovals.add( new ScheduledCollectionRemove(role, id, this) ); } --- 1035,1039 ---- private void removeCollection(CollectionPersister role, Serializable id) { ! collectionRemovals.add( new ScheduledCollectionRemove(role, id, false, this) ); } *************** *** 2262,2266 **** if ( ce.dorecreate ) collectionCreations.add( new ScheduledCollectionRecreate(coll, ce.currentPersister, ce.currentKey, this) ); ! if ( ce.doremove ) collectionRemovals.add( new ScheduledCollectionRemove(ce.loadedPersister, ce.loadedKey, this) ); if ( ce.doupdate ) collectionUpdates.add( new ScheduledCollectionUpdate(coll, ce.loadedPersister, ce.loadedKey, this) ); --- 2272,2276 ---- if ( ce.dorecreate ) collectionCreations.add( new ScheduledCollectionRecreate(coll, ce.currentPersister, ce.currentKey, this) ); ! if ( ce.doremove ) collectionRemovals.add( new ScheduledCollectionRemove(ce.loadedPersister, ce.loadedKey, ce.snapshotIsEmpty(), this) ); if ( ce.doupdate ) collectionUpdates.add( new ScheduledCollectionUpdate(coll, ce.loadedPersister, ce.loadedKey, this) ); *************** *** 2460,2464 **** if (entry.currentPersister!=null) entry.dorecreate = true; // we will need to create new entries ! if (entry.loadedPersister!=null) { entry.doremove = true; // we will need to remove ye olde entries if (entry.dorecreate) { --- 2470,2474 ---- if (entry.currentPersister!=null) entry.dorecreate = true; // we will need to create new entries ! if ( entry.loadedPersister!=null ) { entry.doremove = true; // we will need to remove ye olde entries if (entry.dorecreate) { |
From: <one...@us...> - 2003-04-16 04:54:36
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv19760/hibernate/test Modified Files: Master.java MasterDetail.hbm.xml MasterDetailTest.java Log Message: removed unnecessary collection delete when collection snapshot is empty Index: Master.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Master.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Master.java 20 Mar 2003 13:59:10 -0000 1.4 --- Master.java 16 Apr 2003 04:54:32 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- public class Master implements Serializable, Named { + private Master otherMaster; private Set details = new HashSet(); private Set moreDetails = new HashSet(); *************** *** 105,108 **** --- 106,123 ---- } + /** + * @return + */ + public Master getOtherMaster() { + return otherMaster; + } + + /** + * @param master + */ + public void setOtherMaster(Master master) { + otherMaster = master; + } + } Index: MasterDetail.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetail.hbm.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MasterDetail.hbm.xml 29 Mar 2003 07:36:22 -0000 1.7 --- MasterDetail.hbm.xml 16 Apr 2003 04:54:32 -0000 1.8 *************** *** 30,33 **** --- 30,34 ---- </set> <!-- <cache timeout="10000" type="readwrite"/> --> + <many-to-one name="otherMaster"/> </class> Index: MasterDetailTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MasterDetailTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MasterDetailTest.java 8 Apr 2003 09:49:34 -0000 1.7 --- MasterDetailTest.java 16 Apr 2003 04:54:32 -0000 1.8 *************** *** 29,32 **** --- 29,50 ---- } + public void testSelfManyToOne() throws Exception { + Session s = sessions.openSession(); + Transaction t = s.beginTransaction(); + Master m = new Master(); + m.setOtherMaster(m); + s.save(m); + t.commit(); + s.close(); + s = sessions.openSession(); + t = s.beginTransaction(); + Iterator i = s.iterate("from m in class Master"); + m = (Master) i.next(); + assertTrue( m.getOtherMaster()==m ); + s.delete(m); + t.commit(); + s.close(); + } + public void testNonLazyBidirectional() throws Exception { Session s = sessions.openSession(); |
From: <one...@us...> - 2003-04-16 01:13:32
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv23316/hibernate/test Modified Files: MultiTableTest.java Log Message: fixed a bug where references to self from an entity with a natively generated id were not getting nullified Index: MultiTableTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/MultiTableTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** MultiTableTest.java 6 Apr 2003 10:11:11 -0000 1.13 --- MultiTableTest.java 16 Apr 2003 01:13:28 -0000 1.14 *************** *** 364,368 **** public void testMultiTableCollections() throws Exception { ! if ( dialect instanceof SybaseDialect ) return; Session s = sessions.openSession(); --- 364,368 ---- public void testMultiTableCollections() throws Exception { ! //if ( dialect instanceof SybaseDialect ) return; Session s = sessions.openSession(); *************** *** 377,382 **** simp.setName("simp"); //simp.setCount(132); ! s.save( multi, new Long(123) ); ! s.save( simp, new Long(1234) ); LessSimple ls = new LessSimple(); ls.setOther(ls); --- 377,392 ---- simp.setName("simp"); //simp.setCount(132); ! Serializable mid; ! Serializable sid; ! if ( dialect instanceof SybaseDialect ) { ! mid = s.save(multi); ! sid = s.save(simp); ! } ! else { ! mid = new Long(123); ! sid = new Long(1234); ! s.save(multi, mid); ! s.save(simp, sid); ! } LessSimple ls = new LessSimple(); ls.setOther(ls); *************** *** 388,398 **** set.add(multi); set.add(simp); ! s.save( ls, new Long(2) ); t.commit(); s.close(); ! s = sessions.openSession(); t = s.beginTransaction(); ! ls = (LessSimple) s.load( LessSimple.class, new Long(2) ); assertTrue( ls.getOther()==ls && ls.getAnother()==ls && ls.getYetanother()==ls ); assertTrue( ls.getSet().size()==2 ); --- 398,416 ---- set.add(multi); set.add(simp); ! Serializable id; ! if ( dialect instanceof SybaseDialect ) { ! id = s.save(ls); ! } ! else { ! id = new Long(2); ! s.save( ls, new Long(2) ); ! } t.commit(); s.close(); ! assertTrue( ls.getOther()==ls && ls.getAnother()==ls && ls.getYetanother()==ls ); ! s = sessions.openSession(); t = s.beginTransaction(); ! ls = (LessSimple) s.load(LessSimple.class, id); assertTrue( ls.getOther()==ls && ls.getAnother()==ls && ls.getYetanother()==ls ); assertTrue( ls.getSet().size()==2 ); *************** *** 407,410 **** --- 425,477 ---- assertTrue( foundSimple==2 && foundMulti==1 ); assertTrue( s.delete("from s in class Simple")==3 ); + t.commit(); + s.close(); + } + + public void testMultiTableManyToOne() throws Exception { + + Session s = sessions.openSession(); + Transaction t = s.beginTransaction(); + assertTrue( s.find("from s in class Simple").size()==0 ); + Multi multi = new Multi(); + multi.setExtraProp("extra"); + //multi.setCount(666); + multi.setName("name"); + Simple simp = new Simple(); + simp.setDate( new Date() ); + simp.setName("simp"); + //simp.setCount(132); + Serializable mid; + if ( dialect instanceof SybaseDialect ) { + mid = s.save(multi); + } + else { + mid = new Long(123); + s.save(multi, mid); + } + LessSimple ls = new LessSimple(); + ls.setOther(ls); + ls.setAnother(multi); + ls.setYetanother(ls); + ls.setName("Less Simple"); + Serializable id; + if ( dialect instanceof SybaseDialect ) { + id = s.save(ls); + } + else { + id = new Long(2); + s.save( ls, new Long(2) ); + } + t.commit(); + s.close(); + assertTrue( ls.getOther()==ls && ls.getAnother()==multi && ls.getYetanother()==ls ); + + s = sessions.openSession(); + t = s.beginTransaction(); + ls = (LessSimple) s.load(LessSimple.class, id); + assertTrue( ls.getOther()==ls && ls.getYetanother()==ls ); + assertTrue( ls.getAnother().getName().equals("name") && ls.getAnother() instanceof Multi ); + s.delete(ls); + s.delete( ls.getAnother() ); t.commit(); s.close(); |
From: <one...@us...> - 2003-04-16 01:13:31
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv23316/hibernate/impl Modified Files: SessionImpl.java Log Message: fixed a bug where references to self from an entity with a natively generated id were not getting nullified Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SessionImpl.java 6 Apr 2003 10:11:09 -0000 1.33 --- SessionImpl.java 16 Apr 2003 01:13:27 -0000 1.34 *************** *** 813,818 **** } ! ! if (object==self) return false; // was a reference to self, so don't need to nullify // See if the entity is already bound to this session, if not look at the --- 813,820 ---- } ! // if it was a reference to self, don't need to nullify ! // unless we are using native id generation, in which ! // case we definitely need to nullify ! if (object==self) return earlyInsert; // See if the entity is already bound to this session, if not look at the |
From: <one...@us...> - 2003-04-15 09:33:05
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test In directory sc8-pr-cvs1:/tmp/cvs-serv8043/hibernate/test Modified Files: FooBarTest.java Glarch.hbm.xml Glarch.java Log Message: changes to proxy tests Index: FooBarTest.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/FooBarTest.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** FooBarTest.java 15 Apr 2003 04:19:17 -0000 1.53 --- FooBarTest.java 15 Apr 2003 09:32:59 -0000 1.54 *************** *** 211,217 **** s = sessions.openSession(); g = (GlarchProxy) s.load(Glarch.class, id); ! assertTrue( ( (Super) g ).getName().equals("G") ); assertTrue( g.getDynaBean().get("foo").equals("foo") && g.getDynaBean().get("bar").equals( new Integer(66) ) ); ! //assertTrue( ! (g instanceof Glarch) ); g.getDynaBean().set("foo", "bar"); s.flush(); --- 211,217 ---- s = sessions.openSession(); g = (GlarchProxy) s.load(Glarch.class, id); ! assertTrue( g.getName().equals("G") ); assertTrue( g.getDynaBean().get("foo").equals("foo") && g.getDynaBean().get("bar").equals( new Integer(66) ) ); ! assertTrue( ! (g instanceof Glarch) ); g.getDynaBean().set("foo", "bar"); s.flush(); Index: Glarch.hbm.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.hbm.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Glarch.hbm.xml 15 Apr 2003 04:19:17 -0000 1.13 --- Glarch.hbm.xml 15 Apr 2003 09:33:00 -0000 1.14 *************** *** 5,9 **** <class name="net.sf.hibernate.test.Glarch" table="glarchez" ! proxy="net.sf.hibernate.test.Glarch" dynamic-update="true"> <!--<jcs-cache usage="read-write"/>--> --- 5,9 ---- <class name="net.sf.hibernate.test.Glarch" table="glarchez" ! proxy="net.sf.hibernate.test.GlarchProxy" dynamic-update="true"> <!--<jcs-cache usage="read-write"/>--> Index: Glarch.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/test/Glarch.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Glarch.java 15 Apr 2003 04:19:17 -0000 1.10 --- Glarch.java 15 Apr 2003 09:33:00 -0000 1.11 *************** *** 225,228 **** --- 225,232 ---- } + public String getName() { + return super.getName(); + } + } |
From: <one...@us...> - 2003-04-15 09:28:55
|
Update of /cvsroot/hibernate/Hibernate2/doc/reference/src In directory sc8-pr-cvs1:/tmp/cvs-serv6135/src Modified Files: advanced_or_mapping.xml Log Message: added extra caveat Index: advanced_or_mapping.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/doc/reference/src/advanced_or_mapping.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** advanced_or_mapping.xml 11 Apr 2003 07:12:21 -0000 1.15 --- advanced_or_mapping.xml 15 Apr 2003 09:28:51 -0000 1.16 *************** *** 1122,1125 **** --- 1122,1130 ---- <para> + Third, you may not use a CGLIB proxy for a <literal>final</literal> class or a class + with any <literal>final</literal> methods. + </para> + + <para> Finally, if your persistent object acquires any resources upon instantiation (eg. in initializers or default constructor), then those resources will also be acquired by |