We have a problem while using createCriteria or createAlias on the primary key of an object.
We want to add an expression on a property of an object contained in the PK object.
Can someone please help?
:(
Hibernate version:2.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="com.ashland.vioc.mmt.dto.StoreParameterValueDTO"
table="StoreParameterValue"
>
<meta attribute="field-description">
@hibernate.class
table="StoreParameterValue"
</meta>
<meta attribute="extends">com.ashland.vioc.core.data.BaseDTO</meta>
<composite-id name="StoreParameterValuePK" class="com.ashland.vioc.mmt.dto.StoreParameterValuePK">
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
</meta>
<!-- bi-directional many-to-one association to StoreDTO -->
<key-many-to-one
name="store"
class="com.ashland.vioc.mmt.dto.StoreDTO"
>
<column name="storeResourceId" />
</key-many-to-one>
<!-- bi-directional many-to-one association to SystemParameterDTO -->
<key-many-to-one
name="systemParameter"
class="com.ashland.vioc.mmt.dto.SystemParameterDTO"
>
<column name="paramName" />
</key-many-to-one>
</composite-id>
<version column="verNum" name="verNum" type="integer" unsaved-value="null" />
<property
name="paramValue"
type="java.lang.String"
column="paramValue"
not-null="true"
length="120"
>
<meta attribute="field-description">
@hibernate.property
column="paramValue"
length="120"
not-null="true"
</meta>
</property>
<property
name="lastUpdBy"
type="java.lang.String"
column="lastUpdBy"
not-null="true"
length="15"
>
<meta attribute="field-description">
@hibernate.property
column="lastUpdBy"
length="15"
not-null="true"
</meta>
</property>
<!-- associations -->
</class>
<query name="GetStoreParametersList.select">from StoreParameterValueDTO sp where sp.StoreParameterValuePK.store.storeResourceId = ? and UPPER(sp.StoreParameterValuePK.systemParameter.paramName) like UPPER(?) and UPPER(sp.StoreParameterValuePK.systemParameter.paramDesc) like UPPER(?) order by sp.StoreParameterValuePK.systemParameter.paramName</query>
</hibernate-mapping>
[/b]
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
<Jun 30, 2005 6:55:46 PM IST> <Error> <com.ashland.vioc.core.exceptionhandler.FileExceptionHandler> <000000> <TYPE{{E}} COMPONENT{{com.ashland.vioc.core.exceptionhandler.FileExceptionHandler}} USER{{User10}} MESSAGE{{ERRORID :ViocDataException
USERID : User10
EXCEPTION MESSAGE :Message : Exception came while using hibenrate
Exception Stack Trace
com.ashland.vioc.core.exceptions.ViocDataException: Exception came while using hibenrate
at com.ashland.vioc.core.exceptionhandler.ExceptionHelper.throwDataException(ExceptionHelper.java:246)
at com.ashland.vioc.mmt.dao.SystemParameterDAO.searchStoreParameter(SystemParameterDAO.java:337)
at com.ashland.vioc.mmt.dm.SystemParameterDMBean.searchStoreSysParam(SystemParameterDMBean.java:191)
at com.ashland.vioc.mmt.dm.SystemParameterDM_19ybww_ELOImpl.searchStoreSysParam(SystemParameterDM_19ybww_ELOImpl.java:616)
at com.ashland.vioc.mmt.ff.SystemParameterFF.searchStoreSysParam(SystemParameterFF.java:171)
at com.ashland.vioc.mmt.action.SystemParameterAction.searchStoreSysParam(SystemParameterAction.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at com.ashland.util.struts.ButtonNameDispatchAction.execute(Unknown Source)
at com.ashland.vioc.mmt.action.SystemParameterAction.execute(SystemParameterAction.java:286)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.ashland.navigation.SessionCleanupFilter.doFilter(SessionCleanupFilter.java:155)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: net.sf.hibernate.QueryException: not an association path: storeParameterValuePK
at net.sf.hibernate.impl.CriteriaImpl.getClassForPath(CriteriaImpl.java:327)
at net.sf.hibernate.impl.CriteriaImpl.createAlias(CriteriaImpl.java:285)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:363)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:353)
at net.sf.hibernate.impl.CriteriaImpl.createCriteria(CriteriaImpl.java:349)
at com.ashland.vioc.mmt.dao.SystemParameterDAO.searchStoreParameter(SystemParameterDAO.java:303)
... 30 more
Root Exception Stack Trace : net.sf.hibernate.QueryException: not an association path: storeParameterValuePK
net.sf.hibernate.QueryException: not an association path: storeParameterValuePK
at net.sf.hibernate.impl.CriteriaImpl.getClassForPath(CriteriaImpl.java:327)
at net.sf.hibernate.impl.CriteriaImpl.createAlias(CriteriaImpl.java:285)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:363)
at net.sf.hibernate.impl.CriteriaImpl.createCriteriaAt(CriteriaImpl.java:353)
at net.sf.hibernate.impl.CriteriaImpl.createCriteria(CriteriaImpl.java:349)
at com.ashland.vioc.mmt.dao.SystemParameterDAO.searchStoreParameter(SystemParameterDAO.java:303)
at com.ashland.vioc.mmt.dm.SystemParameterDMBean.searchStoreSysParam(SystemParameterDMBean.java:191)
at com.ashland.vioc.mmt.dm.SystemParameterDM_19ybww_ELOImpl.searchStoreSysParam(SystemParameterDM_19ybww_ELOImpl.java:616)
at com.ashland.vioc.mmt.ff.SystemParameterFF.searchStoreSysParam(SystemParameterFF.java:171)
at com.ashland.vioc.mmt.action.SystemParameterAction.searchStoreSysParam(SystemParameterAction.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at com.ashland.util.struts.ButtonNameDispatchAction.execute(Unknown Source)
at com.ashland.vioc.mmt.action.SystemParameterAction.execute(SystemParameterAction.java:286)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.ashland.navigation.SessionCleanupFilter.doFilter(SessionCleanupFilter.java:155)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6458)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: