Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @BasicCollection not updating on merge

Your mapping looks correct.  Could you include the code you use to
read/update/merge the object, and the version of EclipseLink you are using.

If you make the relationship lazy, or use a List instead of Set, or update
the managed object instead of merging, does it work?



Stephiems wrote:
> 
> I haven't really used a BasicCollection before, so it is possible I'm not
> using it correctly.
> 
> Basically I've set-up a User-Role relationship, and I've used a
> BasicCollection for the roles. I've got it working so that on persist, the
> roles are also persisted and so when I get that same object again, I have
> the roles that were originally persisted. My trouble is now on merge. When
> I change the Set that holds the roles, and then merge or commit, the
> database does not update. I know I am mergine the object correctly because
> if I change a different value that is updating in the database, it is only
> the roles that don't seem to be cascading.
> 
> From my User class:
> 
> @ObjectTypeConverter (
>     name = "roleEnumFromStringConversion",
>     objectType = Role.class,
>     dataType = String.class,
>     conversionValues = {
>         @ConversionValue(objectValue = "ADMIN_ROLE", dataValue = "ADMIN"),
>         @ConversionValue(objectValue = "USER_ROLE", dataValue = "USER")
>     }
> )
> 
> AND
> 
> @BasicCollection(
>         fetch = FetchType.EAGER,
>         valueColumn = @Column(name = "ROLE")
>     )
>     @CollectionTable(
>         name = "USER_ROLE",
>         primaryKeyJoinColumns = {
>             @PrimaryKeyJoinColumn(name = "USER_ID", referencedColumnName =
> "USER_ID")
>         }
>     )
>     @Convert("roleEnumFromStringConversion")
>     private Set<Role> roles;
> 
> Thanks ahead of time for your help,
> Stephanie
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/%40BasicCollection-not-updating-on-merge-tp25109889p25139172.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top