Salut à tous,
voilà j'utilise Hibernate 3.2.0GA et MySQL 5.1.17.
Mon souci est que j'ai fait un mapping comme suit :
et quand j'execute mon code ( ça devrait créer les tables automatiquement)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 <class name="AbstractReportBean" abstract="true"> <id name="id" type="long" column="report_id"> <generator class="native" /> </id> <many-to-one name="mavenProject" column="MAVENPROJECT_ID" class="DashBoardMavenProject" /> <property name="dateGeneration" column="dateGeneration" type="timestamp" /> </class> <!-- org.codehaus.mojo.dashboard.report.plugin.beans.CheckstyleReportBean root --> <!-- table="CheckstyleReportBean" --> <union-subclass name="CheckstyleReportBean" table="CheckstyleReportBean" extends="AbstractReportBean"> <property name="nbClasses" column="nbClasses" type="int" /> <property name="nbInfos" column="nbInfos" type="int" /> <property name="nbErrors" column="nbErrors" type="int" /> <property name="nbWarnings" column="nbWarnings" type="int" /> <property name="nbTotal" column="nbTotal" type="int" /> <query name="getCheckstyleByDashBoardMavenProjectID"> <![CDATA[ select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id ]]> </query> <query name="getCheckstyleByPeriod"> <![CDATA[ select c from CheckstyleReportBean c,DashBoardMavenProject m where c.mavenProject = m and m.id = :id and c.dateGeneration >= :startdate and c.dateGeneration <= :enddate ]]> </query> </union-subclass>
j'ai cette erreur :
Mon probleme est que je ne sais pas le résoudre sachant que le même mapping fonctionne sous Oracle 9i et Apache Derby.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Caused by: org.hibernate.MappingException: Cannot use identity column key generation with <union-subclass> mapping for: org.codehaus.mojo.dashboard.report.plugin.beans.AbstractReportBean
A priori, MySQL utilise un IdentityGenerator qui ne serait pas supporté avec des classes Union dans Hibernate.
Comment contourner ça sans modifier l'ensemble du mapping ?
Partager