0 Replies Latest reply on Jan 26, 2007 6:40 AM by Mike Alexander Meyer

    Attached/managed entity identity

    Mike Alexander Meyer Newbie

      Hi,

      I'm wondering if two attached/managed entities obtained from the same persistence context in two different ways are guaranteed to be equal by referential identity?

      For example:
      Let A and B be related.

      A a = (A)em.find(...);
      B b = (B)em.find(B.class, a.getB().getId());
      
      assert(b.equals(a.getB());
      assert(b == a.getB());
      


      The above example works on JBoss EJB3 RC9 i.e. Hibernate, but is it guaranteed by the specification? I could'nt find any clear statement about it.