I have created a view which will be used for fetching the data only(readonly)
View : Grid_View
> My 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>
> As their is no primary key in my view,Ihave not mentioned id field in my mapping. But in hibernate id is required.
> My Question
How to proceed with the mapping without id in the hibernate mapping file. And their are no columns with unique values so thier is no any chance of making them the key. Please help me resolve this issue
You have two options either add Composite Key or add
<id column="ROWID" type="string" />
Hibernate need unique key to map. Best approach is to add primary key.