I'm having trouble with the following OneToMany relationship:
| @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
| @JoinTable(name = "PRDCT_GRP_TO_FILTER",
| joinColumns = { @JoinColumn(name = "PRDCT_GRP_ID") },
| inverseJoinColumns = @JoinColumn(name = "PRDCT_CLASS_FILTER_ID"))
| public Collection<ProductClassFilter> getClassFilters() {
| return classFilters;
| }
|
It seems that whenever I call getClassFilters() it returns a collection with
twice as many objects as there should be. It actually duplicates every single
object in the relationship so instead of returning an array of, say, 2 objects,
it returns 4 objects (2 of which are duplicated).
I've tried using @JoinColumn instead of @JoinTable, I've tried playing with
cascade types, fetch types and I've checked and rechecked the data in the
database (which is correct).
It works fine when I persist the data but after I fetch it, everything is
duplicated. If I try to merge it afterwards, it tries to save the duplicated
objects so I get a unique constraint exception from oracle, but not from the
framework.
Any ideas of what might be causing this?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3927857#3927857
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3927857
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user