openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uri Boness <...@jteam.nl>
Subject Mapping an enum collection
Date Wed, 29 Aug 2007 11:36:00 GMT
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


Mime
View raw message