Hibernate version:
3
Name and version of the database you are using:
SQL Serveur 2000
Hy every one,
my problem is not simple, I've got a relation between 3 tables and I want to make a mapping with 2 differents <map>.
Look at my DB :
And, here there is my Mapping.hbm.xml :
Code:
<class name="TArticle" table="Article" optimistic-lock="version">
<id name="id">
<generator class="increment"/>
</id>
<version name="version" type="long"/>
<property name="name"/>
<property name="price"/>
</class>
<class name="TStore" table="Store" optimistic-lock="version">
<id name="id">
<generator class="increment"/>
</id>
<version name="version" type="long"/>
<property name="name"/>
<many-to-one name="storeBy" column="store_id" />
<set name="recalls" inverse="true" table="Recall_Article_Store">
<key column="store_id"/>
<one-to-many class="TRecall" />
</set>
</class>
<class name="TRecall" table="Recall" optimistic-lock="version">
<id name="id" column="id" />
<version name="version" />
<property name="year"></property>
<property name="number"></property>
<property name="recall_version" column="version_nb"></property>
<property name="name"></property>
<map name="articles" table="Recall_Article_Store">
<key column="recall_id"/>
<index-many-to-many class="TArticle" foreign-key="article_id"/>
<composite-element class="TArticles">
<many-to-one name="article" column="article_id" />
<property name="action"></property>
</composite-element>
</map>
<map name="stores" table="Recall_Article_Store">
<key column="recall_id" ></key>
<index-many-to-many class="TStore"></index-many-to-many>
<composite-element class="TStores">
<property name="quantity"></property>
</composite-element>
</map>
</class>
I've already try different kind of possibilities, but nothing work :
Repeated column in mapping for collection: be.uchrony.example.db.TRecall.articles column: article_id I just want to have a TRecall class with 2 different List (Map or something else), so I'll be able to see all Articles and all Store.
in a second case I want, when I choose a Store to know how many "Quantity" of Article in the Recall the store had.
Kind regards,
- Blins.
[/code]