Hello,
I am french and i get some problems with HIBERNATE. I am mappping an object graph with HIBERNATE and somewhere I use an interface. Here is my problem :
I have a class Page which contents a HasSet of interfaces "ElementPage". It is a one-to-many relation :
Code:
class Page
{
......
private Set<ElementPage> elementPages = new ....()
}
interface ElementPage {....}
I have 3 classes "Champ", "Bloc" et "Texte" that implement the "ElementPage" interface:
Code:
class Champ implements ElementPage
{
.......
private Page page;
}
class Bloc implements ElementPage
{
.......
private Page page;
}
class Texte implements ElementPage
{
.......
private Page page;
}
My mapping file for the class "Page" is folowing:
Code:
<hibernate-mapping ....>
<class name="Page" table="t_page" >
..............
<set name="elementPages" inverse="true">
<key column="PAGE_ID" />
<one-to-many class="ElementPage" />
</set>
</class>
</hibernate-mapping>
My mapping file for the class "Champ" is folowing:
Code:
<hibernate-mapping ....>
<class name="Champ" table="t_champ" >
..............
<many-to-one column="PAGE_ID" name="page" class="Page" />
</class>
</hibernate-mapping>
My mapping file for the class "Bloc" is folowing:
Code:
<hibernate-mapping ....>
<class name="Bloc" table="t_bloc" >
..............
<many-to-one column="PAGE_ID" name="page" class="Page" />
</class>
</hibernate-mapping>
My mapping file for the class "Texte" is folowing:
Code:
<hibernate-mapping ....>
<class name="Texte" table="t_texte" >
..............
<many-to-one column="PAGE_ID" name="page" class="Page" />
</class>
</hibernate-mapping>
To resume, I have a class "Page" that has an association (a set) towards several "ElementPage" which is an interface implemented by 3 other classes. I decided to map these 3 child class and not the interface itself.
The framework on which I work gives me the folowing error :
Code:
Association references unmapped class: ElementPage
Il seems that I created an association towards an interface which is not mapped and that HIBERNATE doesn't manage this. I don't know how I can implement this. If there is a genius of HIBERNATE who can help me, he or she is welcomed.
Thank you in advance for your answer.
Xavier