I'm using ElementCollection annotation, but i can't make it work, looks like hibernate is not processing it.
My code
@Entity(name = "user") public class User implements Serializable {
private static final long serialVersionUID = 5791136125077815304L;
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String username; private String password; private String mail; private Date createdOn;
@ElementCollection @Column(name = "authority") @CollectionTable(name = "user_authority", joinColumns = @JoinColumn(name = "user_id")) @Enumerated(EnumType.ORDINAL) private List<AuthorityEnum> authorityList; ...
public enum AuthorityEnum { ROLE_ADMIN, ROLE_USER;
public int getId() { return ordinal(); } }
I tried several different things, but every time i save a User i only can see the insert referred to user table, nothing about authorities.
I'm using hibernate 3.6.1-Final, hibernate-commons-annotations-3.2.0-Final, hibernate-jpa-2.0-api-1.0.0-Final, atomikos 3.7.0 and spring 3.0.4 under jetty-8.0.0.M2.
Any clue?
|