Okay, first let me apologize for such a basic question.....
What I have done is created a MYSQL database. I have used MyEclipse to reverse engineer the source code for Hibernate and Spring (DAOs). I pass the Spring errors and now I am unable to get pass the Hibernate errors.
Hibernate version: 3.1
Mapping documents:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="jtdi.metadata.orm.JtdiDocument" table="jtdi_document" catalog="jtdi_metadata_db">
<id name="jtdiDocumentId" type="java.lang.Integer">
<column name="jtdi_document_id" />
<generator class="guid" />
</id>
<property name="storagePath" type="java.lang.String">
<column name="storage_path" length="256" />
</property>
<property name="storageHostName" type="java.lang.String">
<column name="storage_host_name" length="50" />
</property>
<property name="docFileSize" type="java.lang.Long">
<column name="doc_file_size" />
</property>
<property name="docFileName" type="java.lang.String">
<column name="doc_file_name" length="50" />
</property>
<property name="docDescription" type="java.lang.String">
<column name="doc_description" length="65535" />
</property>
<property name="docType" type="java.lang.String">
<column name="doc_type" length="50" />
</property>
<property name="docCreationDate" type="java.util.Date">
<column name="doc_creation_date" length="0" />
</property>
<property name="docUpdateDate" type="java.util.Date">
<column name="doc_update_date" length="0" />
</property>
<property name="docTitle" type="java.lang.String">
<column name="doc_title" length="256" />
</property>
<property name="docExpirationDate" type="java.util.Date">
<column name="doc_expiration_date" length="0" />
</property>
<property name="docOsDate" type="java.util.Date">
<column name="doc_os_date" length="0" />
</property>
<set name="operationMaintenances" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.OperationMaintenance" />
</set>
<set name="engrDrawings" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.EngrDrawing" />
</set>
<set name="metadataDocuments" inverse="true">
<key><column name="fk_jtdi_document_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.MetadataDocument" />
</set>
<set name="technicalDirectiveBulletins" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.TechnicalDirectiveBulletin" />
</set>
<set name="supplySupports" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.SupplySupport" />
</set>
<set name="techDirectiveChanges" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.TechDirectiveChange" />
</set>
<set name="techManuals" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.TechManual" />
</set>
<set name="distribStmts" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.DistribStmt" />
</set>
<set name="safetyMessages" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.SafetyMessage" />
</set>
<set name="programMngDocuments" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.ProgramMngDocument" />
</set>
<set name="iracs" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.Irac" />
</set>
<set name="trainings" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.Training" />
</set>
<set name="instructions" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.Instruction" />
</set>
<set name="techPubDeficiencyRpts" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.TechPubDeficiencyRpt" />
</set>
<set name="configManagements" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.ConfigManagement" />
</set>
<set name="hazardousMaterials" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.HazardousMaterial" />
</set>
<set name="securityClassifications" inverse="true">
<key><column name="fk_jtdi_doc_id" not-null="true" /></key>
<one-to-many class="jtdi.metadata.orm.SecurityClassification" />
</set>
</class>
</hibernate-mapping>
Full stack trace of any exception that occurs:
[code]
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: reassociated object has dirty collection reference (or an array); nested exception is org.hibernate.HibernateException: reassociated object has dirty collection reference (or an array)
Caused by: org.hibernate.HibernateException: reassociated object has dirty collection reference (or an array)
at org.hibernate.event.def.OnLockVisitor.processCollection(OnLockVisitor.java:66)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:123)
at org.hibernate.event.def.AbstractReassociateEventListener.reassociate(AbstractReassociateEventListener.java:78)
at org.hibernate.event.def.DefaultLockEventListener.onLock(DefaultLockEventListener.java:59)
at org.hibernate.impl.SessionImpl.fireLock(SessionImpl.java:579)
at org.hibernate.impl.SessionImpl.lock(SessionImpl.java:571)
at org.springframework.orm.hibernate3.HibernateTemplate$10.doInHibernate(HibernateTemplate.java:614)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
at org.springframework.orm.hibernate3.HibernateTemplate.lock(HibernateTemplate.java:612)
at jtdi.metadata.orm.dao.JtdiDocumentDAO.attachClean(JtdiDocumentDAO.java:169)
at jtdi.metadata.persistence.bean.JtdiDocumentBean.addJtdiDocument(JtdiDocumentBean.java:19)
at jtdi.metadata.business.helper.JtdiDocumentBusinessHelper.persistJtdiDocument(JtdiDocumentBusinessHelper.java:59)
at jtdi.metadata.business.helper.JtdiDocumentBusinessHelper.main(JtdiDocumentBusinessHelper.java:114)
[/cde]
Name and version of the database you are using: MySQL 5.0
Here is code from Hibernate's OnLockVisitor
[code]
if ( collection == null ) {
//do nothing
}
else if ( collection instanceof PersistentCollection ) {
....... // Do something
}
else {
* // brand new collection
//TODO: or an array!! we can't lock objects with arrays
now??
throw new HibernateException( "reassociated object has
dirty collection reference (or an array)" );* }
[/code]
As you can see for yourself this situation occurs if your collection is not
PersistentCollection (i.e. if you have replaced collection completely after
obtaining object from DB) or is you use array (not very likely).
Thank you for taking the time to read my post and for any suggetions you can offer.
Russ