Hi Laird, I also think that you should get a NON-NULL for e2.gete1() after flush, provided e2 is managed at the time you are doing e2.gete1().
What if you do e2 = em.find(e2.class,PK); e2.gete1(); then are you getting a non-null e1 value ? Regards, Ravi. -----Original Message----- From: Laird Nelson [mailto:ljnel...@gmail.com] Sent: Thursday, August 13, 2009 10: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