From hibernate-commits at lists.jboss.org Tue Apr 5 23:56:20 2011
Content-Type: multipart/mixed; boundary="===============2364903395828951249=="
MIME-Version: 1.0
From: hibernate-commits at lists.jboss.org
To: hibernate-commits at lists.jboss.org
Subject: [hibernate-commits] Hibernate SVN: r20924 - in
core/branches/Branch_3_2_4_SP1_CP: src/org/hibernate/engine/loading and 5
other directories.
Date: Tue, 05 Apr 2011 23:56:20 -0400
Message-ID: <201104060356.p363uKJ2020811@svn01.web.mwc.hst.phx2.redhat.com>
--===============2364903395828951249==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: stliu
Date: 2011-04-05 23:56:19 -0400 (Tue, 05 Apr 2011)
New Revision: 20924
Added:
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscroll/
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscroll=
/Child.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscroll=
/HQLScrollFetchTest.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscroll=
/Parent.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscroll=
/ParentChild.hbm.xml
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Cache71Diale=
ct.java
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MimerSQLDial=
ect.java
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/engine/loading/Colle=
ctionLoadContext.java
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/Loader.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/dom=
4j/many2one/Car.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/dom=
4j/many2one/CarPart.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/dom=
4j/many2one/CarType.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/dom=
4j/many2one/Dom4jManyToOneTest.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/CustomS=
QLTest.java
Log:
JBPAPP-5897 HHH-1283 ScrollableResults JoinFetch don't set child collection=
correctly
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Cache=
71Dialect.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Cache71Dial=
ect.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Cache71Dial=
ect.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -32,9 +32,9 @@
import org.hibernate.util.StringHelper;
=
/**
- * Caché 2007.1 dialect. This class is required in order to use Hib=
ernate with Intersystems Cach=EF=BF=BD SQL.
+ * Caché 2007.1 dialect. This class is required in order to use Hib=
ernate with Intersystems Caché SQL.
*
- * Compatible with Cach=EF=BF=BD 2007.1.
+ * Compatible with Caché 2007.1.
*
*
* Caché and Hibernate
@@ -189,8 +189,8 @@
public class Cache71Dialect extends Dialect {
=
/**
- * Creates new Cach=EF=BF=BD71Dialect
instance. Sets up the =
JDBC /
- * Cach=EF=BF=BD type mappings.
+ * Creates new Caché71Dialect
instance. Sets up the J=
DBC /
+ * Caché type mappings.
*/
public Cache71Dialect() {
super();
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/Mimer=
SQLDialect.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MimerSQLDia=
lect.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/dialect/MimerSQLDia=
lect.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -10,7 +10,7 @@
/**
* An Hibernate 3 SQL dialect for Mimer SQL. This dialect requires Mimer S=
QL 9.2.1 or later
* because of the mappings to NCLOB, BINARY, and BINARY VARYING.
- * @author Fredrik =EF=BF=BDlund
+ * @author Fredrik lund
*/
public class MimerSQLDialect extends Dialect {
=
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/engine/loadin=
g/CollectionLoadContext.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/engine/loading/Coll=
ectionLoadContext.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/engine/loading/Coll=
ectionLoadContext.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -40,7 +40,7 @@
=
private final LoadContexts loadContexts;
private final ResultSet resultSet;
- private Set localLoadingCollectionKeys =3D new HashSet();
+ private Set localLoadingCollectionKeys =3D new HashSet();
=
/**
* Creates a collection load context for the given result set.
@@ -150,7 +150,7 @@
*
* @param persister The persister for which to complete loading.
*/
- public void endLoadingCollections(CollectionPersister persister) {
+ public void endLoadingCollections(CollectionPersister persister, Object l=
oadedEntity) {
SessionImplementor session =3D getLoadContext().getPersistenceContext().=
getSession();
if ( !loadContexts.hasLoadingCollectionEntries()
&& localLoadingCollectionKeys.isEmpty() ) {
@@ -163,25 +163,29 @@
// internal loadingCollections map for matches and store those matches
// in a temp collection. the temp collection is then used to "drive"
// the #endRead processing.
- List matches =3D null;
- Iterator iter =3D localLoadingCollectionKeys.iterator();
+ List matches =3D null;
+ Iterator iter =3D localLoadingCollectionKeys.iterator();
while ( iter.hasNext() ) {
- final CollectionKey collectionKey =3D (CollectionKey) iter.next();
+ final CollectionKey collectionKey =3D iter.next();
final LoadingCollectionEntry lce =3D loadContexts.locateLoadingCollecti=
onEntry( collectionKey );
if ( lce =3D=3D null) {
log.warn( "In CollectionLoadContext#endLoadingCollections, localLoadin=
gCollectionKeys contained [" + collectionKey + "], but no LoadingCollection=
Entry was found in loadContexts" );
}
else if ( lce.getResultSet() =3D=3D resultSet && lce.getPersister() =3D=
=3D persister ) {
- if ( matches =3D=3D null ) {
- matches =3D new ArrayList();
- }
- matches.add( lce );
+ =
if ( lce.getCollection().getOwner() =3D=3D null ) {
session.getPersistenceContext().addUnownedCollection(
new CollectionKey( persister, lce.getKey(), session.getEntityMode()=
),
lce.getCollection()
);
}
+ else if ( loadedEntity !=3D null && lce.getCollection().getOwner() !=
=3D loadedEntity ) {
+ continue;
+ }
+ if ( matches =3D=3D null ) {
+ matches =3D new ArrayList();
+ }
+ matches.add( lce );
if ( log.isTraceEnabled() ) {
log.trace( "removing collection load entry [" + lce + "]" );
}
@@ -204,7 +208,7 @@
}
}
=
- private void endLoadingCollections(CollectionPersister persister, List ma=
tchedCollectionEntries) {
+ private void endLoadingCollections(CollectionPersister persister, List matchedCollectionEntries) {
if ( matchedCollectionEntries =3D=3D null ) {
if ( log.isDebugEnabled() ) {
log.debug( "no collections were found in result set for role: " + pers=
ister.getRole() );
@@ -218,7 +222,7 @@
}
=
for ( int i =3D 0; i < count; i++ ) {
- LoadingCollectionEntry lce =3D ( LoadingCollectionEntry ) matchedCollec=
tionEntries.get( i );
+ LoadingCollectionEntry lce =3D matchedCollectionEntries.get( i );
endLoadingCollection( lce, persister );
}
=
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/Loader=
.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/Loader.java =
2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/Loader.java =
2011-04-06 03:56:19 UTC (rev 20924)
@@ -289,7 +289,8 @@
hydratedObjects, =
resultSet, =
session, =
- queryParameters.isReadOnly() =
+ queryParameters.isReadOnly(),
+ result
);
session.getPersistenceContext().initializeNonLazyCollections();
return result;
@@ -340,7 +341,8 @@
hydratedObjects, =
resultSet, =
session, =
- queryParameters.isReadOnly() =
+ queryParameters.isReadOnly(),
+ result
);
session.getPersistenceContext().initializeNonLazyCollections();
return result;
@@ -811,13 +813,21 @@
return null;
}
}
-
private void initializeEntitiesAndCollections(
final List hydratedObjects,
final Object resultSetId,
final SessionImplementor session,
final boolean readOnly) =
throws HibernateException {
+ initializeEntitiesAndCollections(hydratedObjects,resultSetId,session,rea=
dOnly, null);
+ }
+ private void initializeEntitiesAndCollections(
+ final List hydratedObjects,
+ final Object resultSetId,
+ final SessionImplementor session,
+ final boolean readOnly,
+ final Object loadedEntity) =
+ throws HibernateException {
=
final CollectionPersister[] collectionPersisters =3D getCollectionPersis=
ters();
if ( collectionPersisters !=3D null ) {
@@ -828,7 +838,7 @@
//during loading
//TODO: or we could do this polymorphically, and have two
// different operations implemented differently for arrays
- endCollectionLoad( resultSetId, session, collectionPersisters[i] );
+ endCollectionLoad( resultSetId, session, collectionPersisters[i], loa=
dedEntity );
}
}
}
@@ -862,7 +872,7 @@
//the entities, since we might call hashCode() on the elements
//TODO: or we could do this polymorphically, and have two
// different operations implemented differently for arrays
- endCollectionLoad( resultSetId, session, collectionPersisters[i] );
+ endCollectionLoad( resultSetId, session, collectionPersisters[i], loa=
dedEntity );
}
}
}
@@ -872,12 +882,13 @@
private void endCollectionLoad(
final Object resultSetId,
final SessionImplementor session,
- final CollectionPersister collectionPersister) {
+ final CollectionPersister collectionPersister,
+ final Object loadedEntity) {
//this is a query and we are loading multiple instances of the same coll=
ection role
session.getPersistenceContext()
.getLoadContexts()
.getCollectionLoadContext( ( ResultSet ) resultSetId )
- .endLoadingCollections( collectionPersister );
+ .endLoadingCollections( collectionPersister, loadedEntity );
}
=
protected List getResultList(List results, ResultTransformer resultTransf=
ormer) throws QueryException {
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitym=
ode/dom4j/many2one/Car.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/Car.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/Car.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -4,7 +4,7 @@
import java.util.Set;
=
/**
- * @author Paco Hern=EF=BF=BDndez
+ * @author Paco Hernndez
*/
public class Car implements java.io.Serializable {
=
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitym=
ode/dom4j/many2one/CarPart.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/CarPart.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/CarPart.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -1,7 +1,7 @@
package org.hibernate.test.entitymode.dom4j.many2one;
=
/**
- * @author Paco Hern=EF=BF=BDndez
+ * @author Paco Hernndez
*/
public class CarPart implements java.io.Serializable {
=
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitym=
ode/dom4j/many2one/CarType.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/CarType.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/CarType.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -1,7 +1,7 @@
package org.hibernate.test.entitymode.dom4j.many2one;
=
/**
- * @author Paco Hern=EF=BF=BDndez
+ * @author Paco Hernndez
*/
public class CarType implements java.io.Serializable {
=
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitym=
ode/dom4j/many2one/Dom4jManyToOneTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/Dom4jManyToOneTest.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/entitymode/do=
m4j/many2one/Dom4jManyToOneTest.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -14,7 +14,7 @@
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
=
/**
- * @author Paco Hern=EF=BF=BDndez
+ * @author Paco Hernndez
*/
public class Dom4jManyToOneTest extends FunctionalTestCase {
=
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchsc=
roll/Child.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/Child.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/Child.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -0,0 +1,25 @@
+package org.hibernate.test.hqlfetchscroll;
+
+public class Child {
+
+ private String name;
+
+ Child() {
+ }
+
+ public Child(String name) {
+ this.name =3D name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ private void setName(String name) {
+ this.name =3D name;
+ }
+
+ public String toString() {
+ return name;
+ }
+}
\ No newline at end of file
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchsc=
roll/HQLScrollFetchTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/HQLScrollFetchTest.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/HQLScrollFetchTest.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -0,0 +1,196 @@
+package org.hibernate.test.hqlfetchscroll;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.ScrollableResults;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.transform.DistinctRootEntityResultTransformer;
+
+
+public class HQLScrollFetchTest extends FunctionalTestCase {
+ private static final String QUERY =3D "select p from Parent p join fetch =
p.children c";
+
+ public HQLScrollFetchTest(String name) {
+ super( name );
+ }
+
+ public void testNoScroll() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ List list =3D s.createQuery( QUERY ).setResultTransformer(new DistinctR=
ootEntityResultTransformer() ).list();
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ public void testScroll() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ ScrollableResults results =3D s.createQuery( QUERY ).scroll();
+ List list =3D new ArrayList();
+ while ( results.next() ) {
+ list.add( results.get( 0 ) );
+ }
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ public void testScrollOrderParentAsc() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ ScrollableResults results =3D s.createQuery( QUERY + " order by p.name =
asc" ).scroll();
+ List list =3D new ArrayList();
+ while ( results.next() ) {
+ list.add( results.get( 0 ) );
+ }
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ public void testScrollOrderParentDesc() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ ScrollableResults results =3D s.createQuery( QUERY + " order by p.name =
desc" ).scroll();
+ List list =3D new ArrayList();
+ while ( results.next() ) {
+ list.add( results.get( 0 ) );
+ }
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ public void testScrollOrderParentAscChildrenAsc() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ ScrollableResults results =3D s.createQuery( QUERY + " order by p.name =
asc, c.name asc" ).scroll();
+ List list =3D new ArrayList();
+ while ( results.next() ) {
+ list.add( results.get( 0 ) );
+ }
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ public void testScrollOrderParentAscChildrenDesc() {
+ try {
+ insertTestData();
+ Session s =3D openSession();
+ ScrollableResults results =3D s.createQuery( QUERY + " order by p.name =
asc, c.name desc" ).scroll();
+ List list =3D new ArrayList();
+ while ( results.next() ) {
+ list.add( results.get( 0 ) );
+ }
+ assertResultFromAllUsers( list );
+ s.close();
+ }
+ finally {
+ deleteAll();
+ }
+ }
+
+ private void assertResultFromAllUsers(List list) {
+ assertEquals( "list is not correct size: ", 2, list.size() );
+ for ( Iterator i =3D list.iterator(); i.hasNext(); ) {
+ Parent parent =3D (Parent) i.next();
+ assertEquals(
+ "parent " + parent + " has incorrect collection(" + parent.getChildre=
n() + ").",
+ 3,
+ parent.getChildren().size()
+ );
+ }
+ }
+
+ private void deleteAll() {
+ Session s =3D openSession();
+ Transaction t =3D s.beginTransaction();
+ List list =3D s.createQuery( "from Parent" ).list();
+ for ( Iterator i =3D list.iterator(); i.hasNext(); ) {
+ s.delete( (Parent) i.next() );
+ }
+ t.commit();
+ s.close();
+ }
+ private void insertTestData() {
+ Session s =3D openSession();
+ Transaction t =3D s.beginTransaction();
+ Child child_1_1 =3D new Child( "achild1-1");
+ Child child_1_2 =3D new Child( "ychild1-2");
+ Child child_1_3 =3D new Child( "dchild1-3");
+ Child child_2_1 =3D new Child( "bchild2-1");
+ Child child_2_2 =3D new Child( "cchild2-2");
+ Child child_2_3 =3D new Child( "zchild2-3");
+
+ s.save( child_1_1 );
+ s.save( child_2_1 );
+ s.save( child_1_2 );
+ s.save( child_2_2 );
+ s.save( child_1_3 );
+ s.save( child_2_3 );
+
+ s.flush();
+
+ Parent p1 =3D new Parent( "parent1" );
+ p1.addChild( child_1_1 );
+ p1.addChild( child_1_2 );
+ p1.addChild( child_1_3 );
+ s.save( p1 );
+
+ Parent p2 =3D new Parent( "parent2" );
+ p2.addChild( child_2_1 );
+ p2.addChild( child_2_2 );
+ p2.addChild( child_2_3 );
+ s.save( p2 );
+
+ t.commit();
+ s.close();
+}
+
+// private void insertTestData() {
+// Session s =3D openSession();
+// Transaction t =3D s.beginTransaction();
+// s.save( makeParent( "parent1", "child1-1", "child1-2", "child1-3" ) );
+// s.save( makeParent( "parent2", "child2-1", "child2-2", "child2-3" ) );
+// t.commit();
+// s.close();
+// }
+
+ public String[] getMappings() {
+ return new String[] { "hqlfetchscroll/ParentChild.hbm.xml" };
+ }
+
+// protected Object makeParent(String name, String child1, String child2, =
String child3) {
+// Parent parent =3D new Parent( name );
+// parent.addChild( new Child( child1 ) );
+// parent.addChild( new Child( child2 ) );
+// parent.addChild( new Child( child3 ) );
+// return parent;
+// }
+}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchsc=
roll/Parent.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/Parent.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/Parent.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -0,0 +1,41 @@
+package org.hibernate.test.hqlfetchscroll;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Parent {
+ private String name;
+ private Set children =3D new HashSet();
+
+ Parent() {
+ }
+
+ public Parent(String name) {
+ this.name =3D name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+ void setName(String name) {
+ this.name =3D name;
+ }
+
+ public Set getChildren() {
+ return children;
+ }
+
+ private void setChildren(Set children) {
+ this.children =3D children;
+ }
+
+ public void addChild(Child child) {
+ children.add( child );
+ }
+
+ public String toString() {
+ return name;
+ }
+}
\ No newline at end of file
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchsc=
roll/ParentChild.hbm.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/ParentChild.hbm.xml (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/hqlfetchscrol=
l/ParentChild.hbm.xml 2011-04-06 03:56:19 UTC (rev 20924)
@@ -0,0 +1,23 @@
+
+
+
+
+ =
+
+
+ =
+
+
+
+
+ =
+
+ =
+
+
+
+ =
+
+
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/=
CustomSQLTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/Custom=
SQLTest.java 2011-03-12 13:57:35 UTC (rev 20923)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/legacy/Custom=
SQLTest.java 2011-04-06 03:56:19 UTC (rev 20924)
@@ -163,7 +163,7 @@
=
p.setName("Max");
p.setLastName("Andersen");
- p.setNationalID("110974XYZ=EF=BF=BD");
+ p.setNationalID("110974XYZ");
p.setAddress("P. P. Street 8");
=
Session s =3D openSession();
@@ -191,11 +191,11 @@
=
s =3D openSession();
=
- list =3D s.find("select p from Person as p where p.address =3D 'L=EF=BF=
=BDrkev=EF=BF=BDnget 1'");
+ list =3D s.find("select p from Person as p where p.address =3D 'Lrkevnge=
t 1'");
assertTrue(list.size() =3D=3D 0);
- p.setAddress("L=EF=BF=BDrkev=EF=BF=BDnget 1");
+ p.setAddress("Lrkevnget 1");
s.update(p);
- list =3D s.find("select p from Person as p where p.address =3D 'L=EF=BF=
=BDrkev=EF=BF=BDnget 1'");
+ list =3D s.find("select p from Person as p where p.address =3D 'Lrkevnge=
t 1'");
assertTrue(list.size() =3D=3D 1);
list =3D s.find("select p from Party as p where p.address =3D 'P. P. Str=
eet 8'");
assertTrue(list.size() =3D=3D 0);
--===============2364903395828951249==--