openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: "element" column of the associated table is null
Date Thu, 26 Apr 2012 18:36:05 GMT
It appears that this in an OpenJPA bug. Could I have you open a JIRA for
this issue and attach your testcase?

I'm not sure when I'll get time to try to fix this issue, but for the short
term you have a couple workaround options....Option #1 -- you could change
your ID generation strategy to AUTO[1]. Option #2 -- don't rely on the
cascade persist functionality. Manually persist each of your children
objects (Class1, Class2) before persisting Holder[2].

Thanks,
Rick

[1]
@Id
@GeneratedValue(strategy = GenerationType.AUTO)

[2]
class HolderDao ....
    public boolean create(Holder h) {
        EntityTransaction trans = em.getTransaction();

        trans.begin();

        for (IInterface i : h.getClasses()) {
            em.persist(i);
        }
        em.persist(h);
        trans.commit();

        return true;
    }

On Thu, Apr 26, 2012 at 10:14 AM, CarpathianAnonymous <
andreibratu2004@yahoo.com> wrote:

> I've attached my UnitTest
>
> http://openjpa.208410.n2.nabble.com/file/n7503208/src.rar src.rar
>
> --
>



-- 
*Rick Curtis*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message