Skip to main content

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

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
-- 
View this message in context: http://www.nabble.com/%40BasicCollection-not-updating-on-merge-tp25109889p25109889.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top