Author: epbernard
Date: 2006-09-22 15:20:51 -0400 (Fri, 22 Sep 2006)
New Revision: 10526
Added:
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Author.java
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Song.java
Modified:
trunk/HibernateExt/ejb/lib/ejb3-persistence.jar
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java
trunk/HibernateExt/metadata/lib/ejb3-persistence.jar
Log:
New Sig EJB3
Modified: trunk/HibernateExt/ejb/lib/ejb3-persistence.jar
===================================================================
(Binary files differ)
Added: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Author.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Author.java 2006-09-22
19:14:47 UTC (rev 10525)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Author.java 2006-09-22
19:20:51 UTC (rev 10526)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.ejb.test.cascade;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.GenerationType;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Author {
+ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"ENTITY2_SEQ")
+ @SequenceGenerator(name = "ENTITY2_SEQ")
+ private Long id;
+
+}
Modified: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java
===================================================================
---
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java 2006-09-22
19:14:47 UTC (rev 10525)
+++
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/CascadeTest.java 2006-09-22
19:20:51 UTC (rev 10526)
@@ -1,9 +1,8 @@
//$Id: FetchTest.java 9796 2006-04-26 06:46:52Z epbernard $
package org.hibernate.ejb.test.cascade;
-import java.util.List;
-
import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
import org.hibernate.ejb.test.TestCase;
@@ -54,11 +53,42 @@
}
+ public void testNoCascadeAndMerge() throws Exception {
+ Song e1 = new Song();
+ Author e2 = new Author();
+ e1.setAuthor(e2);
+
+ EntityManager em = factory.createEntityManager();
+ EntityTransaction tx = em.getTransaction();
+ tx.begin();
+ em.persist(e2);
+ em.persist(e1);
+ tx.commit();
+ em.close();
+
+ em = factory.createEntityManager();
+
+ e1 = em.find(Song.class, e1.getId());
+ e2 = null;
+
+
+ tx = em.getTransaction();
+ tx.begin();
+ em.merge(e1);
+ //em.refresh(e1);
+ tx.commit();
+ em.close();
+
+ }
+
+
public Class[] getAnnotatedClasses() {
return new Class[]{
Teacher.class,
- Student.class
+ Student.class,
+ Song.class,
+ Author.class
};
}
Added: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Song.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Song.java 2006-09-22
19:14:47 UTC (rev 10525)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/cascade/Song.java 2006-09-22
19:20:51 UTC (rev 10526)
@@ -0,0 +1,38 @@
+//$Id: $
+package org.hibernate.ejb.test.cascade;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.FetchType;
+import javax.persistence.ManyToOne;
+import javax.persistence.GenerationType;
+import javax.persistence.SequenceGenerator;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Song {
+ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
"ENTITY1_SEQ")
+ @SequenceGenerator(name = "ENTITY1_SEQ") private Long id;
+ @ManyToOne(fetch = FetchType.LAZY, optional = false)
+ private Author author;
+
+ public Author getAuthor() {
+ return author;
+ }
+
+ public void setAuthor(Author author) {
+ this.author = author;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+}
Modified: trunk/HibernateExt/metadata/lib/ejb3-persistence.jar
===================================================================
(Binary files differ)
Show replies by date