|
From: <one...@us...> - 2003-01-03 13:36:04
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader
In directory sc8-pr-cvs1:/tmp/cvs-serv2643/src/net/sf/hibernate/loader
Modified Files:
CollectionInitializer.java CollectionLoader.java
EntityLoader.java Loader.java OneToManyLoader.java
OuterJoinLoader.java SimpleEntityLoader.java
Log Message:
removed exceptions that occur if an object is saved or deleted multiple times in a session
added <parent> subelement to <composite-element> and <nested-composite-element>
Index: CollectionInitializer.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/CollectionInitializer.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** CollectionInitializer.java 1 Jan 2003 13:56:07 -0000 1.1.1.1
--- CollectionInitializer.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 18,21 ****
* Initialize the given collection
*/
! public void initialize(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException;
}
--- 18,21 ----
* Initialize the given collection
*/
! public void initialize(Serializable id, PersistentCollection collection, Object owner, SessionImplementor session) throws SQLException, HibernateException;
}
Index: CollectionLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/CollectionLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** CollectionLoader.java 1 Jan 2003 13:56:07 -0000 1.1.1.1
--- CollectionLoader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 8,15 ****
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
- import net.sf.hibernate.impl.CollectionPersister;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
--- 8,15 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
***************
*** 21,25 ****
private final CollectionPersister collectionPersister;
! private final Type[] idType;
private final boolean allowTwoPhaseLoad;
--- 21,25 ----
private final CollectionPersister collectionPersister;
! private final Type idType;
private final boolean allowTwoPhaseLoad;
***************
*** 30,34 ****
allowTwoPhaseLoad = !persister.isSet();
! idType = new Type[] { persister.getKeyType() };
String alias = alias( persister.getQualifiedTableName(), 0 );
--- 30,34 ----
allowTwoPhaseLoad = !persister.isSet();
! idType = persister.getKeyType();
String alias = alias( persister.getQualifiedTableName(), 0 );
***************
*** 67,72 ****
}
! public void initialize(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException {
! loadCollection(session, new Object[] { id }, idType, collection, true);
}
--- 67,72 ----
}
! public void initialize(Serializable id, PersistentCollection collection, Object owner, SessionImplementor session) throws SQLException, HibernateException {
! loadCollection(session, id, idType, owner, collection);
}
Index: EntityLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/EntityLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** EntityLoader.java 1 Jan 2003 13:56:07 -0000 1.1.1.1
--- EntityLoader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 8,14 ****
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
- import net.sf.hibernate.impl.CollectionPersister;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.persister.ClassPersister;
--- 8,14 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.persister.ClassPersister;
Index: Loader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/Loader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Loader.java 1 Jan 2003 13:56:08 -0000 1.1.1.1
--- Loader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 17,27 ****
import net.sf.hibernate.LockMode;
import net.sf.hibernate.WrongClassException;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.Key;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.util.JDBCExceptionReporter;
import net.sf.hibernate.util.StringHelper;
- import net.sf.hibernate.impl.CollectionPersister;
- import net.sf.hibernate.impl.QueryImpl;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
--- 17,27 ----
import net.sf.hibernate.LockMode;
import net.sf.hibernate.WrongClassException;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.Key;
+ import net.sf.hibernate.engine.RowSelection;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.util.JDBCExceptionReporter;
import net.sf.hibernate.util.StringHelper;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
***************
*** 101,106 ****
final Serializable optionalID,
final PersistentCollection optionalCollection,
boolean returnProxies,
! final QueryImpl.RowSelection selection,
final Map namedParams
) throws SQLException, HibernateException {
--- 101,107 ----
final Serializable optionalID,
final PersistentCollection optionalCollection,
+ final Object optionalCollectionOwner,
boolean returnProxies,
! final RowSelection selection,
final Map namedParams
) throws SQLException, HibernateException {
***************
*** 108,114 ****
returnProxies = returnProxies && Environment.jvmSupportsProxies();
! int maxRows = (selection==null || selection.maxRows==null) ?
Integer.MAX_VALUE :
! selection.maxRows.intValue();
final Loadable[] persisters = getPersisters();
--- 109,115 ----
returnProxies = returnProxies && Environment.jvmSupportsProxies();
! int maxRows = (selection==null || selection.getMaxRows()==null) ?
Integer.MAX_VALUE :
! selection.getMaxRows().intValue();
final Loadable[] persisters = getPersisters();
***************
*** 197,201 ****
}
! if (collection) optionalCollection.readFrom( rs, getCollectionPersister() );
}
--- 198,202 ----
}
! if (collection) optionalCollection.readFrom( rs, getCollectionPersister(), optionalCollectionOwner );
}
***************
*** 385,389 ****
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
! protected final void advance(ResultSet rs, QueryImpl.RowSelection selection, SessionImplementor session) throws SQLException {
if (selection==null) {
// we need the whole ResultSet from the beginning
--- 386,390 ----
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
! protected final void advance(ResultSet rs, RowSelection selection, SessionImplementor session) throws SQLException {
if (selection==null) {
// we need the whole ResultSet from the beginning
***************
*** 391,395 ****
}
else {
! Integer first = selection.firstRow;
if (first!=null && first.intValue()!=0 ) {
if ( session.getFactory().useScrollableResultSets() ) {
--- 392,396 ----
}
else {
! Integer first = selection.getFirstRow();
if (first!=null && first.intValue()!=0 ) {
if ( session.getFactory().useScrollableResultSets() ) {
***************
*** 408,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 &&
! ( ( selection.firstRow!=null && selection.firstRow.intValue()!=0 ) || scroll ) &&
session.getFactory().useScrollableResultSets();
--- 409,416 ----
* Obtain a <tt>PreparedStatement</tt> and bind JDBC-style <tt>?</tt> parameters
*/
! protected final PreparedStatement prepareQueryStatement(String sql, Object[] values, Type[] types, RowSelection selection, boolean scroll, SessionImplementor session) throws SQLException, HibernateException {
boolean scrollable = selection!=null &&
! ( ( selection.getFirstRow()!=null && selection.getFirstRow().intValue()!=0 ) || scroll ) &&
session.getFactory().useScrollableResultSets();
***************
*** 418,422 ****
try {
! if (selection!=null && selection.timeout!=null) st.setQueryTimeout( selection.timeout.intValue() );
int col=1;
--- 419,423 ----
try {
! if (selection!=null && selection.getTimeout()!=null) st.setQueryTimeout( selection.getTimeout().intValue() );
int col=1;
***************
*** 443,449 ****
* Limit the number of rows returned by the SQL query if necessary
*/
! protected final void setMaxRows(PreparedStatement st,QueryImpl.RowSelection selection) throws SQLException {
! if ( selection!=null && selection.maxRows!=null ) st.setMaxRows(
! selection.maxRows.intValue() + ( (selection.firstRow==null) ? 0 : selection.firstRow.intValue() )
);
}
--- 444,450 ----
* Limit the number of rows returned by the SQL query if necessary
*/
! protected final void setMaxRows(PreparedStatement st,RowSelection selection) throws SQLException {
! if ( selection!=null && selection.getMaxRows()!=null ) st.setMaxRows(
! selection.getMaxRows().intValue() + ( (selection.getFirstRow()==null) ? 0 : selection.getFirstRow().intValue() )
);
}
***************
*** 453,457 ****
* 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);
--- 454,458 ----
* returning an SQL <tt>ResultSet</tt>
*/
! private final ResultSet getResultSet(PreparedStatement st, Map namedParams, RowSelection selection, SessionImplementor session) throws SQLException, HibernateException {
try {
bindNamedParameters(st, namedParams, session);
***************
*** 488,492 ****
boolean returnProxies
) throws SQLException, HibernateException {
! return doFind(session, values, types, optionalObject, optionalID, null, returnProxies, null, null);
}
--- 489,493 ----
boolean returnProxies
) throws SQLException, HibernateException {
! return doFind(session, values, types, optionalObject, optionalID, null, null, returnProxies, null, null);
}
***************
*** 496,505 ****
protected final List loadCollection(
final SessionImplementor session,
! final Object[] values,
! final Type[] types,
! final PersistentCollection collection,
! boolean returnProxies
) throws SQLException, HibernateException {
! return doFind(session, values, types, null, null, collection, returnProxies, null, null);
}
--- 497,506 ----
protected final List loadCollection(
final SessionImplementor session,
! final Serializable id,
! final Type type,
! final Object owner,
! final PersistentCollection collection
) throws SQLException, HibernateException {
! return doFind(session, new Object[] {id}, new Type[] {type}, null, null, collection, owner, true, null, null);
}
***************
*** 513,520 ****
final Type[] types,
boolean returnProxies,
! final QueryImpl.RowSelection selection,
final Map namedParams
) throws SQLException, HibernateException {
! return doFind(session, values, types, null, null, null, returnProxies, selection, namedParams);
}
--- 514,521 ----
final Type[] types,
boolean returnProxies,
! final RowSelection selection,
final Map namedParams
) throws SQLException, HibernateException {
! return doFind(session, values, types, null, null, null, null, returnProxies, selection, namedParams);
}
Index: OneToManyLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/OneToManyLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OneToManyLoader.java 1 Jan 2003 13:56:08 -0000 1.1.1.1
--- OneToManyLoader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 8,15 ****
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
- import net.sf.hibernate.impl.CollectionPersister;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.EntityType;
--- 8,15 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.MappingException;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.collection.PersistentCollection;
import net.sf.hibernate.engine.SessionFactoryImplementor;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.EntityType;
***************
*** 22,26 ****
private final CollectionPersister collectionPersister;
! private final Type[] idType;
private final boolean allowTwoPhaseLoad;
--- 22,26 ----
private final CollectionPersister collectionPersister;
! private final Type idType;
private final boolean allowTwoPhaseLoad;
***************
*** 33,37 ****
collectionPersister = collPersister;
! idType = new Type[] { collPersister.getKeyType() };
Loadable persister = (Loadable) session.getPersister(
--- 33,37 ----
collectionPersister = collPersister;
! idType = collPersister.getKeyType();
Loadable persister = (Loadable) session.getPersister(
***************
*** 78,83 ****
}
! public void initialize(Serializable id, PersistentCollection collection, SessionImplementor session) throws SQLException, HibernateException {
! loadCollection(session, new Object[] { id }, idType, collection, true);
}
--- 78,83 ----
}
! public void initialize(Serializable id, PersistentCollection collection, Object owner, SessionImplementor session) throws SQLException, HibernateException {
! loadCollection(session, id, idType, owner, collection);
}
Index: OuterJoinLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/OuterJoinLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OuterJoinLoader.java 1 Jan 2003 13:56:11 -0000 1.1.1.1
--- OuterJoinLoader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 10,18 ****
import net.sf.hibernate.util.ArrayHelper;
import net.sf.hibernate.util.StringHelper;
- import net.sf.hibernate.impl.CollectionPersister;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.*;
import net.sf.hibernate.MappingException;
import net.sf.hibernate.dialect.Dialect;
--- 10,18 ----
import net.sf.hibernate.util.ArrayHelper;
import net.sf.hibernate.util.StringHelper;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.*;
import net.sf.hibernate.MappingException;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.dialect.Dialect;
Index: SimpleEntityLoader.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/loader/SimpleEntityLoader.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** SimpleEntityLoader.java 1 Jan 2003 13:56:11 -0000 1.1.1.1
--- SimpleEntityLoader.java 3 Jan 2003 13:36:01 -0000 1.2
***************
*** 8,13 ****
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.LockMode;
import net.sf.hibernate.engine.SessionImplementor;
- import net.sf.hibernate.impl.CollectionPersister;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
--- 8,13 ----
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.LockMode;
+ import net.sf.hibernate.collection.CollectionPersister;
import net.sf.hibernate.engine.SessionImplementor;
import net.sf.hibernate.persister.*;
import net.sf.hibernate.type.Type;
|