Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2
Mapping documents:
Code:
<hibernate-mapping default-cascade="none">
<class name="my.com.calyx.creditFile.pObj.LegalIdTypeImpl" table="LEGALIDTYPE" dynamic-insert="false" dynamic-update="false">
<id name="uid" type="java.lang.String" unsaved-value="null">
<column name="UID" sql-type="VARCHAR(32)"/>
<generator class="uuid.hex">
</generator>
</id>
<property name="name" type="java.lang.String">
<column name="NAME" not-null="true" unique="false" sql-type="VARCHAR(30)"/>
</property>
<property name="description" type="java.lang.String">
<column name="DESCRIPTION" not-null="false" unique="false" sql-type="VARCHAR(80)"/>
</property>
<property name="seq" type="java.lang.Integer">
<column name="SEQ" not-null="false" unique="false" sql-type="INTEGER"/>
</property>
<many-to-one name="partyType" class="my.com.calyx.creditFile.pObj.PartyTypeImpl" outer-join="auto" foreign-key="LEGALIDTYPE_PARTY_TYPE_FKC">
<column name="PARTY_TYPE_FK" not-null="false" sql-type="VARCHAR(32)"/>
</many-to-one>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Code:
public static java.util.List findByName(net.sf.hibernate.Session session, java.lang.String name)
throws net.sf.hibernate.HibernateException
{
net.sf.hibernate.Query query = session.createQuery("from LegalIdTypeImpl l where l.name = ?");
query.setParameter(0, name);
return query.list();
}
Full stack trace of any exception that occurs:Hibernate: select sponsorimp0_.UID as UID, sponsorimp0_.class as class, sponsorimp0_.REMARK as REMARK, sponsorimp0_.SP_SOURCE_DATE as SP_SOURC4_, sponsorimp0_.LIST_DATE as LIST_DATE, sponsorimp0_.ETR_SPONSOR_ID as ETR_SPON6_, sponsorimp0_.ETRED as ETRED, sponsorimp0_.CHANGED as CHANGED, sponsorimp0_.INT_LISTED as INT_LISTED, sponsorimp0_.MONITORED as MONITORED, sponsorimp0_.ETR_NOTIFICATION as ETR_NOT11_, sponsorimp0_.MODIFY_DATE as MODIFY_12_, sponsorimp0_.MODIFY_BY as MODIFY_BY, sponsorimp0_.SPONSOR_TYPE_FK as SPONSOR14_, sponsorimp0_.SPONSOR_SOURCE_FK as SPONSOR15_, sponsorimp0_.ACCOUNT_FK as ACCOUNT_FK, sponsorimp0_.INTERNAL_LIST_FK as INTERNA17_, sponsorimp0_.CUSTOMER_ORG_FK as CUSTOME18_, sponsorimp0_.IC_NO as IC_NO, sponsorimp0_.NEW_IC as NEW_IC, sponsorimp0_.PASSPORT_NO as PASSPOR21_, sponsorimp0_.INDIVIDUAL_FK as INDIVID22_, sponsorimp0_.COMPANY_NO as COMPANY_NO, sponsorimp0_.ORGANISATION_FK as ORGANIS24_, sponsorimp0_.BUS_REG_NO as BUS_REG_NO from SPONSOR sponsorimp0_, CUSTORG customeror1_ where (sponsorimp0_.CUSTOMER_ORG_FK like ? )and(customeror1_.USER_ORG_FK like ? and sponsorimp0_.CUSTOMER_ORG_FK=customeror1_.CUSTORGUID)
Hibernate: select individual0_.UID as UID3_, individual0_.POSITION_FK as POSITIO11_3_, individual0_.SOLUTATION_FK as SOLUTAT12_3_, individual0_.ACTIVE as ACTIVE3_, individual0_.EXPIRY_DATE as EXPIRY_D4_3_, individual0_.NAME as NAME3_, individual0_.CREATE_DATE as CREATE_D6_3_, individual0_.CREATE_BY as CREATE_BY3_, individual0_.MODIFY_DATE as MODIFY_D8_3_, individual0_.MODIFY_BY as MODIFY_BY3_, individual0_.PARTY_TYPE_FK as PARTY_T10_3_, positionim1_.UID as UID0_, positionim1_.NAME as NAME0_, positionim1_.DESCRIPTION as DESCRIPT3_0_, positionim1_.SEQ as SEQ0_, solutation2_.UID as UID1_, solutation2_.SOLUTATION as SOLUTATION1_, solutation2_.DESCRIPTION as DESCRIPT3_1_, solutation2_.SEQ as SEQ1_, partytypei3_.UID as UID2_, partytypei3_.NAME as NAME2_, partytypei3_.DESCRIPTION as DESCRIPT3_2_, partytypei3_.CODE as CODE2_, partytypei3_.SEQ as SEQ2_ from PARTY individual0_ left outer join POSITION positionim1_ on individual0_.POSITION_FK=positionim1_.UID left outer join SOLUTATION solutation2_ on individual0_.SOLUTATION_FK=solutation2_.UID left outer join PARTYTYPE partytypei3_ on individual0_.PARTY_TYPE_FK=partytypei3_.UID where individual0_.UID=?
Hibernate: select sponsortyp0_.UID as UID0_, sponsortyp0_.NAME as NAME0_, sponsortyp0_.DESCRIPTION as DESCRIPT3_0_, sponsortyp0_.SEQ as SEQ0_ from SPONSOR_TYPE sponsortyp0_ where sponsortyp0_.UID=?
Hibernate: select sponsorsou0_.UID as UID0_, sponsorsou0_.NAME as NAME0_, sponsorsou0_.DESCRIPTION as DESCRIPT3_0_ from SPONSOR_SOURCE sponsorsou0_ where sponsorsou0_.UID=?
Hibernate: select legalidimp0_.UID as UID, legalidimp0_.LEGAL_NO as LEGAL_NO, legalidimp0_.LEGAL_ID_TYPE_FK as LEGAL_ID3_, legalidimp0_.PARTY_FK as PARTY_FK from LEGALID legalidimp0_ where (legalidimp0_.PARTY_FK=? )
Hibernate: select legalidtyp0_.UID as UID1_, legalidtyp0_.NAME as NAME1_, legalidtyp0_.DESCRIPTION as DESCRIPT3_1_, legalidtyp0_.SEQ as SEQ1_, legalidtyp0_.PARTY_TYPE_FK as PARTY_TY5_1_, partytypei1_.UID as UID0_, partytypei1_.NAME as NAME0_, partytypei1_.DESCRIPTION as DESCRIPT3_0_, partytypei1_.CODE as CODE0_, partytypei1_.SEQ as SEQ0_ from LEGALIDTYPE legalidtyp0_ left outer join PARTYTYPE partytypei1_ on legalidtyp0_.PARTY_TYPE_FK=partytypei1_.UID where legalidtyp0_.UID=?
Hibernate: select partytypei0_.UID as UID, partytypei0_.NAME as NAME, partytypei0_.DESCRIPTION as DESCRIPT3_, partytypei0_.CODE as CODE, partytypei0_.SEQ as SEQ from PARTYTYPE partytypei0_ where (partytypei0_.CODE=? )
Hibernate: select sponsorsou0_.UID as UID, sponsorsou0_.NAME as NAME, sponsorsou0_.DESCRIPTION as DESCRIPT3_ from SPONSOR_SOURCE sponsorsou0_ where (sponsorsou0_.NAME=? )
java.lang.ClassCastException: java.util.ArrayList
at net.sf.hibernate.type.SetType.wrap(SetType.java:24)
at net.sf.hibernate.impl.WrapVisitor.processArrayOrNewCollection(WrapVisitor.java:78)
at net.sf.hibernate.impl.WrapVisitor.processCollection(WrapVisitor.java:49)
at net.sf.hibernate.impl.AbstractVisitor.processValue(AbstractVisitor.java:69)
at net.sf.hibernate.impl.WrapVisitor.processValues(WrapVisitor.java:93)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2492)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2458)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2260)
at net.sf.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1805)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1568)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at my.com.calyx.creditFile.pObj.LegalIdTypeFactory.findByName(LegalIdTypeFactory.java:101)
at my.com.calyx.creditFile.dao.SponsorManager.addSponsor(SponsorManager.java:359)
at my.com.calyx.creditFile.action.SponsorAction.add(SponsorAction.java:146)
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:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:252)
at my.com.calyx.creditFile.action.BaseAction.execute(BaseAction.java:54)
at my.com.calyx.creditFile.action.SponsorAction.execute(SponsorAction.java:55)
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:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at my.com.calyx.creditFile.bo.AccessFilter.doFilter(AccessFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Name and version of the database you are using:mysql4
I'm getting this problem.. i run the debugger and step through it. The debugger stops at
Code:
return query.list();
and then jumps to the catch block. Been looking through forms and etc but found nothing much hepful.
Read this:
http://hibernate.org/42.html