Dear Robert,
will it load another instance or just use the previously loaded instance?
In the
EJB 2.0 Specs, Chapter 9 Client View of an Entity, Section 9.8 Primary key and object identity, Page 120, Last Paragraph, it says:
A client can test whether two entity object references refer to the same entity object by using the isIdentical method. Alternatively, if a client obtains two entity object references from the same home, it can determine if they refer to the same entity by comparing their primary keys using the equals method.
So if the entity bean instance is still loaded, calling findByPrimaryKey with the same primary key will not create another instance. It will create only another EJBObject, which references the same entity instance. Because the container uses one instance to represent a particular entity. In this case, you can
test if the two EJBObjects refers to the same entity using the way mentioned above.
Share Knowledge to gain it.<br /> <br />SCJP 1.2, SCDJWS 1.4, SCWCD 1.4, SCBCD 1.3, ICAD