ide:eclipse:jpa
Ceci est une ancienne révision du document !
Table des matières
Problèmes
Schema "XXXX" cannot be resolved for table "YYYY"
Possibilité 1
Il faut générer les tables depuis les entités.
Clique-droit sur le projet, JPA Tools
, Generate Tables from Entities
.
Pour que cela marche, il faut que dans le persistence.xml
la propriété suivante existe :
<property name="javax.persistence.schema-generation.database.action" value="create"/>
Possibilité 2
Le schéma n'est pas le bon.
Il faut afficher Data Source Explorer
depuis Window
, Show View
, Other…
Et ajouter en déclaration de la classe le nom du schéma
@Entity @Table(schema = "DEFAULT") public class Position {
The value for annotation attribute SecondaryTable.pkJoinColumns must be some @javax.persistence.PrimaryKeyJoinColumn annotation
@SecondaryTables({ @SecondaryTable(name="PERSO_SECU", pkJoinColumns=@PrimaryKeyJoinColumn(referencedColumnName="ID")), @SecondaryTable(name="PERSO_BANQUE", pkJoinColumns=@PrimaryKeyJoinColumn(referencedColumnName="ID")) })
Il manque
import javax.persistence.PrimaryKeyJoinColumn;
@OneToOne or @ManyToOne on XXX references an unknown entity: YYY
Hibernate :
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on XXX references an unknown entity: YYY at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
La classe YYY n'est pas dans le fichier hibernate.cfg.xml
<hibernate-configuration> <session-factory> <mapping class="YYY" /> </session-factory> </hibernate-configuration>
ide/eclipse/jpa.1484526662.txt.gz · Dernière modification : 2017/01/16 01:31 de root