carlolf wrote:
Lots of stuff you presented here - but what's your question and problem?
To be brief, i am getting the following exception.
object references an unsaved transient instance - save the transient instance before flushing
Plz see the domain files below:
Code:
public class Company
{
private long id;
private String companyName;
private Set dbdcCDeliveryAddress = new HashSet();
// setters and getters for this properties
}
public class DBDCDeliveryAddress {
private long id;
private String receiverID;
private Company company;
// setters and getters for this properties
}
Code:
[color=red]
[b]Company Mapping File[/b]
<hibernate-mapping>
<class
name="com.db.caaa.domain.Company"
table="COMPANY"
dynamic-update="false"
dynamic-insert="false"
>
<cache usage="nonstrict-read-write" />
<id
name="id" column="id" type="long" unsaved-value="-1" >
<generator class="native">
</generator>
</id>
<property
name="companyName" type="java.lang.String" update="true" insert="true" access="property" >
<column
name="companyName"
length="35" unique-key="CONAMESNAME" not-null="true"
/>
</property>
<property
name="companyShortName" type="java.lang.String"
update="true" insert="true" access="property" >
<column
name="companyShortName"
length="20"
unique-key="CONAMESNAME"
not-null="true"
/>
</property>
<set
name="dbdcCDeliveryAddress"
table="DBDCDELIVERYADDRESS"
lazy="false"
inverse="false"
cascade="all"
sort="unsorted">
<cache
usage="nonstrict-read-write"
/>
<key
column="company_fk"
>
</key>
<one-to-many
class="com.db.caaa.domain.DBDCDeliveryAddress"
/>
</set>
</hibernate-mapping>
[/color]
Code:
[color=orange][/color][color=green]
[b]DBDCDEliverAddress Mapping File[/b]
<hibernate-mapping>
<class
name="com.db.caaa.domain.DBDCDeliveryAddress"
table="DBDCDELIVERYADDRESS"
dynamic-update="false"
dynamic-insert="false" >
<cache usage="nonstrict-read-write" />
<id
name="id"
column="id"
type="long"
unsaved-value="-1"
>
<generator class="native">
</generator>
</id>
<property
name="receiverID"
type="java.lang.String"
update="true" insert="true" access="property">
<column
name="ReceiverId" not-null="false" unique="false"/>
</property>
<many-to-one
name="company"
class="com.db.caaa.domain.Company"
cascade="save-update"
outer-join="auto"
update="true"
insert="true"
access="property"
column="company_fk"
/>
</class>
</hibernate-mapping>
[/color]
Could please look into this and suggest me to resolve his issue:
Thanks in advance