-->
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: La liste de composants contient des éléments null
PostPosted: Tue Feb 02, 2010 5:26 am 
Newbie

Joined: Mon Feb 01, 2010 2:42 pm
Posts: 3
Bonjour,

J'ai 3 classes : User 1 ----> 1 UserDetail 1 ----> (1,n) Authority

Quand je load un User par le code suivant

Code:
Criteria crit = getSession().createCriteria(User.class);
crit.add(Restrictions.idEq( 1L ));
crit.setFetchMode("userDetail.authorities", FetchMode.JOIN);
user = (User) crit.uniqueResult();


j'obtiens bien un User, mais quand je fais user.getUserDetail().getAuthorities(),
le premier élément de la liste est null (pour le premier user), les 2 premiers éléments de la liste
sont null (pour le deuxième user) et ainsi de suite.

List authorities = user.getUserDetail().getAuthorities() = [[null, com.ixo.security.Authority@62d337d3]


Avez vous une idée du pourquoi je m'arrache les cheveux ????????


PS: Hibernate core 3.3.2 GA / Hibernate Annotion 3.4.0 GA / Postgre 8.4 / jdbc driver 3


Code:
@Entity
public Class User {

   @Embedded
   private userDetail userDetail;
}


Code:
@Embeddable
public Class UserDetail {

   @CollectionOfElements(targetElement = Authority.class, fetch = FetchType.LAZY)
   @JoinTable(name = "Authority", joinColumns = "USERS_ID" )
   @IndexColumn(name="INDEX_COL")
   @Column(name = "Authority", nullable = false)
   private List<Authority> authorities = new LinkedList<Authority>();

}


Quote:
@Embeddable
public Class Authority {

private String authority;
}


Si vous avez une piste, Merci !!!!

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.