On Wed, Nov 4, 2009 at 4:07 PM, Daryl Stultz <[email protected]> wrote:

> Hello,
>
> I'm wondering if anyone has seen something like this:
>
> <openjpa-1.2.1-r752877:753278 nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException: 5
>

I've run into this on 2 occasions with different fields in one entity. I can
get around it in both cases by changing a fetch from EAGER to LAZY. So I
have the entity A which has a collection of B which is set to LAZY. B has a
field C that is set to EAGER. I retrieve like this:

query = em.createQuery("select o from A as o");
((QueryImpl) query).getFetchPlan().addField(A.class, "bCol"); // bCol is
collection of B

The field B.c is defined like so

@ManyToOne(fetch = FetchType.EAGER, optional = false)
@JoinColumn(name = "cid", nullable = false)
@ForeignKey
private C c;

This has also happened on another field of B that is nullable/optional.

Right now the only way for me to feel the system is secure is to change
everything to LAZY and put fetchPlan addFields all over. Please tell me I
don't have to do that!

Thanks.

--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to