Hi,
I have a problem with a List :
@Entity public Class User { @Embedded private userDetail userDetail; }
@Embeddable public Class UserDetail {
@CollectionOfElements(targetElement = Authority.class, fetch = FetchType.LAZY) @JoinTable(name = SecurityConstants.AUTHORITY_TABLE, joinColumns = @JoinColumn(name = "USERS_ID" )) @IndexColumn(name="INDEX_COL") @Column(name = SecurityConstants.AUTHORITY_NAME, nullable = SecurityConstants.AUTHORITY_NAME_NULLABLE) private List<Authority> authorities = new LinkedList<Authority>();
}
@Embeddable public Class Authority {
private String authority; }
Now, when I do Criteria crit = getSession().createCriteria(User.class); crit.add(Restrictions.idEq( 1L )); crit.setFetchMode("userDetail.authorities", FetchMode.JOIN); user = (User) crit.uniqueResult();
When I look at the list of authorities I get, I have the first element set to null List authorities = user.getUserDetail().getAuthorities() = [[null, com.ixo.security.Authority@62d337d3]
Have you ever experienced this behavior ?
Thanks
Akeduc
|