Results 1 to 2 of 2
Thread: persistence NULLs
- 08-29-2011, 11:59 PM #1
Member
- Join Date
- Aug 2011
- Posts
- 21
- Rep Power
- 0
persistence NULLs
working with eclipselink drivers, unable to sucesfully input data into the OneToOne entity relationships..though able to see the one to one relationship in the table view(s). Able to see parent entity's data...any sugestions?
CODE::::::
package PERSISTENCE.OnetoOne;
import javax.persistence.*;
@Entity
public class Customer {
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE)
private Long id;
private String name="JF";
private String personality="unknown";
private String aptitudes="Up in the Air...";
@OneToOne(fetch= FetchType.EAGER)
@JoinColumn(name="address_fk")
private Address1 address1;
Customer(){}
@Entity
@Table(name= "Address Table")
public static class Address1 {
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE)
private Long id;
private String location="JNormandy";
Address1(){this.location="JNormandy";}
}
public static void main(String[] args) {
Customer customer= new Customer();
EntityManagerFactory emf= Persistence.createEntityManagerFactory("chapter03P U");
EntityManager em= emf.createEntityManager();
EntityTransaction tx= em.getTransaction();
tx.begin();
em.persist(customer);
tx.commit();
tx.begin();
em.close();
emf.close();
}
}
- 09-21-2011, 04:59 AM #2
Member
- Join Date
- Aug 2011
- Posts
- 21
- Rep Power
- 0
Similar Threads
-
Persistence API with Java SE?
By FlyNn in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 02-14-2012, 10:47 PM -
Persistence
By frexjeff in forum Advanced JavaReplies: 1Last Post: 01-21-2011, 04:03 PM -
help me with persistence
By halyal in forum NetBeansReplies: 14Last Post: 09-04-2010, 10:20 AM -
Persistence technology
By Hugo in forum AWT / SwingReplies: 6Last Post: 05-09-2010, 12:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks