Hi,
How can i update foreign key (CITY) in TableA without updating TableB?
Anybody help me?
My classes and mappings as flow;
I have tow classes like as A and B. Tables are
Create TableA (HOTSPOT_ID(PK),..., CITY(FK for Table B))
Create TableB (CITY(PK),....)
Association is many-to-one
class A
{
B b;
..getB
..setB
}
class B
{
.....
}
and my A.hibernate.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.gantek.model.HotspotNew"
table="HOTSPOT_TEMP"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="ID"
column="HOTSPOT_ID"
type="java.lang.Integer"
>
<generator class="foreign">
<param name="property">hotspotAdt</param>
</generator>
</id>
<property
name="customerID"
type="java.lang.Integer"
update="true"
insert="true"
access="property"
column="CUSTOMER_ID"
not-null="false"
/>
<property
name="nasIp"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="NAS_IP"
length="15"
not-null="true"
/>
<property
name="definition"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="DEFINITION"
length="50"
not-null="true"
/>
<property
name="active"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="active"
not-null="false"
/>
<many-to-one name="city" class="com.gantek.model.Cities"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="CITY"
not-null="true"
/>
<many-to-one
name="hotspotType"
class="com.gantek.model.HotspotType"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="HOTSPOT_TYPE"
/>
<many-to-one
name="hotspotType2"
class="com.gantek.model.HotspotType2"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="HOTSPOT_TYPE2"
/>
<one-to-one name="hotspotAdt" class="com.gantek.model.HotspotAdt" constrained="true" cascade="all"/>
</class>
</hibernate-mapping>
B.hibernate.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.gantek.model.Cities"
table="system_cities"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="ID"
column="city_id"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="assigned">
</generator>
</id>
<property
name="DESCRIPTION"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="description"
length="128"
/>
</class>
</hibernate-mapping>
|