Hi!
I've got a problem with DetachedCriteria and In-List.
Please have a look at my code:
Code:
Criteria crit =
s.createCriteria(ServiceAssignment.class, "sa")
.createAlias("service", "s");
DetachedCriteria dc = DetachedCriteria
.forClass(ResourceReservation.class, "res")
.setFetchMode("res.pk.resource", FetchMode.JOIN)
.createAlias("res.pk.resource.employee", "resEmp")
.add( Restrictions.eq("resEmp.id", searchData.getTechnicianId()))
.setProjection(Property.forName("res.pk.refNo1"));
crit.add(Property.forName("sa.id").in(dc));
The related Entitys are defined as follows:
Code:
@Entity
@Table(name="SERVICE")
public class Service extends DefaultBusinessData implements Serializable {
private static final long serialVersionUID = 8319881504472814377L;
@Id
@Column(name="SERVICENR")
private Long id;
}
@Entity
@Table(name="SRVEINSATZ")
public class ServiceAssignment implements Serializable {
private static final long serialVersionUID = -4423630394669230016L;
@Id
@Column(name="EINSATZNR")
private Long id;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LFDSERVICENR")
private Service service;
}
@Entity
@Table(name="RESBELEGUNG")
public class ResourceReservation implements Serializable {
private static final long serialVersionUID = -7434828090715354721L;
@Id
private ResourceReservationPK pk;
}
@Embeddable
public class ResourceReservationPK implements Serializable {
private static final long serialVersionUID = -6822968368044282709L;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LFDRESNR")
private Resource resource;
@Column(name="AUFKOPFNR")
private Long refNo1;
}
@Entity
@Table(name="RESSOURCE")
public class Resource implements Serializable {
private static final long serialVersionUID = -4063075607856411271L;
@Id
@Column(name="LFDNR")
private Long id;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="LFDMITARBNR")
private Employee employee;
}
@Entity
@Table( name = "MITARBEITER" )
public class Employee extends DefaultBusinessData implements Serializable {
private static final long serialVersionUID = -5362260719432683301L;
@Id
@Column( name = "mitarbnr" )
private Long id;
}
When executing, I get the following error:
Code:
17:38:11,849 ERROR [STDERR] com.godesys.system.exception.GodesysException: org.hibernate.MappingException: Unknown entity: null
17:38:11,865 ERROR [STDERR] at com.godesys.business.service.ejb.ServiceMgntBean.getServiceAssignmentsBySearchData(ServiceMgntBean.java:310)
17:38:11,865 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:38:11,865 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
17:38:11,865 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
17:38:11,865 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
17:38:11,865 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
17:38:11,865 ERROR [STDERR] at $Proxy2614.getServiceAssignmentsBySearchData(Unknown Source)
17:38:11,865 ERROR [STDERR] at com.godesys.service.confirmation.web.AssignmentSearchBean.onSearch(AssignmentSearchBean.java:215)
17:38:11,865 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:38:11,865 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
17:38:11,865 ERROR [STDERR] at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
17:38:11,865 ERROR [STDERR] at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
17:38:11,865 ERROR [STDERR] at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
17:38:11,865 ERROR [STDERR] at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
17:38:11,865 ERROR [STDERR] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
17:38:11,865 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:383)
17:38:11,865 ERROR [STDERR] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
17:38:11,865 ERROR [STDERR] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
17:38:11,865 ERROR [STDERR] at com.sun.faces.portlet.LifecycleImpl$InvokeApplicationPhase.execute(LifecycleImpl.java:667)
17:38:11,865 ERROR [STDERR] at com.sun.faces.portlet.LifecycleImpl.phase(LifecycleImpl.java:330)
17:38:11,865 ERROR [STDERR] at com.sun.faces.portlet.LifecycleImpl.execute(LifecycleImpl.java:246)
17:38:11,865 ERROR [STDERR] at com.godesys.web.portal.GodesysGenericPortlet.processAction(GodesysGenericPortlet.java:94)
17:38:11,865 ERROR [STDERR] at org.apache.portals.bridges.portletfilter.PortletFilterChain.processActionFilter(PortletFilterChain.java:150)
17:38:11,865 ERROR [STDERR] at jp.sf.pal.tomahawk.filter.ExtensionsPortletFilter.processActionFilter(ExtensionsPortletFilter.java:254)
17:38:11,865 ERROR [STDERR] at org.apache.portals.bridges.portletfilter.PortletFilterChain.processActionFilter(PortletFilterChain.java:143)
17:38:11,865 ERROR [STDERR] at org.apache.portals.bridges.portletfilter.FilterPortlet.processAction(FilterPortlet.java:132)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:101)
17:38:11,865 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
17:38:11,865 ERROR [STDERR] at com.liferay.portlet.CachePortlet._invoke(CachePortlet.java:359)
17:38:11,865 ERROR [STDERR] at com.liferay.portlet.CachePortlet.processAction(CachePortlet.java:181)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.action.LayoutAction.processPortletRequest(LayoutAction.java:385)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.action.LayoutAction.processActionRequest(LayoutAction.java:301)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:143)
17:38:11,865 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
17:38:11,865 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:157)
17:38:11,865 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
17:38:11,865 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
17:38:11,865 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:293)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:528)
17:38:11,865 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
17:38:11,865 ERROR [STDERR] at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
17:38:11,865 ERROR [STDERR] at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:134)
17:38:11,865 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.filters.strip.StripFilter.doFilter(StripFilter.java:92)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.filters.secure.SecureFilter.doFilter(SecureFilter.java:144)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.filters.doubleclick.DoubleClickFilter.doFilter(DoubleClickFilter.java:135)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.portal.servlet.filters.layoutcache.LayoutCacheFilter.doFilter(LayoutCacheFilter.java:188)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.doFilter(AutoLoginFilter.java:117)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:166)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at com.liferay.portal.servlet.filters.sessionid.SessionIdFilter.doFilter(SessionIdFilter.java:85)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
17:38:11,880 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
17:38:11,880 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:38:11,880 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:420)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:38:11,880 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
17:38:11,880 ERROR [STDERR] at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:856)
17:38:11,880 ERROR [STDERR] at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:566)
17:38:11,880 ERROR [STDERR] at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
17:38:11,880 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
17:38:11,880 ERROR [STDERR] Caused by: org.hibernate.MappingException: Unknown entity: null
17:38:11,880 ERROR [STDERR] at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getPropertyMapping(CriteriaQueryTranslator.java:518)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getType(CriteriaQueryTranslator.java:477)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getTypeUsingProjection(CriteriaQueryTranslator.java:459)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getTypedValue(CriteriaQueryTranslator.java:509)
17:38:11,880 ERROR [STDERR] at org.hibernate.criterion.SimpleExpression.getTypedValues(SimpleExpression.java:71)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getQueryParameters(CriteriaQueryTranslator.java:251)
17:38:11,880 ERROR [STDERR] at org.hibernate.criterion.SubqueryExpression.toSqlString(SubqueryExpression.java:55)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:334)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82)
17:38:11,880 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:67)
17:38:11,880 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
17:38:11,880 ERROR [STDERR] at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
Thanks,
barthi