-->
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.  [ 2 posts ] 
Author Message
 Post subject: QueryException: could not resolve property
PostPosted: Mon Sep 15, 2008 11:20 pm 
Newbie

Joined: Mon Sep 15, 2008 10:22 pm
Posts: 1
Hi, I saw an answer posted for a similar problem but the code had some european names and was confusing. Can somebody please help me resolve this? I understand that it seems to go away with creating aliases of some sort

Hibernate version:
3.0.5

Mapping documents:
<hibernate-mapping>
<class name="com.belfast.db.object.Alias" table="BEALIAS">
<id name="aliasid" column="aliasid">
<generator class="native"/>
</id>
<many-to-one name="user" class="com.belfast.user.User" column="userid" not-null="true"/>
<property name="alias"/>
<property name="description"/>
</class>
</hibernate-mapping>

<hibernate-mapping>
<class name="com.belfast.user.User" table="BEUSER">
<id name="userid" column="userid">
<generator class="native"/>
</id>
<property name="grp"/>
<set name="aliases" cascade="all" inverse="true">
<key column="userid"/>
<one-to-many class="com.belfast.db.object.Alias"/>
</set>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Transaction tx = session.beginTransaction();
Criteria criteria = session.createCriteria(User.class);
criteria.add(Expression.eq("userName",user.getUserName()));
List result = criteria.list();
User aUser = null;
List aResult = null;
if(!result.isEmpty()){
aUser = (User) result.get(0);
Criteria aCriteria = session.createCriteria(Alias.class).createCriteria("user");
aCriteria.add(Expression.eq("user.userid",new Integer(aUser.getUserid())));
aResult = aCriteria.list();
} else {
System.out.println("Could not find User.");
}
Full stack trace of any exception that occurs:
2008-09-15 21:12:55,658 [http-8080-Processor23] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/Belfast].[action] - Servlet.service() for servlet action threw exception
org.hibernate.QueryException: could not resolve property: user of: com.belfast.registration.persist.User
at org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException(AbstractPropertyMapping.java:43)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:37)
at org.hibernate.persister.entity.BasicEntityPersister.getSubclassPropertyTableNumber(BasicEntityPersister.java:1111)
at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31)
at org.hibernate.persister.entity.BasicEntityPersister.toColumns(BasicEntityPersister.java:1086)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:403)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:369)
at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:42)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:314)
at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:92)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1303)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
at org.hibernate.impl.CriteriaImpl$Subcriteria.list(CriteriaImpl.java:142)
at com.belfast.db.dao.AliasDAO.listAlias(AliasDAO.java:59)
at com.belfast.user.admin.ListAliasAction.execute(ListAliasAction.java:28)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:613)

Name and version of the database you are using:
MYSQL 5.0.51a

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2008 1:43 pm 
Newbie

Joined: Mon Jul 23, 2007 11:58 am
Posts: 15
Location: New Jersey
I am having the same issue, except my associated path is for a composite id...anyone able to figure this out?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.