Joined: Tue Nov 11, 2008 8:19 am Posts: 11
|
Hi All,
In the legacy DB there is a table called "Counter" which tells the next possible value of a business column (not identity). I have created a view on this table and implemented the org.hibernate.id.TableHiLoGenerator for this ID column. Now I have a scenario to use this "Counter" table for a property (which is not the primary key of that table column). How can i resolve this issue?
Is it possible to map a view with a property ???
<hibernate-mapping> <class name="in.co.lic.stmp.insuranceagreement.domain.PlanMovementDo" table="PLANMVTS"> <id name="planMovementNumber" type="int"> <column name="PlanMvtId" /> <generator class="org.hibernate.id.TableHiLoGenerator"> <param name="table">view_IDGenerator_PlanMvtId</param> <param name="column">planMvtId</param> <param name="max_lo">0</param> </generator> </id> <property name="origin" type="int"> <column name="ORIGIN" not-null="true" /> </property> <property name="planNumber" type="string"> <column name="PLANNO" length="12" /> </property> <property name="productType" type="int"> <column name="PRODTYP" not-null="true" /> </property> </class> </hibernate-mapping>
view_IDGenerator_PlanMvtId : SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER OFF GO
ALTER VIEW [dbo].[view_IDGenerator_PlanMvtId]
AS SELECT VALUE AS PlanMvtId FROM Counter WHERE PARAMETERNAME = 'PlanMvtId' GO
SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER ON GO
_________________ Vinoth
|
|