-->
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.  [ 5 posts ] 
Author Message
 Post subject: Probleme beim Formulieren eines Statements
PostPosted: Tue Oct 10, 2006 8:41 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hallo an alle!

Ich habe zwei Tabellen in meiner DB. Cal bezeichnet Einträge eines Kalenders. Schichtplan bezeichnet Tätigkeiten an einem bestimmten Tag. Die Tabellen stehen demnach in einer 1 zu n Beziehung => An einem Tag können n Tätigkeiten geplant sein (Verknüpfung über das Datum).

Ich möchte nun eine Query erstellen (HQL, wenn möglich), die mir alle Cal-Objekte liefert, für die mindestens eine Tätigkeit geplant sind. Problem: Ich möchte die Cal-Objekte nur einmal pro Tag erhalten (Ein Join liefert mir für n Tätigkeiten auch n Cal-Objekte).

Kann jemand helfen? Ich stehe auf dem Schlauch...! Vielen Dank für eure Aufmerksamkeit,

Gruß,

Barnti

_________________
Regards,
ak


Please don't forgat to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:49 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
select c from Cal c left join c.Schichtplan s where size(c.Schichtplan) > 0

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject: Exception während der Ausführung
PostPosted: Mon Nov 13, 2006 6:01 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hallo,

sorry für die verspätete Rückmeldung. Ich war etwas länger nicht mehr im Office...

Ich habe Deine Query genommen und wie folgt angepasst:
Code:

Select
   cal
from
   Cal cal
   left join cal.pepSchedules
where
   size(cal.pepSchedules) > '0'
and    
   cal.pepSchedules.empSk = '-979999242803'

Im Hibernate Query editor funktioniert das tadellos. Im Code dagegen bekomme ich beim abschicken der Query die folgende Exception:

Code:
2006-11-13 10:32:35 StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
javax.faces.FacesException: Cannot get value for expression '#{schichtplan.schichtplanliste}'
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:435)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
   at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at de.wfm.urlaubsplanung.filter.SecurityFilter.doFilter(SecurityFilter.java:104)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:65)
   at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:226)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
   at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
   at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:790)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:709)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:572)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
   at java.lang.Thread.run(Unknown Source)
Caused by: javax.faces.el.EvaluationException: Cannot get value for expression '#{schichtplan.schichtplanliste}'
   at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:402)
   at javax.faces.component.UIData.getValue(UIData.java:1019)
   at org.apache.myfaces.component.html.ext.HtmlDataTableHack.createDataModel(HtmlDataTableHack.java:433)
   at org.apache.myfaces.component.html.ext.HtmlDataTable.createDataModel(HtmlDataTable.java:741)
   at org.apache.myfaces.component.html.ext.HtmlDataTableHack.getDataModel(HtmlDataTableHack.java:410)
   at org.apache.myfaces.component.html.ext.HtmlDataTable.getDataModel(HtmlDataTable.java:734)
   at org.apache.myfaces.component.html.ext.HtmlDataTableHack.getRowCount(HtmlDataTableHack.java:84)
   at de.wfm.urlaubsplanung.tag.MyHtmlTableRendererBase.encodeInnerHtml(MyHtmlTableRendererBase.java:399)
   at de.wfm.urlaubsplanung.tag.MyHtmlTableRendererBase.dispatchInnerEncoding(MyHtmlTableRendererBase.java:337)
   at de.wfm.urlaubsplanung.tag.MyHtmlTableRendererBase.encodeChildren(MyHtmlTableRendererBase.java:308)
   at de.wfm.urlaubsplanung.tag.MyExtHtmlTableRenderer.encodeChildren(MyExtHtmlTableRenderer.java:180)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
   at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:436)
   at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
   at org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:75)
   at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
   at javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:495)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
   at org.apache.myfaces.shared_impl.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:54)
   at org.apache.jsp.web.schichtplanung_jsp._jspx_meth_h_panelGroup_0(schichtplanung_jsp.java:1331)
   at org.apache.jsp.web.schichtplanung_jsp._jspx_meth_h_form_1(schichtplanung_jsp.java:1278)
   at org.apache.jsp.web.schichtplanung_jsp._jspx_meth_f_view_0(schichtplanung_jsp.java:232)
   at org.apache.jsp.web.schichtplanung_jsp._jspService(schichtplanung_jsp.java:161)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:268)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:258)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:205)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
   at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:416)
   ... 40 more
Caused by: javax.faces.el.EvaluationException: Exception getting value of property schichtplanliste of base of type : de.wfm.urlaubsplanung.managedBeans.SchichtplanBean
   at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:96)
   at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
   at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
   at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:383)
   ... 75 more
Caused by: javax.faces.el.EvaluationException: Bean: de.wfm.urlaubsplanung.managedBeans.SchichtplanBean, property: schichtplanliste
   at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
   at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
   ... 78 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
   ... 79 more
Caused by: java.lang.NullPointerException
   at org.hibernate.hql.ast.DotNode.resolveInFunctionCall(DotNode.java:142)
   at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:434)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:824)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:1733)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:861)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:3209)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:2765)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1321)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1246)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:584)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:389)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:184)
   at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:140)
   at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
   at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
   at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:814)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:773)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
   at de.wfm.urlaubsplanung.hibernate.hibernateUtil.schedule.PepSchedulesHome.getSchichtPlanliste(PepSchedulesHome.java:191)
   at de.wfm.urlaubsplanung.services.SchichtplanService.getSchichtplan(SchichtplanService.java:68)
   at de.wfm.urlaubsplanung.services.ServiceLocator.getSchichtplan(ServiceLocator.java:395)
   at de.wfm.urlaubsplanung.beanFactory.SchichtplanBeanFactory.createNewBean(SchichtplanBeanFactory.java:50)
   at de.wfm.urlaubsplanung.beanFactory.Director.constructBean(Director.java:32)
   at de.wfm.urlaubsplanung.beanFactory.FactoryFacade.createSchichtplanBean(FactoryFacade.java:189)
   at de.wfm.urlaubsplanung.managedBeans.SchichtplanBean.loadDefaults(SchichtplanBean.java:151)
   at de.wfm.urlaubsplanung.managedBeans.SchichtplanBean.getSchichtplanliste(SchichtplanBean.java:140)
   ... 84 more



was mache ich denn jetzt noch falsch. Die Fehlermeldung ist nicht sehr aussagekräftig. Kann jemand helfen?

Viele Grüße,

barntl

_________________
Regards,
ak


Please don't forgat to rate


Top
 Profile  
 
 Post subject: Fehlermeldung
PostPosted: Mon Nov 13, 2006 6:50 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hallo noch einmal,

diese Fehlermeldung hatte ich übersehen:

Code:
Invalid path: 'cal.pepSchedules'
39256 [http8080-Processor25] ERROR hql.parser  - *** ERROR:  Invalid path: 'cal.pepSchedules'


Kann mir jemand sagen warum das im Code nicht funktioniert?

Gruß,

barntl

_________________
Regards,
ak


Please don't forgat to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 11:17 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Man kann 1:n Beziehungen nicht durch Punkt Notation durchlaufen.
Besser:

Code:
Select
   cal
from
   Cal cal
   left join cal.pepSchedules p
where
   size(cal.pepSchedules) > '0'
and   
   p.empSk = '-979999242803'

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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