Re: How to PERSIST object without loading references?

2008-06-11 Thread Anonimus
Ognjen Blagojevic wrote: > > It must be a way to INSERT objects in the database without looking up > for all the references, but I am not able to find it. > My problem is similar as yours, with a single difference. I don't mind loading all the references because I need them in the program. Bu

Re: How to PERSIST object without loading references?

2008-06-11 Thread Enrico Goosen
I'm getting so frustrated with OpenJPA! I'm also experiencing the problem listed in previous reply, and once again, no response to that post. Here's some code to explain my problem: TblPdtbnf.java: @OneToOne(fetch = FetchType.LAZY) @JoinColumns([EMAIL PROTECTED](name ="PDTBNF_ID",referencedColumnN

Re: How to PERSIST object without loading references?

2008-06-11 Thread Michael Dick
Hi Anonimus, What exception do you get when you don't specify CascadeType.PERSIST? I'm assuming you're doing something like this : Employee e = new Employe(); e.setName("John Doe"); Department d = em.find(Department.class, idDept); // this is what I think you mean by loading all the references

Problem with insert

2008-06-11 Thread du27177
Hi. I have problem with inserting in database. I don't know how to insert object and disable an attempt of inserting in related tables. example: @Entity @Table(name = "MAIN_TABLE", schema = "SCH") @Inheritance(strategy=InheritanceType.JOINED) public class MainClass extends MainDataObject {

Re: How to PERSIST object without loading references?

2008-06-11 Thread Fay Wang
Hi Enrico, Here is my example, and it runs fine: (1) EntityA.java: @Entity public class EntityA { @Column(name="A_ID") @Id private int id; private String name; @OneToOne(fetch = FetchType.LAZY) @JoinColumns([EMAIL PROTECTED](name="B_ID", referen

Re: How to PERSIST object without loading references?

2008-06-11 Thread Anonimus
Hi Michael, your assumptions are correct. After em.persist(e); I get this exception if I specify CascadeType.PERSIST: >org.apache.openjpa.persistence.InvalidStateException: The generated value > processing detected an existing value assigned to this field: > mypackage.Department.idDepartment.