To map a database view with no primary key, in hibernate xml mapping -
i have created view used fetching data only(readonly)
view : grid_view
> hibernate hbm file
<hibernate-mapping> <class name="hibernate.domain.view" table="grid_view" mutable="false"> <property name="acct_br_cd" type="string"> <column name="acct_br_cd"/> </property> <property name="acct_no" type="string"> <column name="acct_no"/> </property> <property name="lgl_enty_nm" type="string"> <column name="lgl_enty_nm"/> </property> <property name="cust_ctry_cd" type="string"> <column name="cust_ctry_cd"/> </property> <property name="acct_src_sys_cd" type="string"> <column name="acct_src_sys_cd"/> </property> </class> </hibernate-mapping>
> no primary key in view,ihave not mentioned id field in mapping. in hibernate id required.
> question
how proceed mapping without id in hibernate mapping file. , no columns unique values thier no chance of making them key. please me resolve issue
you have 2 options either add composite key or add
<id column="rowid" type="string" />
hibernate need unique key map. best approach add primary key.
Comments
Post a Comment