I have the same problem with Glassfish 3.0.1 b22 + EclipseLink. The problem also occures in GF 3.1 b21 + EclipseLink.
The test classes I use are really simple:
@Entity
@Table(name = "testa")
public class TestA implements Serializable {
@Id
@SequenceGenerator(name="TESTA_ID_GENERATOR", sequenceName="TESTA_ID_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TESTA_ID_GENERATOR")
private Long id;
public TestA() {
}
}
@Entity
@Table(name = "testb")
public class TestB implements Serializable {
@Id
@SequenceGenerator(name="TESTB_ID_GENERATOR", sequenceName="TESTB_ID_SEQ")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TESTB_ID_GENERATOR")
private Long id;
//uni-directional one-to-one association to TestA
@OneToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "testa_id")
private TestA testa;
public TestA getTesta() {
return this.testa;
}
}
em.findById(TestB.class, id) always loads TestB and TestA from the database. I have not found a solution yet.
[Message sent by forum member 'jjackb']
http://forums.java.net/jive/thread.jspa?messageID=483260