Hi everbody,
I have the follow situation on Database:
Thats because I have to internationalize the name and details of products.
I think the one right solution for mapping this was the follow:
Code:
<hibernate-mapping package="model">
<class name="Product" table="PRODUCT" >
<id name="id" column="idProduct" unsaved-value="null">
<generator class="identity"/>
</id>
<property name="price" column="price" not-null="true" type="currency"/>
<bag name="productDetails" cascade="all" lazy="true">
<key column="FKidProduct" not-null="true"/>
<one-to-many class="ProductDetail"/>
</bag>
</class>
</hibernate-mapping>
On that way I have to create two business classes: Product and ProductDetail, with a relation of aggregation between that, and then create another hibernat-mapping to class ProductDetail, ok.
But I dont want to let my business classes knows the internationalization, I have to use my Product class like this:
So, I need to find a way to inject the atributte locale (coming from my application) in this hibernate mapping to get the right name and details from my table PRODUCT_DETAILS depending of the key Locale that I have to inject.
Anyone can help me to find what aspect of hibernate I have to do research in order to resolve this problem?? I am using Spring + Hibernates 3 on my applications.
Thanks.