forked from hibernate/hibernate-orm
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3.6' of github.com:hibernate/hibernate-core into 3.6
- Loading branch information
Showing
22 changed files
with
450 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...src/test/java/org/hibernate/envers/test/integration/proxy/AuditedCollectionProxyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* 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 | ||
*/ | ||
package org.hibernate.envers.test.integration.proxy; | ||
|
||
import javax.persistence.EntityManager; | ||
|
||
import org.hibernate.ejb.Ejb3Configuration; | ||
import org.hibernate.envers.test.AbstractEntityTest; | ||
import org.hibernate.envers.test.entities.onetomany.ListRefEdEntity; | ||
import org.hibernate.envers.test.entities.onetomany.ListRefIngEntity; | ||
import org.hibernate.proxy.HibernateProxy; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* Test case for HHH-5750: Proxied objects lose the temporary session used to | ||
* initialize them. | ||
* | ||
* @author Erik-Berndt Scheper | ||
* | ||
*/ | ||
public class AuditedCollectionProxyTest extends AbstractEntityTest { | ||
|
||
Integer id_ListRefEdEntity1; | ||
|
||
public void configure(Ejb3Configuration cfg) { | ||
cfg.addAnnotatedClass(ListRefEdEntity.class); | ||
cfg.addAnnotatedClass(ListRefIngEntity.class); | ||
} | ||
|
||
@BeforeClass(dependsOnMethods = "init") | ||
public void initData() { | ||
EntityManager em = getEntityManager(); | ||
|
||
ListRefEdEntity listReferencedEntity1 = new ListRefEdEntity( | ||
Integer.valueOf(1), "str1"); | ||
ListRefIngEntity refingEntity1 = new ListRefIngEntity( | ||
Integer.valueOf(1), "refing1", listReferencedEntity1); | ||
|
||
// Revision 1 | ||
em.getTransaction().begin(); | ||
em.persist(listReferencedEntity1); | ||
em.persist(refingEntity1); | ||
em.getTransaction().commit(); | ||
|
||
id_ListRefEdEntity1 = listReferencedEntity1.getId(); | ||
|
||
// Revision 2 | ||
ListRefIngEntity refingEntity2 = new ListRefIngEntity( | ||
Integer.valueOf(2), "refing2", listReferencedEntity1); | ||
|
||
em.getTransaction().begin(); | ||
em.persist(refingEntity2); | ||
em.getTransaction().commit(); | ||
} | ||
|
||
@Test | ||
public void testProxyIdentifier() { | ||
EntityManager em = getEntityManager(); | ||
|
||
ListRefEdEntity listReferencedEntity1 = em.getReference( | ||
ListRefEdEntity.class, id_ListRefEdEntity1); | ||
|
||
assert listReferencedEntity1 instanceof HibernateProxy; | ||
|
||
// Revision 3 | ||
ListRefIngEntity refingEntity3 = new ListRefIngEntity( | ||
Integer.valueOf(3), "refing3", listReferencedEntity1); | ||
|
||
em.getTransaction().begin(); | ||
em.persist(refingEntity3); | ||
em.getTransaction().commit(); | ||
|
||
listReferencedEntity1.getReffering().size(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
.../hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullFalseDelayedInsertTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* Copyright (c) 2010, 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 | ||
* | ||
*/ | ||
package org.hibernate.test.cascade.circle; | ||
|
||
import junit.framework.Test; | ||
|
||
import org.hibernate.TransientObjectException; | ||
import org.hibernate.cfg.Configuration; | ||
import org.hibernate.cfg.Environment; | ||
import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite; | ||
|
||
/** | ||
* @author Gail Badner | ||
*/ | ||
public class MultiPathCircleCascadeCheckNullFalseDelayedInsertTest extends MultiPathCircleCascadeDelayedInsertTest { | ||
|
||
public MultiPathCircleCascadeCheckNullFalseDelayedInsertTest(String str) { | ||
super( str ); | ||
} | ||
|
||
@Override | ||
public void configure(Configuration cfg) { | ||
super.configure( cfg ); | ||
cfg.setProperty( Environment.CHECK_NULLABILITY, "false" ); | ||
} | ||
|
||
public static Test suite() { | ||
return new FunctionalTestClassTestSuite( MultiPathCircleCascadeCheckNullFalseDelayedInsertTest.class ); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...g/hibernate/test/cascade/circle/MultiPathCircleCascadeCheckNullTrueDelayedInsertTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* Copyright (c) 2010, 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 | ||
* | ||
*/ | ||
package org.hibernate.test.cascade.circle; | ||
|
||
import junit.framework.Test; | ||
|
||
import org.hibernate.cfg.Configuration; | ||
import org.hibernate.cfg.Environment; | ||
import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite; | ||
|
||
/** | ||
* @author Gail Badner | ||
*/ | ||
public class MultiPathCircleCascadeCheckNullTrueDelayedInsertTest extends MultiPathCircleCascadeDelayedInsertTest { | ||
|
||
public MultiPathCircleCascadeCheckNullTrueDelayedInsertTest(String str) { | ||
super( str ); | ||
} | ||
|
||
@Override | ||
public void configure(Configuration cfg) { | ||
super.configure( cfg ); | ||
cfg.setProperty( Environment.CHECK_NULLABILITY, "true" ); | ||
} | ||
|
||
public static Test suite() { | ||
return new FunctionalTestClassTestSuite( MultiPathCircleCascadeCheckNullTrueDelayedInsertTest.class ); | ||
} | ||
} |
Oops, something went wrong.