Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Re: EclipseLink might be caching entity relations with itself

Ok, it was my fault, I think I got used to ol' CMP, although It seems
to me that TopLink did it this way. The spec clearly stares that is
the developer's responsibility to keep in memory coherence of the not
owning side of the collection.

Thanks,
Enrico

On Saturday, January 9, 2010, Enrico Maria Crisostomo
<enrico.m.crisostomo@xxxxxxxxx> wrote:
> Hi.
>
> I'm experiencing a strange behaviour when EclipseLink seem to
> incorrectly fetch relations of an entity with itself.
>
> I have an entity, Account, which is used to model a hierarchy of
> accounts: every account may have a (nullable) parent and a collections
> of children (mapped by the parents' relationship). Parents and
> children properties of the Account entity are annotated with default
> valued @ManyToOne and @OneToMany(mappedby="parents") annotations. When
> an Account entity is updated in the db, setting
> it's parent property, the parent Account children list is not updated
> accordingly when such entity is fetched from the db. Upon restart of
> the application, the first time Accounts are loaded they're correctly
> populated. I also tried using a @JoinTable, which is created and
> populated correctly, but the behaviour is the same.
>
> In case you wonder, Account equals and hashCode only check Account's
> autogenerated Long primary key.
>
> I also have other parents-child relationships between different
> entities and they are correctly fetched from the db. I suspect this
> behavious is restricted to this case because of an entity being
> maintaining such relationships with itself.
>
> Have this behaviour been observed before, might I be missing something
> or might this be a bug?
>
> Thank you in advance for your help,
> Enrico
>
> --
> Ελευθερία ή θάνατος
> "Programming today is a race between software engineers striving to
> build bigger and better idiot-proof programs, and the Universe trying
> to produce bigger and better idiots. So far, the Universe is winning."
> GPG key: 1024D/FD2229AF
>

-- 
Ελευθερία ή θάνατος
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying
to produce bigger and better idiots. So far, the Universe is winning."
GPG key: 1024D/FD2229AF


Back to the top