Beginner |
|
Joined: Thu Aug 19, 2004 5:20 am Posts: 25
|
Hi Im getting a persistor error as below:
I have read other erros similar to this and they keep saying you must check the config file to mael sure your mapping file is included, how can this be with Bag? does it maybe have something to do with the one to many relationship of DEPFILESIN to DDETAILS? and then setting the bidrectional relationship between the two?
Hibernate version:2.1.6
Mapping documents: <!--DTRNS MAPPING--> <hibernate-mapping> <class name="DTrns" table="d_trns" dynamic-update="true"> <id name="trnID" column="trn_id" type ="java.lang.Long" unsaved-value="null"> <generator class="native" /> </id> <property name="workGroupBranchID" column="wkgrp_brch_id" not-null="true"/> <property name="workGroupUserID" column="wkgrp_usr_id" not-null="false"/> <property name="clientBranchID" column="client_brch_id" not-null="true"/> <property name="clientUserID" column="client_usr_id" not-null="false"/> <property name="suiteTID" column="suitet_id" not-null="true"/> <property name="xmlMatterData" column="xml_matter_data" not-null="false"/> <property name="uniqueRef" column="unique_ref" not-null="false"/> <property name="workGroupRef" column="wkgrp_ref" not-null="false"/> <property name="messageID" column="message_id" not-null="true"/> <property name="firstDate" column="firstdate" not-null="false"/> <property name="status" column="status" not-null="true"/> <property name="altBranchID" column="alt_brch_id" not-null="false"/> <property name="vendorCode" column="vendor_code" not-null="false"/> <property name="filesInID" column="filesin_id" not-null="false"/> <property name="actionDate" column="action_date" not-null="false"/>
<bag name="dDetails" inverse="true" lazy="true" cascade="all"> <key column="trn_id"/> <one-to-many class="DDetails"/> </bag> </class> </hibernate-mapping>
<!--DDETAILS--> <hibernate-mapping> <class name="DDetails" table="d_details"> <id name="id" column="id" type ="java.lang.Long" unsaved-value="null"> <generator class="native" /> </id>
<property name="trnID" column="trn_id" not-null="true"/> <property name="uniqueRef" column="unique_ref" not-null="false"/> <property name="suiteTID" column="suitet_id" not-null="true"/> <property name="messageID" column="message_id" not-null="true"/> <property name="clientBranchID" column="client_brch_id" not-null="true"/> <property name="clientUserID" column="client_user" not-null="false"/> <property name="workGroupBranchID" column="wkgrp_brch_id" not-null="true"/> <property name="workGroupUserID" column="wkgrp_user" not-null="true"/> <property name="date" column="date" not-null="false"/> <property name="time" column="time" not-null="false"/> <property name="actionDate" column="action_date" not-null="false"/> <property name="value" column="value" not-null="false"/> <property name="transDate" column="trans_date" not-null="false"/> <property name="filesInID" column="filesin_id" not-null="false"/> <property name="status" column="status" not-null="false"/> <many-to-one name="dEpFilesIn" class="DEpFilesIn" column="filesin_id" not-null="true" cascade="all"/> </class> </hibernate-mapping>
<!--DEPFILESIN--> <hibernate-mapping> <class name="DEpFilesIn" table="d_epfilesin"> <id name="id" column="id" type ="java.lang.Long" unsaved-value="any"> <generator class="native" /> </id> <property name="fromId" column="from_id" not-null="true"/> <property name="filename" column="filename" not-null="true"/> <property name="messengerREF" column="messenger_ref" not-null="false"/> <property name="expiry" column="expiry" not-null="false"/> <property name="processed" column="processed" not-null="true"/> <property name="subject" column="subject" not-null="false"/> <property name="fromEmail" column="from_email" not-null="false"/> <property name="date" column="date" not-null="false"/> <property name="time" column="time" not-null="false"/> <property name="encrypted" column="encrypted" not-null="false"/> <property name="actionDate" column="action_date" not-null="false"/> <property name="filesId" column="files_id" not-null="false"/> <!-- The Correct Mapping --> <bag name="dDetails" inverse="true" lazy="true" cascade="all"> <key column="filesin_id"/> <one-to-many class="DDetails"/> </bag> </class> </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
DTrns dtransObj = (DTrns)normalSession.load(DTrns.class,new Long(2290154)); System.out.println("DTRNS TRN ID " + dtransObj.getTrnID()); System.out.println(""); //Does DDetails List list = dtransObj.getdDetails(); if(list.size()>0) { Iterator it = list.iterator(); while(it.hasNext()) { DDetails dDetailsObj = (DDetails)it.next();
//Does D_EPFilesIn /*SETS BIDIRECTIONAL ASSOCIATION*/ DEpFilesIn dEpFilesInObj = dDetailsObj.getdEpFilesIn(); dEpFilesInObj.getdDetails().add(list); System.out.println("DEPFILESIN NULL CHECK " + dEpFilesInObj.getId());
} } System.out.println("");
myMachineSession.saveOrUpdate(dtransObj); myMachineSession.flush(); myMachineTX.commit();
Full stack trace of any exception that occurs: net.sf.hibernate.MappingException: No persister for: net.sf.hibernate.collection.Bag at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:426) at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2248) at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2255) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1180) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:77) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:234) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:268) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:302) at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:741) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:607) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1187) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:77) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:234) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:302) at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1285) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1191) at net.sf.hibernate.engine.Cascades$4.cascade(Cascades.java:77) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:234) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:268) at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:302) at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1285) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1191) at XMLTest.getQuery(XMLTest.java:183) at XMLTest.main(XMLTest.java:278) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Name and version of the database you are using:
Debug level Hibernate log excerpt:
|
|