Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Doing an em.find() on an entity with an attribute defined as @OneToOne using mappedBy

Hi Zarar,

   If you set the OneToOne relationships to lazy (which are eager by default in JPA) and enable weaving (if outside a container)  then you will be able to find an A or B without loading the associated B or A.

       Shaun

Have you disabled caching for A and B?

Zarar Siddiqi wrote:
When I try to select an entity, A, which has a @OneToOne relation with
another entity, B, I end up getting a recursive call if A is the
non-owning entity.

class A {
   @OneToOne(mappedBy="a")
   private B b;
}

class B {
   @OneToOne @JoinColumn("A_ID")
   private A a;
}


If I do an em.find(A.class, someId); it ends up it ends up being a
never-ending recursive call as when it tries to read B, it tries to
read A and so on so forth.

Any ideas on how I can do a select on entity A?

Thanks,
Zarar
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
  

--
Oracle
Shaun Smith | Principal Product Manager
Phone: +19055023094
Oracle Server Technologies, Oracle TopLink
ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga, Ontario | L5R 3P4

Green Oracle Oracle is committed to developing practices and products that help protect the environment

Back to the top