-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Problem, help me!!
PostPosted: Tue Oct 19, 2004 4:12 am 
Newbie

Joined: Tue Oct 19, 2004 4:00 am
Posts: 2
I got a class called Rappel and another called RappelPk (both generated by hibernate).
I try this:




findCriteria(Integer atrbFromRappelPk, String atrbFromRappel){

s = HibernateUtil.currentSession();
crit = s.createCriteria(getReferenceClass());

if(atrbFromRappelPk!=null){
crit.add(Expression.eq("codigoExterno", atrbFromRappelPk));
}


if(nombre != null && !nombre.equals("")){
crit.add(Expression.eq("numeroVendedor", atrbFromRappel));
}

retorno = crit.list();
}


With the attribute atrbFromRappel works well, but with the atrbFromRappelPk KO:

net.sf.hibernate.QueryException: could not resolve property: RappelPk.codigoExterno of: com.cofidis.fuentes.gestion.modelo.valueobject.Rappel


I tried the next:

crit.add(Expression.eq("RappelPk.codigoExterno", atrbFromRappelPk));

but it doesn't work, what can I do?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:44 am 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
Show us your mapping. It looks as if the property codigoExterno of class RappellPk is not mapped. Do you have getter/setter for this property defined?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 6:28 am 
Newbie

Joined: Tue Oct 19, 2004 4:00 am
Posts: 2
I solved It, I must put:

crit.add(Expression.eq("Id.codigoExterno", codeExtern));
and not

crit.add(Expression.eq("codigoExterno", codeExtern));


Thank's.


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

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.