Hi all of you.... i have one problem in hibernate mapping file. I have a one table "PARTNERBRANCHSERVICECITIES" and one VIEW named "VW_MSLOCATIONS" with columns : AREAID int AREA varchar CITYID int CITY varchar STATEID int STATE varchar COUNTRYID int COUNTRY varchar
the AREAID is primary key and assigned, but there is another table named "PARTNERBRANCHSERVICECITIES" I want to relation two table with column "CITYID" but Hibernate use my primary key to join two table. how can I join two table with another column in a table, i dont want to join with primary key column.
my mapping in LocationDetailsEntity.hbm.xml is:(LocationDetailsEntity class also same)
<?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 mutable="false" name="com.lsp.lens.common.entity.LocationDetailsEntity" table="VW_MSLOCATIONS"> <!--<cache usage="read-only"/>--> <id column="AREAID" name="areaId"> <generator class="assigned"/> </id> <property column="AREA" name="areaName"/> <property column="CITYID" name="cityId"/> <property column="CITY" name="cityName"/> <property column="STATEID" name="stateId"/> <property column="STATE" name="stateName"/> <property column="COUNTRYID" name="countryId"/> <property column="COUNTRY" name="countryName"/> </class> </hibernate-mapping>
and PartnerBranchCityEntity.hbm.xml is like this
<?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="com.lsp.lens.partner.entity.PartnerBranchCityEntity" table="PARTNERBRANCHSERVICECITIES"> <id column="Id" name="id"> <generator class="increment"/> </id> <property column="PartnerBranchID" name="partnerBranchID"/> <many-to-one cascade="none" class="com.lsp.lens.common.entity.LocationDetailsEntity" column="CityID" name="locationDetailsEntity" not-null="true"/> </class> </hibernate-mapping>
where i am going to wrong please help me ....
Thanks in advanced Rajesh Kardile +91-9960689600
|