[hibernate-commits] Hibernate SVN: r11330 - in trunk/Hibernate3/test/org/hibernate/test: orphan and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Thu Mar 22 10:56:08 EDT 2007
Author: epbernard
Date: 2007-03-22 10:56:08 -0400 (Thu, 22 Mar 2007)
New Revision: 11330
Added:
trunk/Hibernate3/test/org/hibernate/test/id/Product.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/id/Product.java
trunk/Hibernate3/test/org/hibernate/test/id/UseIdentifierRollbackTest.java
Removed:
trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanIdRollbackTest.java
trunk/Hibernate3/test/org/hibernate/test/orphan/ProductAndIdRollback.hbm.xml
Modified:
trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanSuite.java
Log:
Remove unfinished test, add test for use_identifier_rollback
Added: trunk/Hibernate3/test/org/hibernate/test/id/Product.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/Product.hbm.xml (rev 0)
+++ trunk/Hibernate3/test/org/hibernate/test/id/Product.hbm.xml 2007-03-22 14:56:08 UTC (rev 11330)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+
+
+-->
+
+<hibernate-mapping package="org.hibernate.test.id">
+
+ <class name="Product" table="t_product">
+ <id name="name">
+ <generator class="uuid"/>
+ </id>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/Hibernate3/test/org/hibernate/test/id/Product.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/Product.java (rev 0)
+++ trunk/Hibernate3/test/org/hibernate/test/id/Product.java 2007-03-22 14:56:08 UTC (rev 11330)
@@ -0,0 +1,17 @@
+//$Id: $
+package org.hibernate.test.id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Product {
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: trunk/Hibernate3/test/org/hibernate/test/id/UseIdentifierRollbackTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/UseIdentifierRollbackTest.java (rev 0)
+++ trunk/Hibernate3/test/org/hibernate/test/id/UseIdentifierRollbackTest.java 2007-03-22 14:56:08 UTC (rev 11330)
@@ -0,0 +1,44 @@
+//$Id: $
+package org.hibernate.test.id;
+
+import org.hibernate.test.TestCase;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import junit.framework.Test;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class UseIdentifierRollbackTest extends TestCase {
+ public UseIdentifierRollbackTest(String str) {
+ super(str);
+ }
+
+ public String[] getMappings() {
+ return new String[] { "id/Product.hbm.xml" };
+ }
+
+ public void configure(Configuration cfg) {
+ cfg.setProperty( Environment.USE_IDENTIFIER_ROLLBACK, "true");
+ super.configure( cfg );
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( UseIdentifierRollbackTest.class );
+ }
+
+ public void testSimpleRollback() {
+ Session session = openSession();
+ Transaction t = session.beginTransaction();
+ Product prod = new Product();
+ assertNull( prod.getName() );
+ session.persist(prod);
+ session.flush();
+ assertNotNull( prod.getName() );
+ t.rollback();
+ session.close();
+ }
+}
Deleted: trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanIdRollbackTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanIdRollbackTest.java 2007-03-22 06:31:51 UTC (rev 11329)
+++ trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanIdRollbackTest.java 2007-03-22 14:56:08 UTC (rev 11330)
@@ -1,52 +0,0 @@
-//$Id$
-package org.hibernate.test.orphan;
-
-import junit.framework.Test;
-
-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;
-
-/**
- * @author Emmanuel Bernard
- */
-public class OrphanIdRollbackTest extends FunctionalTestCase {
-
- public OrphanIdRollbackTest(String str) {
- super(str);
- }
-
- public String[] getMappings() {
- return new String[] { "orphan/ProductAndIdRollback.hbm.xml" };
- }
-
- public void configure(Configuration cfg) {
- cfg.setProperty( Environment.USE_IDENTIFIER_ROLLBACK, "true");
- super.configure( cfg );
- }
-
- public static Test suite() {
- return new FunctionalTestClassTestSuite( OrphanIdRollbackTest.class );
- }
-
- public void testOrphanDeleteOnDelete() {
- Session session = openSession();
- Transaction t = session.beginTransaction();
- Product prod = new Product();
- session.persist(prod);
- session.flush();
- t.commit();
- session.close();
- session = openSession();
- t = session.beginTransaction();
- prod = (Product) session.get( Product.class, prod.getName() );
- session.delete(prod);
- t.commit();
- session.close();
- }
-
-}
-
Modified: trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanSuite.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanSuite.java 2007-03-22 06:31:51 UTC (rev 11329)
+++ trunk/Hibernate3/test/org/hibernate/test/orphan/OrphanSuite.java 2007-03-22 14:56:08 UTC (rev 11330)
@@ -11,7 +11,6 @@
public class OrphanSuite {
public static Test suite() {
TestSuite suite = new TestSuite( "orphan delete suite" );
- suite.addTest( OrphanIdRollbackTest.suite() );
suite.addTest( OrphanTest.suite() );
suite.addTest( PropertyRefTest.suite() );
return suite;
Deleted: trunk/Hibernate3/test/org/hibernate/test/orphan/ProductAndIdRollback.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/orphan/ProductAndIdRollback.hbm.xml 2007-03-22 06:31:51 UTC (rev 11329)
+++ trunk/Hibernate3/test/org/hibernate/test/orphan/ProductAndIdRollback.hbm.xml 2007-03-22 14:56:08 UTC (rev 11330)
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<!--
-
-
--->
-
-<hibernate-mapping package="org.hibernate.test.orphan">
-
- <class name="Product" table="t_product">
- <id name="name">
- <generator class="uuid"/>
- </id>
- <set name="parts" cascade="all,delete-orphan" fetch="join">
- <key column="productName" not-null="true"/>
- <one-to-many class="Part"/>
- </set>
- </class>
-
- <class name="Part" table="t_part">
- <id name="name"/>
- <property name="description" not-null="true"/>
- </class>
-
-</hibernate-mapping>
\ No newline at end of file
More information about the hibernate-commits
mailing list