Hibernate SVN: r16422 - core/branches/Branch_3_3/hibernate-maven-plugin.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-23 08:38:22 -0400 (Thu, 23 Apr 2009)
New Revision: 16422
Modified:
core/branches/Branch_3_3/hibernate-maven-plugin/pom.xml
Log:
HHH-3874 - Changed packaging type from mojo to maven-plugin in hibernate-maven-plugin/pom.xml.
Modified: core/branches/Branch_3_3/hibernate-maven-plugin/pom.xml
===================================================================
--- core/branches/Branch_3_3/hibernate-maven-plugin/pom.xml 2009-04-23 11:53:54 UTC (rev 16421)
+++ core/branches/Branch_3_3/hibernate-maven-plugin/pom.xml 2009-04-23 12:38:22 UTC (rev 16422)
@@ -36,8 +36,11 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-maven-plugin</artifactId>
- <packaging>mojo</packaging>
+ <packaging>maven-plugin</packaging>
+ <name>Hibernate Maven Plugin</name>
+ <description>Maven plugin for various Hibernate-tools</description>
+
<dependencies>
<dependency>
<groupId>${groupId}</groupId>
@@ -56,4 +59,4 @@
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
15 years, 7 months
Hibernate SVN: r16421 - in core/trunk: annotations/src/test/java/org/hibernate/test/annotations/naturalid and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-23 07:53:54 -0400 (Thu, 23 Apr 2009)
New Revision: 16421
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java
core/trunk/annotations/src/test/resources/hibernate.properties
core/trunk/entitymanager/src/test/resources/hibernate.properties
Log:
JBPAPP-1679
Aligned hibernate.properties with hibernate.properties in testsuite module.
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java 2009-04-23 11:53:54 UTC (rev 16421)
@@ -68,15 +68,15 @@
if ( recreateSchema() ) {
cfg.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
}
- for ( int i = 0; i < packages.length; i++ ) {
- getCfg().addPackage(packages[i]);
+ for ( String aPackage : packages ) {
+ getCfg().addPackage( aPackage );
}
- for ( int i = 0; i < classes.length; i++ ) {
- getCfg().addAnnotatedClass(classes[i]);
+ for ( Class<?> aClass : classes ) {
+ getCfg().addAnnotatedClass( aClass );
}
- for ( int i = 0; i < xmlFiles.length; i++ ) {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xmlFiles[i]);
- getCfg().addInputStream(is);
+ for ( String xmlFile : xmlFiles ) {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile );
+ getCfg().addInputStream( is );
}
setDialect(Dialect.getDialect());
setSessions(getCfg().buildSessionFactory( /* new TestInterceptor() */));
@@ -134,7 +134,7 @@
}
}
- private void runTestMethod( Method runMethod ) throws Throwable, IllegalAccessException {
+ private void runTestMethod( Method runMethod ) throws Throwable {
try {
runMethod.invoke(this, new Class[0]);
} catch ( InvocationTargetException e ) {
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdOnSingleManyToOneTest.java 2009-04-23 11:53:54 UTC (rev 16421)
@@ -3,85 +3,100 @@
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Restrictions;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.stat.Statistics;
import org.hibernate.test.annotations.TestCase;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test case for NaturalId annotation. See ANN-750.
- *
+ *
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
@SuppressWarnings("unchecked")
public class NaturalIdOnSingleManyToOneTest extends TestCase {
-
- private Logger log = LoggerFactory.getLogger(NaturalIdOnManyToOne.class);
+ private Logger log = LoggerFactory.getLogger( NaturalIdOnManyToOne.class );
+
public void testMappingProperties() {
- log.warn("Commented out test");
-
+ log.warn( "Commented out test" );
+
ClassMetadata metaData = getSessions().getClassMetadata(
- NaturalIdOnManyToOne.class);
- assertTrue("Class should have a natural key", metaData
- .hasNaturalIdentifier());
+ NaturalIdOnManyToOne.class
+ );
+ assertTrue(
+ "Class should have a natural key", metaData
+ .hasNaturalIdentifier()
+ );
int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
- assertTrue("Wrong number of elements", propertiesIndex.length == 1);
+ assertTrue( "Wrong number of elements", propertiesIndex.length == 1 );
}
public void testManyToOneNaturalIdCached() {
NaturalIdOnManyToOne singleManyToOne = new NaturalIdOnManyToOne();
Citizen c1 = new Citizen();
- c1.setFirstname("Emmanuel");
- c1.setLastname("Bernard");
- c1.setSsn("1234");
+ c1.setFirstname( "Emmanuel" );
+ c1.setLastname( "Bernard" );
+ c1.setSsn( "1234" );
State france = new State();
- france.setName("Ile de France");
- c1.setState(france);
+ france.setName( "Ile de France" );
+ c1.setState( france );
- singleManyToOne.setCitizen(c1);
+ singleManyToOne.setCitizen( c1 );
Session s = openSession();
Transaction tx = s.beginTransaction();
- s.persist(france);
- s.persist(c1);
- s.persist(singleManyToOne);
+ s.persist( france );
+ s.persist( c1 );
+ s.persist( singleManyToOne );
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
- Criteria criteria = s.createCriteria(NaturalIdOnManyToOne.class);
- criteria.add(Restrictions.naturalId().set("citizen", c1));
- criteria.setCacheable(true);
+ Criteria criteria = s.createCriteria( NaturalIdOnManyToOne.class );
+ criteria.add( Restrictions.naturalId().set( "citizen", c1 ) );
+ criteria.setCacheable( true );
Statistics stats = getSessions().getStatistics();
- stats.setStatisticsEnabled(true);
+ stats.setStatisticsEnabled( true );
stats.clear();
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
// first query
List results = criteria.list();
- assertEquals(1, results.size());
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
- assertEquals("First query should be a miss", 1, stats
- .getQueryCacheMissCount());
- assertEquals("Query result should be added to cache", 1, stats
- .getQueryCachePutCount());
+ assertEquals( 1, results.size() );
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
+ assertEquals(
+ "First query should be a miss", 1, stats
+ .getQueryCacheMissCount()
+ );
+ assertEquals(
+ "Query result should be added to cache", 1, stats
+ .getQueryCachePutCount()
+ );
// query a second time - result should be cached
- results = criteria.list();
- assertEquals("Cache hits should be empty", 1, stats
- .getQueryCacheHitCount());
+ criteria.list();
+ assertEquals(
+ "Cache hits should be empty", 1, stats
+ .getQueryCacheHitCount()
+ );
// cleanup
tx.rollback();
@@ -89,7 +104,13 @@
}
protected Class[] getMappings() {
- return new Class[] { Citizen.class, State.class,
- NaturalIdOnManyToOne.class };
+ return new Class[] {
+ Citizen.class, State.class,
+ NaturalIdOnManyToOne.class
+ };
}
+
+ protected void configure(Configuration cfg) {
+ cfg.setProperty( "hibernate.cache.use_query_cache", "true" );
+ }
}
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdTest.java 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/naturalid/NaturalIdTest.java 2009-04-23 11:53:54 UTC (rev 16421)
@@ -6,6 +6,7 @@
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Restrictions;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.stat.Statistics;
@@ -13,7 +14,7 @@
/**
* Test case for NaturalId annotation
- *
+ *
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
@@ -22,11 +23,14 @@
public void testMappingProperties() {
ClassMetadata metaData = getSessions().getClassMetadata(
- Citizen.class);
- assertTrue("Class should have a natural key", metaData
- .hasNaturalIdentifier());
+ Citizen.class
+ );
+ assertTrue(
+ "Class should have a natural key", metaData
+ .hasNaturalIdentifier()
+ );
int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
- assertTrue("Wrong number of elements", propertiesIndex.length == 2);
+ assertTrue( "Wrong number of elements", propertiesIndex.length == 2 );
}
public void testNaturalIdCached() {
@@ -34,32 +38,46 @@
Session s = openSession();
Transaction tx = s.beginTransaction();
- State france = (State) s.load(State.class, new Integer(2));
- Criteria criteria = s.createCriteria(Citizen.class);
- criteria.add(Restrictions.naturalId().set("ssn", "1234").set("state",
- france));
- criteria.setCacheable(true);
+ State france = ( State ) s.load( State.class, 2 );
+ Criteria criteria = s.createCriteria( Citizen.class );
+ criteria.add(
+ Restrictions.naturalId().set( "ssn", "1234" ).set(
+ "state",
+ france
+ )
+ );
+ criteria.setCacheable( true );
Statistics stats = getSessions().getStatistics();
- stats.setStatisticsEnabled(true);
+ stats.setStatisticsEnabled( true );
stats.clear();
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
// first query
List results = criteria.list();
- assertEquals(1, results.size());
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
- assertEquals("First query should be a miss", 1, stats
- .getQueryCacheMissCount());
- assertEquals("Query result should be added to cache", 1, stats
- .getQueryCachePutCount());
+ assertEquals( 1, results.size() );
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
+ assertEquals(
+ "First query should be a miss", 1, stats
+ .getQueryCacheMissCount()
+ );
+ assertEquals(
+ "Query result should be added to cache", 1, stats
+ .getQueryCachePutCount()
+ );
// query a second time - result should be cached
- results = criteria.list();
- assertEquals("Cache hits should be empty", 1, stats
- .getQueryCacheHitCount());
+ criteria.list();
+ assertEquals(
+ "Cache hits should be empty", 1, stats
+ .getQueryCacheHitCount()
+ );
// cleanup
tx.rollback();
@@ -72,30 +90,42 @@
Session s = openSession();
Transaction tx = s.beginTransaction();
- State france = (State) s.load(State.class, new Integer(2));
- Criteria criteria = s.createCriteria(Citizen.class);
- criteria.add(Restrictions.naturalId().set("ssn", "1234").set("state",
- france));
- criteria.setCacheable(false);
+ State france = ( State ) s.load( State.class, 2 );
+ Criteria criteria = s.createCriteria( Citizen.class );
+ criteria.add(
+ Restrictions.naturalId().set( "ssn", "1234" ).set(
+ "state",
+ france
+ )
+ );
+ criteria.setCacheable( false );
Statistics stats = getSessions().getStatistics();
- stats.setStatisticsEnabled(true);
+ stats.setStatisticsEnabled( true );
stats.clear();
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
// first query
List results = criteria.list();
- assertEquals(1, results.size());
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
- assertEquals("Query result should be added to cache", 0, stats
- .getQueryCachePutCount());
+ assertEquals( 1, results.size() );
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
+ assertEquals(
+ "Query result should be added to cache", 0, stats
+ .getQueryCachePutCount()
+ );
// query a second time
- results = criteria.list();
- assertEquals("Cache hits should be empty", 0, stats
- .getQueryCacheHitCount());
+ criteria.list();
+ assertEquals(
+ "Cache hits should be empty", 0, stats
+ .getQueryCacheHitCount()
+ );
// cleanup
tx.rollback();
@@ -103,35 +133,41 @@
}
protected Class[] getMappings() {
- return new Class[] { Citizen.class, State.class,
- NaturalIdOnManyToOne.class };
+ return new Class[] {
+ Citizen.class, State.class,
+ NaturalIdOnManyToOne.class
+ };
}
private void saveSomeCitizens() {
Citizen c1 = new Citizen();
- c1.setFirstname("Emmanuel");
- c1.setLastname("Bernard");
- c1.setSsn("1234");
+ c1.setFirstname( "Emmanuel" );
+ c1.setLastname( "Bernard" );
+ c1.setSsn( "1234" );
State france = new State();
- france.setName("Ile de France");
- c1.setState(france);
+ france.setName( "Ile de France" );
+ c1.setState( france );
Citizen c2 = new Citizen();
- c2.setFirstname("Gavin");
- c2.setLastname("King");
- c2.setSsn("000");
+ c2.setFirstname( "Gavin" );
+ c2.setLastname( "King" );
+ c2.setSsn( "000" );
State australia = new State();
- australia.setName("Australia");
- c2.setState(australia);
+ australia.setName( "Australia" );
+ c2.setState( australia );
Session s = openSession();
Transaction tx = s.beginTransaction();
- s.persist(australia);
- s.persist(france);
- s.persist(c1);
- s.persist(c2);
+ s.persist( australia );
+ s.persist( france );
+ s.persist( c1 );
+ s.persist( c2 );
tx.commit();
s.close();
}
+
+ protected void configure(Configuration cfg) {
+ cfg.setProperty( "hibernate.cache.use_query_cache", "true" );
+ }
}
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-04-23 11:53:54 UTC (rev 16421)
@@ -9,6 +9,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
import org.hibernate.stat.Statistics;
import org.hibernate.test.annotations.A320;
import org.hibernate.test.annotations.A320b;
@@ -100,11 +101,11 @@
q.setParameter( 0, 9990 );
List result = q.list();
assertEquals( 1, result.size() );
- Night n2 = (Night) result.get( 0 );
+ Night n2 = ( Night ) result.get( 0 );
assertEquals( n2.getDuration(), n.getDuration() );
List areas = s.getNamedQuery( "getAreaByNative" ).list();
assertTrue( 1 == areas.size() );
- assertEquals( area.getName(), ( (Area) areas.get( 0 ) ).getName() );
+ assertEquals( area.getName(), ( ( Area ) areas.get( 0 ) ).getName() );
tx.commit();
s.close();
}
@@ -139,7 +140,7 @@
assertEquals( 1, stats.getQueryCachePutCount() );
q.list();
assertEquals( 1, stats.getQueryCacheHitCount() );
- Night n2 = (Night) ( (Object[]) result.get( 0 ) )[0];
+ Night n2 = ( Night ) ( ( Object[] ) result.get( 0 ) )[0];
assertEquals( n2.getDuration(), n.getDuration() );
tx.commit();
s.close();
@@ -162,7 +163,7 @@
Query q = s.getNamedQuery( "implicitSample" );
List result = q.list();
assertEquals( 1, result.size() );
- assertEquals( ship.getModel(), ( (SpaceShip) result.get( 0 ) ).getModel() );
+ assertEquals( ship.getModel(), ( ( SpaceShip ) result.get( 0 ) ).getModel() );
s.delete( result.get( 0 ) );
tx.commit();
s.close();
@@ -192,8 +193,8 @@
Query q = s.getNamedQuery( "compositekey" );
List result = q.list();
assertEquals( 1, result.size() );
- Object[] row = (Object[]) result.get( 0 );
- SpaceShip spaceShip = (SpaceShip) row[0];
+ Object[] row = ( Object[] ) result.get( 0 );
+ SpaceShip spaceShip = ( SpaceShip ) row[0];
assertEquals( ship.getModel(), spaceShip.getModel() );
assertNotNull( spaceShip.getDimensions() );
assertEquals( ship.getDimensions().getWidth(), spaceShip.getDimensions().getWidth() );
@@ -270,9 +271,9 @@
s = openSession();
tx = s.beginTransaction();
Query query = s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() );
- plane = (Plane) query.uniqueResult();
+ plane = ( Plane ) query.uniqueResult();
assertEquals( 1, getSessions().getStatistics().getQueryCachePutCount() );
- plane = (Plane) s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() ).uniqueResult();
+ plane = ( Plane ) s.getNamedQuery( "plane.byId" ).setParameter( "id", plane.getId() ).uniqueResult();
assertEquals( 1, getSessions().getStatistics().getQueryCacheHitCount() );
tx.commit();
s.close();
@@ -304,7 +305,7 @@
s.clear();
s.getSessionFactory().evict( Chaos.class );
- Chaos resultChaos = (Chaos) s.load( Chaos.class, chaos.getId() );
+ Chaos resultChaos = ( Chaos ) s.load( Chaos.class, chaos.getId() );
assertEquals( upperName, resultChaos.getName() );
assertEquals( "nickname", resultChaos.getNickname() );
@@ -326,23 +327,23 @@
CasimirParticle p = new CasimirParticle();
p.setId( 1l );
s.persist( p );
- chaos.getParticles().add(p);
+ chaos.getParticles().add( p );
p = new CasimirParticle();
p.setId( 2l );
s.persist( p );
- chaos.getParticles().add(p);
+ chaos.getParticles().add( p );
s.flush();
s.clear();
s.getSessionFactory().evict( Chaos.class );
- Chaos resultChaos = (Chaos) s.load( Chaos.class, chaos.getId() );
+ Chaos resultChaos = ( Chaos ) s.load( Chaos.class, chaos.getId() );
assertEquals( 2, resultChaos.getParticles().size() );
resultChaos.getParticles().remove( resultChaos.getParticles().iterator().next() );
resultChaos.getParticles().remove( resultChaos.getParticles().iterator().next() );
s.flush();
s.clear();
- resultChaos = (Chaos) s.load( Chaos.class, chaos.getId() );
+ resultChaos = ( Chaos ) s.load( Chaos.class, chaos.getId() );
assertEquals( 0, resultChaos.getParticles().size() );
tx.rollback();
@@ -350,7 +351,7 @@
}
protected Class[] getMappings() {
- return new Class[]{
+ return new Class[] {
Plane.class,
A320.class,
A320b.class,
@@ -366,15 +367,19 @@
}
protected String[] getAnnotatedPackages() {
- return new String[]{
+ return new String[] {
"org.hibernate.test.annotations.query"
};
}
@Override
protected String[] getXmlFiles() {
- return new String[]{
+ return new String[] {
"org/hibernate/test/annotations/query/orm.xml"
};
}
+
+ protected void configure(Configuration cfg) {
+ cfg.setProperty( "hibernate.cache.use_query_cache", "true" );
+ }
}
Modified: core/trunk/annotations/src/test/resources/hibernate.properties
===================================================================
--- core/trunk/annotations/src/test/resources/hibernate.properties 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/annotations/src/test/resources/hibernate.properties 2009-04-23 11:53:54 UTC (rev 16421)
@@ -1,26 +1,18 @@
-#
-# Hibernate, Relational Persistence for Idiomatic Java
-#
-# Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
-# indicated by the @author tags or express copyright attribution
-# statements applied by the authors. All third-party contributions are
-# distributed under license by Red Hat Middleware LLC.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# Lesser General Public License, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this distribution; if not, write to:
-# Free Software Foundation, Inc.
-# 51 Franklin Street, Fifth Floor
-# Boston, MA 02110-1301 USA
-#
+################################################################################
+# Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved. #
+# #
+# This copyrighted material is made available to anyone wishing to use, modify,#
+# copy, or redistribute it subject to the terms and conditions of the GNU #
+# Lesser General Public License, v. 2.1. This program is distributed in the #
+# hope that it will be useful, but WITHOUT A WARRANTY; without even the implied#
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
+# Lesser General Public License for more details. You should have received a #
+# copy of the GNU Lesser General Public License, v.2.1 along with this #
+# distribution; if not, write to the Free Software Foundation, Inc., #
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
+# #
+# Red Hat Author(s): Steve Ebersole #
+################################################################################
hibernate.dialect ${db.dialect}
hibernate.connection.driver_class ${jdbc.driver}
hibernate.connection.url ${jdbc.url}
@@ -37,7 +29,3 @@
hibernate.cache.region_prefix hibernate.test
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-
-hibernate.cache.use_query_cache true
-
-# hibernate.jdbc.batch_size 0
Modified: core/trunk/entitymanager/src/test/resources/hibernate.properties
===================================================================
--- core/trunk/entitymanager/src/test/resources/hibernate.properties 2009-04-23 10:55:28 UTC (rev 16420)
+++ core/trunk/entitymanager/src/test/resources/hibernate.properties 2009-04-23 11:53:54 UTC (rev 16421)
@@ -1,26 +1,18 @@
-#
-# Hibernate, Relational Persistence for Idiomatic Java
-#
-# Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
-# indicated by the @author tags or express copyright attribution
-# statements applied by the authors. All third-party contributions are
-# distributed under license by Red Hat Middleware LLC.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the GNU
-# Lesser General Public License, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
-# for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this distribution; if not, write to:
-# Free Software Foundation, Inc.
-# 51 Franklin Street, Fifth Floor
-# Boston, MA 02110-1301 USA
-#
+################################################################################
+# Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved. #
+# #
+# This copyrighted material is made available to anyone wishing to use, modify,#
+# copy, or redistribute it subject to the terms and conditions of the GNU #
+# Lesser General Public License, v. 2.1. This program is distributed in the #
+# hope that it will be useful, but WITHOUT A WARRANTY; without even the implied#
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU #
+# Lesser General Public License for more details. You should have received a #
+# copy of the GNU Lesser General Public License, v.2.1 along with this #
+# distribution; if not, write to the Free Software Foundation, Inc., #
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
+# #
+# Red Hat Author(s): Steve Ebersole #
+################################################################################
hibernate.dialect ${db.dialect}
hibernate.connection.driver_class ${jdbc.driver}
hibernate.connection.url ${jdbc.url}
@@ -33,13 +25,7 @@
hibernate.show_sql true
hibernate.format_sql true
-hibernate.hbm2ddl.auto create-drop
-
hibernate.max_fetch_depth 5
hibernate.cache.region_prefix hibernate.test
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-
-hibernate.cache.use_query_cache true
-
-# hibernate.jdbc.batch_size 0
15 years, 7 months
Hibernate SVN: r16420 - entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-23 06:55:28 -0400 (Thu, 23 Apr 2009)
New Revision: 16420
Modified:
entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
Log:
EJB-432 - Fixed regression on RemoveTest. For branch v3_4_0_GA_CP
Modified: entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23 10:49:02 UTC (rev 16419)
+++ entitymanager/branches/v3_4_0_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23 10:55:28 UTC (rev 16420)
@@ -37,7 +37,7 @@
em.close();
}
- public void testUpdatedAndRemove() {
+ public void testUpdatedAndRemove() throws Exception {
Music music = new Music();
music.setName( "Classical" );
EntityManager em = getOrCreateEntityManager();
@@ -49,18 +49,23 @@
em = getOrCreateEntityManager();
em.getTransaction().begin();
+
EntityManager em2 = factory.createEntityManager();
+ try {
+ em2.getTransaction().begin();
+ //read music from 2nd EM
+ music = em2.find( Music.class, music.getId() );
+ } catch (Exception e) {
+ em2.getTransaction().rollback();
+ em2.close();
+ throw e;
+ }
//change music
em.find( Music.class, music.getId() ).setName( "Rap" );
em.getTransaction().commit();
try {
- em2.getTransaction().begin();
-
- //read music from 2nd EM
- music = em2.find( Music.class, music.getId() );
-
em2.remove( music ); //remove changed music
em2.flush();
fail("should have an optimistic lock exception");
15 years, 7 months
Hibernate SVN: r16419 - entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-23 06:49:02 -0400 (Thu, 23 Apr 2009)
New Revision: 16419
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
Log:
EJB-432 - Fixed regression on RemoveTest. For branch v3_3_2_GA_CP
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23 09:55:33 UTC (rev 16418)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/emops/RemoveTest.java 2009-04-23 10:49:02 UTC (rev 16419)
@@ -37,7 +37,7 @@
em.close();
}
- public void testUpdatedAndRemove() {
+ public void testUpdatedAndRemove() throws Exception {
Music music = new Music();
music.setName( "Classical" );
EntityManager em = getOrCreateEntityManager();
@@ -51,16 +51,21 @@
em.getTransaction().begin();
EntityManager em2 = factory.createEntityManager();
+ try {
+ em2.getTransaction().begin();
+ //read music from 2nd EM
+ music = em2.find( Music.class, music.getId() );
+ } catch (Exception e) {
+ em2.getTransaction().rollback();
+ em2.close();
+ throw e;
+ }
+
//change music
em.find( Music.class, music.getId() ).setName( "Rap" );
em.getTransaction().commit();
try {
- em2.getTransaction().begin();
-
- //read music from 2nd EM
- music = em2.find( Music.class, music.getId() );
-
em2.remove( music ); //remove changed music
em2.flush();
fail("should have an optimistic lock exception");
15 years, 7 months
Hibernate SVN: r16418 - in annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations: join and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-23 05:55:33 -0400 (Thu, 23 Apr 2009)
New Revision: 16418
Modified:
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/Sky.java
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java
Log:
ANN-822 - JBPAPP-1894 - Backported fix from trunk. For branch v3_4_0_GA_CP
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java 2009-04-23 09:53:55 UTC (rev 16417)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java 2009-04-23 09:55:33 UTC (rev 16418)
@@ -256,6 +256,8 @@
sky.id = new Long( 1 );
sky.color = "black";
Sky.area = "Paris";
+ sky.day = "23";
+ sky.month = "1";
s.save( sky );
tx.commit();
s.close();
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/Sky.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/Sky.java 2009-04-23 09:53:55 UTC (rev 16417)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/Sky.java 2009-04-23 09:55:33 UTC (rev 16418)
@@ -18,10 +18,11 @@
public class Sky implements Serializable {
@Id
protected Long id;
- @Column(unique = true, columnDefinition = "varchar(250)")
+ @Column(unique = true, columnDefinition = "varchar(250)", nullable = false)
protected String color;
+ @Column(nullable = false)
protected String day;
- @Column(name = "MONTH")
+ @Column(name = "MONTH", nullable = false)
protected String month;
static protected String area;
}
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java 2009-04-23 09:53:55 UTC (rev 16417)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java 2009-04-23 09:55:33 UTC (rev 16418)
@@ -83,7 +83,7 @@
return storyPart1;
}
- @Column(table = "Cat2")
+ @Column(table = "Cat2", nullable = false)
public String getStoryPart2() {
return storyPart2;
}
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java 2009-04-23 09:53:55 UTC (rev 16417)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java 2009-04-23 09:55:33 UTC (rev 16418)
@@ -95,6 +95,7 @@
Life life = new Life();
Cat cat = new Cat();
cat.setName( "kitty" );
+ cat.setStoryPart2( "and the story continues" );
life.duration = 15;
life.fullDescription = "Long long description";
life.owner = cat;
15 years, 7 months
Hibernate SVN: r16417 - in annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations: join and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-23 05:53:55 -0400 (Thu, 23 Apr 2009)
New Revision: 16417
Modified:
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/Sky.java
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java
annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java
Log:
ANN-822 - JBPAPP-1894 - Backported fix from trunk. For branch v3_2_1_GA_CP
Modified: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java 2009-04-23 09:27:56 UTC (rev 16416)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/EntityTest.java 2009-04-23 09:53:55 UTC (rev 16417)
@@ -247,6 +247,8 @@
sky.id = new Long( 1 );
sky.color = "black";
Sky.area = "Paris";
+ sky.day = "23";
+ sky.month = "1";
s.save( sky );
tx.commit();
s.close();
Modified: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/Sky.java
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/Sky.java 2009-04-23 09:27:56 UTC (rev 16416)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/Sky.java 2009-04-23 09:53:55 UTC (rev 16417)
@@ -18,10 +18,11 @@
public class Sky implements Serializable {
@Id
protected Long id;
- @Column(unique = true, columnDefinition = "varchar(250)")
+ @Column(unique = true, columnDefinition = "varchar(250)", nullable = false)
protected String color;
+ @Column(nullable = false)
protected String day;
- @Column(name = "MONTH")
+ @Column(name = "MONTH", nullable = false)
protected String month;
static protected String area;
}
Modified: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java 2009-04-23 09:27:56 UTC (rev 16416)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/Cat.java 2009-04-23 09:53:55 UTC (rev 16417)
@@ -74,7 +74,7 @@
return storyPart1;
}
- @Column(table = "Cat2")
+ @Column(table = "Cat2", nullable = false)
public String getStoryPart2() {
return storyPart2;
}
Modified: annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java
===================================================================
--- annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java 2009-04-23 09:27:56 UTC (rev 16416)
+++ annotations/branches/v3_2_1_GA_CP/src/test/org/hibernate/test/annotations/join/JoinTest.java 2009-04-23 09:53:55 UTC (rev 16417)
@@ -99,6 +99,7 @@
Life life = new Life();
Cat cat = new Cat();
cat.setName( "kitty" );
+ cat.setStoryPart2( "and the story continues" );
life.duration = 15;
life.fullDescription = "Long long description";
life.owner = cat;
15 years, 7 months
Hibernate SVN: r16416 - core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand.
by hibernate-commits@lists.jboss.org
Author: anthonyHib
Date: 2009-04-23 05:27:56 -0400 (Thu, 23 Apr 2009)
New Revision: 16416
Modified:
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java
Log:
HHH-2745 removing generic
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java 2009-04-23 06:48:46 UTC (rev 16415)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java 2009-04-23 09:27:56 UTC (rev 16416)
@@ -10,14 +10,14 @@
public void setId(Long id) {
this.id = id;
}
- public List<Person> getPersons() {
+ public List getPersons() {
return persons;
}
- public void setPersons(List<Person> persons) {
+ public void setPersons(List persons) {
this.persons = persons;
}
private Long id;
- private List<Person> persons = new ArrayList<Person>();
+ private List persons = new ArrayList();
private String name;
public String getName() {
return name;
15 years, 7 months
Hibernate SVN: r16415 - in core/branches/Branch_3_2_4_SP1_CP: test/org/hibernate/test/sql/hand and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: anthonyHib
Date: 2009-04-23 02:48:46 -0400 (Thu, 23 Apr 2009)
New Revision: 16415
Added:
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java
Modified:
core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Person.java
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
Log:
HHH-2745 NullPointerException when eager fetching joined many-to-many with native SQL query
Modified: core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java 2009-04-23 05:56:50 UTC (rev 16414)
+++ core/branches/Branch_3_2_4_SP1_CP/src/org/hibernate/loader/custom/sql/SQLQueryReturnProcessor.java 2009-04-23 06:48:46 UTC (rev 16415)
@@ -374,7 +374,7 @@
alias2CollectionSuffix.put( alias, suffix );
collectionPropertyResultMaps.put( alias, propertyResults );
- if ( collectionPersister.isOneToMany() ) {
+ if ( collectionPersister.isOneToMany() || collectionPersister.isManyToMany()) {
SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister();
addPersister( alias, filter( propertyResults ), persister );
}
Added: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java (rev 0)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Group.java 2009-04-23 06:48:46 UTC (rev 16415)
@@ -0,0 +1,35 @@
+package org.hibernate.test.sql.hand;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Group {
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public List<Person> getPersons() {
+ return persons;
+ }
+ public void setPersons(List<Person> persons) {
+ this.persons = persons;
+ }
+ private Long id;
+ private List<Person> persons = new ArrayList<Person>();
+ private String name;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Group(String name) {
+ this.name = name;
+ }
+
+ public Group(){}
+
+}
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Person.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Person.java 2009-04-23 05:56:50 UTC (rev 16414)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/Person.java 2009-04-23 06:48:46 UTC (rev 16415)
@@ -5,7 +5,7 @@
* @author Gavin King
*/
public class Person {
- private long id;
+ private Long id;
private String name;
public Person(String name) {
@@ -17,13 +17,13 @@
/**
* @return Returns the id.
*/
- public long getId() {
+ public Long getId() {
return id;
}
/**
* @param id The id to set.
*/
- public void setId(long id) {
+ public void setId(Long id) {
this.id = id;
}
/**
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml 2009-04-23 05:56:50 UTC (rev 16414)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueries.hbm.xml 2009-04-23 06:48:46 UTC (rev 16415)
@@ -31,6 +31,24 @@
</class>
+ <class name="Group" table="GROUPP">
+ <id name="id" unsaved-value="0" column="ID">
+ <generator class="increment"/>
+ </id>
+ <property name="name" column="NAME" not-null="true"/>
+ <list name="persons" table="GROUP_PERSON"
+ cascade="none" inverse="false" lazy="true">
+ <key>
+ <column name= "GROUP_ID" />
+ </key>
+
+ <list-index column="POS" />
+ <many-to-many class="Person"
+ column="PERSON_ID" />
+ </list>
+
+ </class>
+
<class name="Employment" table="EMPLOYMENT">
<id name="employmentId" unsaved-value="0" column="EMPID">
<generator class="increment"/>
@@ -258,5 +276,31 @@
FROM ORGANIZATION org
LEFT OUTER JOIN EMPLOYMENT emp ON org.ORGID = emp.EMPLOYER
</sql-query>
-
+ <sql-query name="manyToManyFetch">
+ <![CDATA[
+ SELECT groupp.ID as group_id,
+ groupp.NAME as group_name,
+ group_person.PERSON_ID as group_person_personId,
+ group_person.GROUP_ID as group_person_groupId,
+ group_person.POS as group_person_pos,
+ person.PERID as person_id,
+ person.NAME as person_name
+ FROM GROUPP groupp,
+ GROUP_PERSON group_person,
+ PERSON person
+ WHERE groupp.ID = group_person.GROUP_ID
+ and person.PERID = group_person.PERSON_ID
+ ]]>
+ <return alias="groupp" class="Group">
+ <return-property name="id" column="group_id" />
+ <return-property name="name" column="group_name" />
+ </return>
+ <return-join alias="group_person" property="groupp.persons">
+ <return-property name="key" column="group_person_groupId" />
+ <return-property name="index" column="group_person_pos" />
+ <return-property name="element" column="person_id" />
+ <return-property name="element.id" column="person_id" />
+ <return-property name="element.name" column="person_name" />
+ </return-join>
+ </sql-query>
</hibernate-mapping>
\ No newline at end of file
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2009-04-23 05:56:50 UTC (rev 16414)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java 2009-04-23 06:48:46 UTC (rev 16415)
@@ -14,21 +14,22 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.test.sql.hand.Dimension;
+import org.hibernate.test.sql.hand.Employment;
+import org.hibernate.test.sql.hand.Group;
+import org.hibernate.test.sql.hand.Order;
import org.hibernate.test.sql.hand.Organization;
import org.hibernate.test.sql.hand.Person;
-import org.hibernate.test.sql.hand.Employment;
import org.hibernate.test.sql.hand.Product;
-import org.hibernate.test.sql.hand.Order;
-import org.hibernate.test.sql.hand.Dimension;
import org.hibernate.test.sql.hand.SpaceShip;
import org.hibernate.test.sql.hand.Speech;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.junit.functional.FunctionalTestCase;
-import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.transform.AliasToEntityMapResultTransformer;
import org.hibernate.transform.DistinctRootEntityResultTransformer;
import org.hibernate.transform.Transformers;
-import org.hibernate.transform.AliasToEntityMapResultTransformer;
/**
* Tests of various features of native SQL queries.
@@ -608,6 +609,64 @@
}
}
+ public void testAddJoinForManyToMany() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ Person gavin = new Person("Gavin");
+ Person max = new Person("Max");
+ Person pete = new Person("Pete");
+
+ Group hibernate = new Group("Hibernate");
+ Group seam = new Group("Seam");
+
+ s.persist(gavin);
+ s.persist(max);
+ s.persist(pete);
+ s.persist(seam);
+ s.persist(hibernate);
+
+
+
+ hibernate.getPersons().add(gavin);
+ hibernate.getPersons().add(max);
+ seam.getPersons().add(gavin);
+ seam.getPersons().add(pete);
+
+ s.flush();
+ s.clear();
+
+// String sqlStr = "SELECT {groupp.*} , {gp.*} " +
+// "FROM GROUPP groupp, GROUP_PERSON gp, PERSON person WHERE groupp.ID = gp.GROUP_ID and person.PERID = gp.PERSON_ID";
+//
+// List l = s.createSQLQuery( sqlStr )
+// .addEntity("groupp", Group.class)
+// .addJoin("gp","groupp.persons")
+// .list();
+ List l = s.getNamedQuery("manyToManyFetch").list();
+ //assertEquals( 2, l.size() );
+
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+
+ seam.getPersons().remove(gavin);
+ seam.getPersons().remove(pete);
+
+ hibernate.getPersons().remove(gavin);
+ hibernate.getPersons().remove(max);
+
+ s.delete(seam);
+ s.delete(hibernate);
+ s.delete(gavin);
+ s.delete(max);
+ s.delete(pete);
+
+ t.commit();
+ s.close();
+ }
+
private static class UpperCasedAliasToEntityMapResultTransformer extends AliasToEntityMapResultTransformer {
public Object transformTuple(Object[] tuple, String[] aliases) {
String[] ucAliases = new String[aliases.length];
15 years, 7 months
Hibernate SVN: r16414 - in core/trunk/annotations/src/test/java/org/hibernate/test/annotations: join and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-04-23 01:56:50 -0400 (Thu, 23 Apr 2009)
New Revision: 16414
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/Sky.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/Cat.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/JoinTest.java
Log:
ANN-822 mark unique columns as nullable=false
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java 2009-04-22 21:37:21 UTC (rev 16413)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/EntityTest.java 2009-04-23 05:56:50 UTC (rev 16414)
@@ -260,6 +260,8 @@
sky.id = new Long( 1 );
sky.color = "black";
Sky.area = "Paris";
+ sky.day = "23";
+ sky.month = "1";
s.save( sky );
tx.commit();
s.close();
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/Sky.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/Sky.java 2009-04-22 21:37:21 UTC (rev 16413)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/Sky.java 2009-04-23 05:56:50 UTC (rev 16414)
@@ -18,10 +18,11 @@
public class Sky implements Serializable {
@Id
protected Long id;
- @Column(unique = true, columnDefinition = "varchar(250)")
+ @Column(unique = true, columnDefinition = "varchar(250)", nullable = false)
protected String color;
+ @Column(nullable = false)
protected String day;
- @Column(name = "MONTH")
+ @Column(name = "MONTH", nullable = false)
protected String month;
static protected String area;
}
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/Cat.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/Cat.java 2009-04-22 21:37:21 UTC (rev 16413)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/Cat.java 2009-04-23 05:56:50 UTC (rev 16414)
@@ -83,7 +83,7 @@
return storyPart1;
}
- @Column(table = "Cat2")
+ @Column(table = "Cat2", nullable = false)
public String getStoryPart2() {
return storyPart2;
}
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/JoinTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/JoinTest.java 2009-04-22 21:37:21 UTC (rev 16413)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/join/JoinTest.java 2009-04-23 05:56:50 UTC (rev 16414)
@@ -95,6 +95,7 @@
Life life = new Life();
Cat cat = new Cat();
cat.setName( "kitty" );
+ cat.setStoryPart2( "and the story continues" );
life.duration = 15;
life.fullDescription = "Long long description";
life.owner = cat;
15 years, 7 months
Hibernate SVN: r16413 - core/branches/antlr3/src/main/java/org/hibernate/sql/ast/tree.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-04-22 17:37:21 -0400 (Wed, 22 Apr 2009)
New Revision: 16413
Modified:
core/branches/antlr3/src/main/java/org/hibernate/sql/ast/tree/Table.java
Log:
use PropertyMapping interface to resolve property columns
Modified: core/branches/antlr3/src/main/java/org/hibernate/sql/ast/tree/Table.java
===================================================================
--- core/branches/antlr3/src/main/java/org/hibernate/sql/ast/tree/Table.java 2009-04-22 21:20:04 UTC (rev 16412)
+++ core/branches/antlr3/src/main/java/org/hibernate/sql/ast/tree/Table.java 2009-04-22 21:37:21 UTC (rev 16413)
@@ -29,7 +29,6 @@
package org.hibernate.sql.ast.tree;
import java.util.ArrayList;
-import java.util.LinkedHashSet;
import java.util.HashMap;
import org.hibernate.type.Type;
@@ -226,8 +225,7 @@
}
public String[] getPropertyColumnNames(String propertyName) {
- int index = getEntityPersister().getEntityMetamodel().getPropertyIndex( propertyName );
- return getEntityPersister().getPropertyColumnNames( index );
+ return getEntityPersister().toColumns( propertyName );
}
public HibernateTree buildIdentifierColumnReferences() {
15 years, 7 months