Hibernate version:
3.2
Mapping documents:
<?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">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="us.fl.ci.tlh.mobile.aspen.data.Samples" table="SAMPLES" schema="ASPEN">
<id name="limsNumber" type="java.lang.Long">
<column name="LIMS#" precision="11" scale="0" />
<generator class="native">
<param name="sequence">SEQ_SAMPLES</param>
</generator>
</id>
<property name="labNumber" type="java.lang.String">
<column name="LAB#" length="20" />
</property>
<property name="refid" type="java.lang.String">
<column name="REFID" length="25" />
</property>
<property name="sampleid" type="java.lang.String">
<column name="SAMPLEID" length="40" />
</property>
<property name="clientid" type="java.lang.String">
<column name="CLIENTID" length="25" />
</property>
<property name="mfgid" type="java.lang.String">
<column name="MFGID" length="12" />
</property>
<property name="logdate" type="java.util.Date">
<column name="LOGDATE" length="7" />
</property>
<property name="logtime" type="java.util.Date">
<column name="LOGTIME" length="7" />
</property>
<property name="logby" type="java.lang.String">
<column name="LOGBY" length="20" />
</property>
<property name="sampletype" type="java.lang.String">
<column name="SAMPLETYPE" length="15" />
</property>
<property name="source" type="java.lang.String">
<column name="SOURCE" length="40" />
</property>
<property name="reportdate" type="java.util.Date">
<column name="REPORTDATE" length="7" />
</property>
<property name="sampleobject" type="java.lang.String">
<column name="SAMPLEOBJECT" />
</property>
<property name="readytoreport" type="java.lang.Long">
<column name="READYTOREPORT" precision="1" scale="0" not-null="true" />
</property>
<property name="selectedforreporting" type="java.lang.String">
<column name="SELECTEDFORREPORTING" length="20" />
</property>
<property name="readytoarchive" type="java.lang.Long">
<column name="READYTOARCHIVE" precision="1" scale="0" not-null="true" />
</property>
<property name="selectedforarchive" type="java.lang.Long">
<column name="SELECTEDFORARCHIVE" precision="1" scale="0" not-null="true" />
</property>
<property name="datesamplecompleted" type="java.util.Date">
<column name="DATESAMPLECOMPLETED" length="7" />
</property>
<property name="datearchived" type="java.util.Date">
<column name="DATEARCHIVED" length="7" />
</property>
<property name="groupscount" type="java.lang.Long">
<column name="GROUPSCOUNT" precision="5" scale="0" />
</property>
<property name="groupsdone" type="java.lang.Long">
<column name="GROUPSDONE" precision="5" scale="0" />
</property>
<property name="selectedForWorksheet" type="java.lang.String">
<column name="SELECTED_FOR_WORKSHEET" length="20" />
</property>
<property name="loginreporting" type="java.lang.String">
<column name="LOGINREPORTING" length="20" />
</property>
<property name="note" type="java.lang.String">
<column name="NOTE" length="2000" not-null="true" />
</property>
<property name="projectNumber" type="java.lang.String">
<column name="PROJECT#" length="15" />
</property>
<property name="clientProjectNumber" type="java.lang.String">
<column name="CLIENT_PROJECT#" length="15" />
</property>
<property name="turnaround" type="java.lang.Long">
<column name="TURNAROUND" precision="5" scale="0" />
</property>
<property name="dueDate" type="java.util.Date">
<column name="DUE_DATE" length="7" />
</property>
<property name="collectDate" type="java.util.Date">
<column name="COLLECT_DATE" length="7" />
</property>
<property name="collectTime" type="java.util.Date">
<column name="COLLECT_TIME" length="7" />
</property>
<property name="collectBy" type="java.lang.String">
<column name="COLLECT_BY" length="20" />
</property>
<property name="storageLocation" type="java.lang.String">
<column name="STORAGE_LOCATION" length="20" />
</property>
<property name="receivedDate" type="java.util.Date">
<column name="RECEIVED_DATE" length="7" />
</property>
<property name="receivedTime" type="java.util.Date">
<column name="RECEIVED_TIME" length="7" />
</property>
<property name="receivedBy" type="java.lang.String">
<column name="RECEIVED_BY" length="20" />
</property>
<property name="qc" type="java.lang.String">
<column name="QC" length="20" />
</property>
<property name="samplefee" type="java.lang.Double">
<column name="SAMPLEFEE" precision="15" />
</property>
<property name="otherfee" type="java.lang.Double">
<column name="OTHERFEE" precision="15" />
</property>
<property name="totalcost" type="java.lang.Double">
<column name="TOTALCOST" precision="15" />
</property>
<property name="batchNumber" type="java.lang.String">
<column name="BATCH_NUMBER" length="16" />
</property>
<property name="sampleNumber" type="java.lang.Long">
<column name="SAMPLE_NUMBER" precision="5" scale="0" />
</property>
<property name="discount" type="java.lang.Double">
<column name="DISCOUNT" precision="12" />
</property>
<property name="rushSurcharge" type="java.lang.Double">
<column name="RUSH_SURCHARGE" precision="12" />
</property>
<property name="containerTypes" type="java.lang.String">
<column name="CONTAINER_TYPES" length="40" />
</property>
<property name="wsNumber" type="java.lang.String">
<column name="WS#" length="50" />
</property>
<property name="wsm" type="java.lang.String">
<column name="WSM" length="50" />
</property>
<property name="invoicedate" type="java.util.Date">
<column name="INVOICEDATE" length="7" />
</property>
<property name="readytoinvoice" type="java.lang.Long">
<column name="READYTOINVOICE" precision="1" scale="0" not-null="true" />
</property>
<property name="selectedforinvoicing" type="java.lang.String">
<column name="SELECTEDFORINVOICING" length="20" />
</property>
<property name="businessdate" type="java.lang.Long">
<column name="BUSINESSDATE" precision="1" scale="0" not-null="true" />
</property>
<property name="fromschedule" type="java.lang.Long">
<column name="FROMSCHEDULE" precision="1" scale="0" not-null="true" />
</property>
<property name="schedulecounter" type="java.lang.Long">
<column name="SCHEDULECOUNTER" precision="11" scale="0" />
</property>
<property name="samplingdetails" type="java.lang.String">
<column name="SAMPLINGDETAILS" />
</property>
<property name="schedsetid" type="java.lang.String">
<column name="SCHEDSETID" length="100" />
</property>
<property name="received" type="java.lang.Long">
<column name="RECEIVED" precision="1" scale="0" not-null="true" />
</property>
<property name="disposaldate" type="java.util.Date">
<column name="DISPOSALDATE" length="7" />
</property>
<property name="disposedby" type="java.lang.String">
<column name="DISPOSEDBY" length="20" />
</property>
<property name="disposed" type="java.lang.Long">
<column name="DISPOSED" precision="1" scale="0" not-null="true" />
</property>
<property name="readyfordisposal" type="java.lang.Long">
<column name="READYFORDISPOSAL" precision="1" scale="0" not-null="true" />
</property>
<property name="cancelled" type="java.lang.Long">
<column name="CANCELLED" precision="1" scale="0" not-null="true" />
</property>
<property name="misc1" type="java.lang.String">
<column name="MISC1" length="25" />
</property>
<property name="misc2" type="java.lang.String">
<column name="MISC2" length="25" />
</property>
<property name="misc3" type="java.lang.String">
<column name="MISC3" length="25" />
</property>
<property name="misc4" type="java.lang.String">
<column name="MISC4" length="25" />
</property>
<property name="misc5" type="java.lang.String">
<column name="MISC5" length="25" />
</property>
<property name="misc6" type="java.lang.String">
<column name="MISC6" length="25" />
</property>
<property name="misc7" type="java.lang.String">
<column name="MISC7" length="25" />
</property>
<property name="misc8" type="java.lang.String">
<column name="MISC8" length="25" />
</property>
<property name="selectfordisposal" type="java.lang.Long">
<column name="SELECTFORDISPOSAL" precision="1" scale="0" not-null="true" />
</property>
<property name="smisc1" type="java.lang.String">
<column name="SMISC1" length="25" />
</property>
<property name="smisc2" type="java.lang.String">
<column name="SMISC2" length="25" />
</property>
<property name="smisc3" type="java.lang.String">
<column name="SMISC3" length="25" />
</property>
<property name="smisc4" type="java.lang.String">
<column name="SMISC4" length="25" />
</property>
<property name="smisc5" type="java.lang.String">
<column name="SMISC5" length="25" />
</property>
<property name="smisc6" type="java.lang.String">
<column name="SMISC6" length="25" />
</property>
<property name="smisc7" type="java.lang.String">
<column name="SMISC7" length="25" />
</property>
<property name="smisc8" type="java.lang.String">
<column name="SMISC8" length="25" />
</property>
<property name="smisc9" type="java.lang.String">
<column name="SMISC9" length="25" />
</property>
<property name="smisc10" type="java.lang.String">
<column name="SMISC10" length="25" />
</property>
<property name="smisc11" type="java.lang.String">
<column name="SMISC11" length="25" />
</property>
<property name="smisc12" type="java.lang.String">
<column name="SMISC12" length="25" />
</property>
<property name="smisc13" type="java.lang.String">
<column name="SMISC13" length="25" />
</property>
<property name="smisc14" type="java.lang.String">
<column name="SMISC14" length="25" />
</property>
<property name="smisc15" type="java.lang.String">
<column name="SMISC15" length="25" />
</property>
<property name="audittrailRecord" type="java.lang.Long">
<column name="AUDITTRAIL_RECORD" precision="1" scale="0" not-null="true" />
</property>
<property name="collectdateandtime" type="java.util.Date">
<column name="COLLECTDATEANDTIME" length="7" />
</property>
<property name="internalcoc" type="java.lang.Long">
<column name="INTERNALCOC" precision="1" scale="0" not-null="true" />
</property>
<property name="opsfacility" type="java.lang.String">
<column name="OPSFACILITY" length="25" />
</property>
<property name="outofspec" type="java.lang.Long">
<column name="OUTOFSPEC" precision="1" scale="0" not-null="true" />
</property>
<property name="rush" type="java.lang.Long">
<column name="RUSH" precision="1" scale="0" not-null="true" />
</property>
<property name="sampleapproved" type="java.lang.Long">
<column name="SAMPLEAPPROVED" precision="1" scale="0" not-null="true" />
</property>
<property name="sampleapprovedBy" type="java.lang.String">
<column name="SAMPLEAPPROVED_BY" length="20" />
</property>
<property name="sampleapprovedDate" type="java.util.Date">
<column name="SAMPLEAPPROVED_DATE" length="7" />
</property>
<property name="allNelaccontainersOk" type="java.lang.Long">
<column name="ALL_NELACCONTAINERS_OK" precision="1" scale="0" not-null="true" />
</property>
<property name="latitude" type="java.lang.String">
<column name="LATITUDE" length="25" />
</property>
<property name="longitude" type="java.lang.String">
<column name="LONGITUDE" length="25" />
</property>
<property name="locid" type="java.lang.String">
<column name="LOCID" length="12" />
</property>
<set name="submitterses" inverse="true" cascade="persist" >
<key>
<column name="LIMS#" precision="11" scale="0" not-null="true" unique="true" />
</key>
<one-to-many class="us.fl.ci.tlh.mobile.aspen.data.Submitters" />
</set>
</class>
</hibernate-mapping>
<?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">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="us.fl.ci.tlh.mobile.aspen.data.Submitters" table="SUBMITTERS" schema="ASPEN">
<id name="limsNumber" type="java.lang.Long">
<column name="LIMS#" precision="11" scale="0" />
<generator class="assigned"/>
</id>
<many-to-one name="samples" class="us.fl.ci.tlh.mobile.aspen.data.Samples" update="false"
insert="false" fetch="select" cascade="save-update" >
<column name="LIMS#" precision="11" scale="0" not-null="true" unique="true" />
</many-to-one>
<property name="labNumber" type="java.lang.String">
<column name="LAB#" length="20" not-null="true" />
</property>
<property name="clientid" type="java.lang.String">
<column name="CLIENTID" length="25" not-null="true" />
</property>
<property name="name" type="java.lang.String">
<column name="NAME" length="40" />
</property>
<property name="dept" type="java.lang.String">
<column name="DEPT" length="40" />
</property>
<property name="address1" type="java.lang.String">
<column name="ADDRESS1" length="40" />
</property>
<property name="address2" type="java.lang.String">
<column name="ADDRESS2" length="40" />
</property>
<property name="city" type="java.lang.String">
<column name="CITY" length="20" />
</property>
<property name="state" type="java.lang.String">
<column name="STATE" length="20" />
</property>
<property name="zip" type="java.lang.String">
<column name="ZIP" length="10" />
</property>
<property name="contact" type="java.lang.String">
<column name="CONTACT" length="20" />
</property>
<property name="phone" type="java.lang.String">
<column name="PHONE" length="14" />
</property>
<property name="ext" type="java.lang.String">
<column name="EXT" length="6" />
</property>
<property name="fax" type="java.lang.String">
<column name="FAX" length="14" />
</property>
<property name="province" type="java.lang.String">
<column name="PROVINCE" length="20" />
</property>
<property name="billTo" type="java.lang.String">
<column name="BILL_TO" length="40" />
</property>
<property name="billContact" type="java.lang.String">
<column name="BILL_CONTACT" length="40" />
</property>
<property name="billAddr1" type="java.lang.String">
<column name="BILL_ADDR1" length="40" />
</property>
<property name="billAddr2" type="java.lang.String">
<column name="BILL_ADDR2" length="40" />
</property>
<property name="billDept" type="java.lang.String">
<column name="BILL_DEPT" length="40" />
</property>
<property name="billCity" type="java.lang.String">
<column name="BILL_CITY" length="20" />
</property>
<property name="billState" type="java.lang.String">
<column name="BILL_STATE" length="20" />
</property>
<property name="billZip" type="java.lang.String">
<column name="BILL_ZIP" length="10" />
</property>
<property name="billProvince" type="java.lang.String">
<column name="BILL_PROVINCE" length="20" />
</property>
<property name="billPhone" type="java.lang.String">
<column name="BILL_PHONE" length="14" />
</property>
<property name="billFax" type="java.lang.String">
<column name="BILL_FAX" length="14" />
</property>
<property name="billExt" type="java.lang.String">
<column name="BILL_EXT" length="6" />
</property>
<property name="emailAddr" type="java.lang.String">
<column name="EMAIL_ADDR" />
</property>
<property name="intloginname" type="java.lang.String">
<column name="INTLOGINNAME" length="20" />
</property>
<property name="submisc1" type="java.lang.String">
<column name="SUBMISC1" length="25" />
</property>
<property name="submisc2" type="java.lang.String">
<column name="SUBMISC2" length="25" />
</property>
<property name="submisc3" type="java.lang.String">
<column name="SUBMISC3" length="25" />
</property>
<property name="submisc4" type="java.lang.String">
<column name="SUBMISC4" length="25" />
</property>
<property name="submisc5" type="java.lang.String">
<column name="SUBMISC5" length="25" />
</property>
<property name="reportname" type="java.lang.String">
<column name="REPORTNAME" length="100" />
</property>
<property name="hardcopyreport" type="java.lang.Long">
<column name="HARDCOPYREPORT" precision="1" scale="0" not-null="true" />
</property>
<property name="emailreport" type="java.lang.Long">
<column name="EMAILREPORT" precision="1" scale="0" not-null="true" />
</property>
<property name="faxreport" type="java.lang.Long">
<column name="FAXREPORT" precision="1" scale="0" not-null="true" />
</property>
</class>
</hibernate-mapping>
Name and version of the database you are using:
Oracle 9
Hello friends -
I'm trying to tie into an existing database, their business case is a parent child relationship, but essentially always maps to a one to one; at least for my purposes.
For whatever reason, the architects of the application I'm trying to integrate to have a parent table with a sequentially generated key, and the child table uses the same value in a column with the same name, as a primary key and as a foreign key to the parent table.
I seem to be having problems convincing Hibernate to actually persist my set of child objects (the set always containing one object). It just never really tries to write insert statements for it. (I have also run tests with the key generation technique on the child to 'assigned' with identical results.)
If I attempt to ignore the many to one / Set definitions, and treat Samples and Submitters as separate objects to persist, I get errors concerning invalid contraints, with the foreign keys not being locatable. I guess I could create my parents, commit, open a new session, physically set my pk values on my children, then commit those, but then rolling back gets more difficult than it should.
Can anyone point me to what I'm doing wrong?
Thank you!
- pD
_________________ I've got that sunny bunny feeling.
|