openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uri Boness <>
Subject Mapping an enum collection
Date Wed, 29 Aug 2007 11:36:00 GMT

I have a User entity that holds set of Role's. A Role is of an Enum 
type. I tried using the @PersistentCollection and @ContainerTable 
annotations as follows:

public enum Role {



public class User {
    @ContainerTable(name = "user_role", joinColumns = @XJoinColumn(name 
= "user_id", referencedColumnName = "id"))
    private Set<Role> roles;


I guess my question is how do I define the column in the container table 
to which the will be saved? (I noticed that Kodo defines an 
@ElementColumn annotation which is not present in OpenJPA). Btw, when 
openjpa builds the schema for this mapping, no exception is thrown but 
also the "user_role" table is not created, any idea?


View raw message