-->
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.  [ 4 posts ] 
Author Message
 Post subject: Search a set of elements
PostPosted: Mon Mar 01, 2004 7:56 am 
Newbie

Joined: Mon Mar 01, 2004 7:41 am
Posts: 6
Hi everyone, this is my first visit, definitely not the last.

I've got a wine table with a set of wineFoodGroups, the hbm.xml section looks like this:
<class name="za.co.thewinelist.model.Wine" table="wine">
<id name="id">
<generator class="native"/>
</id>
<property name="name"/>
<property name="description" length="1024"/>
<many-to-one name="user" not-null="true"/>
<many-to-one name="varietal"/>
<property name="price"/>
<property name="winery"/>
<property name="vintage"/>
<property name="award"/>
<property name="rating"/>
<property name="created" type="timestamp"/>
<set name="wineViews" inverse="true" cascade="all-delete-orphan" lazy="true">
<key column="wine"/>
<one-to-many class="za.co.thewinelist.model.WineView"/>
</set>
<set name="wineListWines" inverse="true" cascade="all-delete-orphan" lazy="true">
<key column="wine"/>
<one-to-many class="za.co.thewinelist.model.WineListWine"/>
</set>
<set name="wineFoodGroups" table="WineToFoodGroup" cascade="all">
<key column="wine"/>
<many-to-many column="foodGroup" class="za.co.thewinelist.model.FoodGroup"/>
</set>

in my JavaAction I'm doing the following:

Query query = session.createQuery( "select wine from za.co.thewinelist.model.Wine wine " +
"where wine.varietal = :varietal " +
"and :foodGroup in elements( wine.wineFoodGroups ) " );
query.setString( "varietal", searchVarietalId );

FoodGroup fdGroup = (FoodGroup)session.load( za.co.thewinelist.model.FoodGroup.class, foodGroupId );
query.setEntity( "foodGroup", fdGroup );

This does not work, I'm new to hibernate and would appreciate any help.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 8:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
What do you mean by "does not work"?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 8:12 am 
Newbie

Joined: Mon Mar 01, 2004 7:41 am
Posts: 6
I'm unable to run my program, but if I do the query without the in elements section, it works fine, but obviously I need to test if a foodgroup exists in the set, and I don't know how to do this. This is a many to many set.

the error:
java.lang.RuntimeException: Caught an Ognl exception while getting property wines
at com.opensymphony.xwork.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:102)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1444)
at ognl.ASTProperty.getValueBody(ASTProperty.java:96)
at ognl.SimpleNode.getValue(SimpleNode.java:167)
at ognl.Ognl.getValue(Ognl.java:335)
at ognl.Ognl.getValue(Ognl.java:310)
at com.opensymphony.xwork.util.OgnlValueStack.findValue(OgnlValueStack.java:92)
at com.opensymphony.webwork.views.jsp.WebWorkBodyTagSupport.findValue(WebWorkBodyTagSupport.java:45)
at com.opensymphony.webwork.views.jsp.IteratorTag.doStartTag(IteratorTag.java:140)
at org.apache.jsp.winesselection_jsp._jspx_meth_ww_iterator_0(winesselection_jsp.java:497)
at org.apache.jsp.winesselection_jsp._jspService(winesselection_jsp.java:202)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
at com.opensymphony.webwork.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:67)
at com.opensymphony.webwork.dispatcher.WebWorkResultSupport.execute(WebWorkResultSupport.java:53)
at com.opensymphony.xwork.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:269)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:191)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at za.co.quirk.webwork.interceptor.HibernateInterceptor.intercept(HibernateInterceptor.java:47)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:37)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at za.co.thewinelist.interceptor.MenuInterceptor.intercept(MenuInterceptor.java:35)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at za.co.thewinelist.interceptor.LoginInterceptor.intercept(LoginInterceptor.java:39)
at com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:169)
at com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:116)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.serviceAction(ServletDispatcher.java:181)
at com.opensymphony.webwork.dispatcher.ServletDispatcher.service(ServletDispatcher.java:161)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at com.opensymphony.webwork.lifecycle.RequestLifecycleFilter.doFilter(RequestLifecycleFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:129)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at za.co.quirk.filter.GZIPFilter.doFilter(GZIPFilter.java:44)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 8:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is no hibernate class involved anywhere in that stack trace. So I suggest you get out your debugger, look at the find result and check what property navigation you are doing wrong in your XWork stuff.


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