These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: first element of the list set to null
PostPosted: Mon Feb 01, 2010 2:54 pm 
Newbie

Joined: Mon Feb 01, 2010 2:42 pm
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.