-->
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: Issue Joining Three tables in hibernate and passing criteria
PostPosted: Fri Dec 15, 2006 5:55 pm 
Newbie

Joined: Fri Dec 15, 2006 5:49 pm
Posts: 16
Hi- I am having issues creating a join between three tables and then passing in a parameter to one of the tables:

org.hibernate.QueryException: could not resolve property:of: com.TaskItem
org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1265)
org.hibernate.loader.criteria.CriteriaQueryTranslator.getPathEntityName(CriteriaQueryTranslator.java:190)
org.hibernate.loader.criteria.CriteriaQueryTranslator.createCriteriaEntityNameMap(CriteriaQueryTranslator.java:177)
org.hibernate.loader.criteria.CriteriaQueryTranslator.<init>(CriteriaQueryTranslator.java:83)
org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:58)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1531)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
org.hibernate.impl.CriteriaImpl$Subcriteria.list(CriteriaImpl.java:143)execute(Unknown Source)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


Last edited by SuperMan2000 on Fri Dec 22, 2006 1:28 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 15, 2006 7:30 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Quote:
<many-to-one name="rule_id"
column="rule_id"
class="com.accuserverx.accucharge.dao.hibernate.Rule"
not-null="true" />

<many-to-one name="inbound_id"
column="inbound_id"
class="com.accuserverx.accucharge.dao.hibernate.InboundTransactions"
not-null="true" />

and the criteria I pass in my action class are:

List workListErrors = session.createCriteria(WorkListErrors.class)
.createCriteria("InboundTransactions")
.add(Expression.gt("department", new Integer(601)))
.list();


Please use the code tags and so on to make your post more readable.

I don't see where you're joining tables. Then, you must use property names (name attribute), not class names inside create(sub)Criteria().

So, try somethink more like :
Code:
List workListErrors = session.createCriteria(WorkListErrors.class)
.createCriteria("inbound_id")
.add(Restrictions.gt("department", new Integer(601)))
.list();


* Use Restrictions class instead of Expression which is "semi-deprecated" as specified in the javadoc.
* I guess you meant inbound instead of inbound_id for the relation name. In fact, you're referencing here an InboundTransactions object, not only its primary key. Here you are on the object side :-)

HTH

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject: Why I am getting nulls from the database in my fields..
PostPosted: Wed Dec 27, 2006 1:24 pm 
Newbie

Joined: Fri Dec 15, 2006 5:49 pm
Posts: 16
I have this field called status and you can enter anything in this field and it is not even required. but for some reason when I get data back from hibernate I get back the value "null" in my field.... why is this happening.. i am using hibernate to retrieve the data...


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.