hello,
I have a table:
CREATE TABLE OPERMENU
(
PROJECTNAME VARCHAR2(20) NOT NULL,
SEQNO NUMBER(5) NOT NULL,
PARENTSEQNO NUMBER(5) NOT NULL,
GROUPSEQNO NUMBER(5),
LABEL VARCHAR2(50),
DESCRIPTION VARCHAR2(500),
ACTION VARCHAR2(500),
DISPLAYPROFILE VARCHAR2(500),
PROCESS_DATE DATE,
PROCESS_TERMINAL VARCHAR2(50),
PROCESS_USER VARCHAR2(15)
)
ALTER TABLE OPERMENU ADD (
CONSTRAINT PK_OPERMENU PRIMARY KEY (PROJECTNAME, SEQNO)
and mapping file.
hibernate-mapping schema="XYZ" package="entities" default-lazy="false">
<class name="Opermenu" lazy="false" table="OPERMENU" schema="PCPM">
<composite-id name="compositeId" class="entities.Opermenu$OpermenuCompositeId" unsaved-value="any">
<key-property name="projectname" type="string">
<column name="PROJECTNAME" length="20" not-null="true" index="PK_OPERMENU"/>
</key-property>
<key-property name="seqno" type="big_decimal">
<column name="SEQNO" not-null="true"/>
</key-property>
</composite-id>
<property name="parentseqno" type="big_decimal">
<column name="PARENTSEQNO" not-null="true"/>
</property>
<property name="groupseqno" type="big_decimal" column="GROUPSEQNO"/>
<property name="label" type="string">
<column name="LABEL" length="50"/>
</property>
<property name="description" type="string">
<column name="DESCRIPTION" length="500"/>
</property>
<property name="action" type="string">
<column name="ACTION" length="500"/>
</property>
<property name="displayprofile" type="string">
<column name="DISPLAYPROFILE" length="500"/>
</property>
<property name="processDate" type="date" column="PROCESS_DATE"/>
<property name="processTerminal" type="string">
<column name="PROCESS_TERMINAL" length="50"/>
</property>
<property name="processUser" type="string">
<column name="PROCESS_USER" length="15"/>
</property>
</class>
</hibernate-mapping>
When I execute:
Criteria crt = session.createCriteria(Opermenu.class);
java.util.List list = crt.list();
I get an error:
java.lang.ClassCastException
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:759)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:292)
at org.hibernate.loader.Loader.doQuery(Loader.java:412)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:111)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1322)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:300)
at manager.OperManager.getOperMenus(OperManager.java:25)
at actions.operMenuAction.execute(operMenuAction.java:28)
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:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
How can handle this error
|