I didn't quite get what you were trying to describe but in my case I have E1 and E2 joined as many to many. In any case that I make a change to E1 I only want it remained linked to the E2 entity, not making any changes to any E2 entity since E2 is persisted as a stand-alone entity.
In this case I set the field in E1 that joins to E2 as (cascade={CascadeType.REFRESH}) since I never want E1 to change E2 only maybe link to another E2 record. Hope I understood what you were saying correctly. Regards Chris -----Original Message----- From: Laird Nelson [mailto:ljnel...@gmail.com] Sent: Friday, 14 August 2009 2:33 AM To: users@openjpa.apache.org Subject: insertable/updatable = false question I have an entity, E2, that contains a many-to-one relationship with E1 like this: // assume E1's primary key column is x @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "x", referencedColumnName = "x", insertable = false, updatable = false) private E1 e1; Then in E2 I also have a field like this: @Column(name = "x") private int x; When I first create an instance of E2, I set x to, say, 5. Let's assume we know that E1 exists in the database under a primary key of x = 5 as well. If I examine the unpersisted/transient E2 instance, I can see that x indeed is 5, and e1 is null, as I'd expect. Now--we're on the server side for all this--I do this: e2 = this.em.merge(e2); this.em.flush(); After the flush, I would expect that: e2 would be persisted e2 would have its x = 5 (unchanged) e2.e1 would be NON NULL. That is if I did: e2.getE1(); I'd get back a non-null return value. But instead I am seeing that e2.e1 is null. Is this expected behavior? What I'm looking for is the ability for someone to create an E2 without an E1 in hand, pass it in to my EJB method, where I will--using lazy loading--"inflate" the E1 relationship. I can't figure out how to make this happen. Thanks, Laird