Hi for all.
Like i have wrote in the title, i would map a table with a materialized View.
The difficult for me is that i would use not the primary key but another arbitrary key in the Table.
To explain in a better way i'll do an example.
Suppose to have the Table
User, with fields:
userId(PK), firstname, secondname and address;
and a materialized view called commonData that has the fields:
address, zipcode, country.
So i would map User to Address with an association one(User) many(CommonData), that map the address of a User with the equal addresses of commonData.
I cannot have a Primary Key in CommonData.
Is in some way possible map It?
<hibernate-mapping>
<class name="User" table="USER">
<id name="userid" unsaved-value="0">
<generator class="increment"/>
</id>
????CommonData????
..........
<property name="name" type="string"/>
</class>
<class name="CommonData"
table="COMMONDATA">
<property name="address" column="ADDRESS"/>
<property name="zipcode" column="ZIPCODE"/>
<property name="country" column="COUNTRY"/>
</class>
</hibernate-mapping>
Thanks in advance
|