Hi,

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 {

   NORMAL_USER, ADMINISRATOR

}

@Entity
public class User {
   ..
   @PersistentCollection
@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 Role.name() 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?

cheers,
Uri

Reply via email to