Я генерирую сущности из дампа базы данных PostgreSQL
, используя постоянство JPA в IntelliJ, это большая ошибка при отображении (имя столбца соединения, составные ключи ..) , естьЕсть способ исправить их автоматически. У меня есть 100 таблиц. Вот пример, где выдается ошибка, ошибка: «Ошибка вызова метода init; вложенное исключение - org.hibernate.DuplicateMappingException: Таблица [ressource] содержит имя физического столбца [id_modele».] ссылается на несколько имен физических столбцов:: [id_modele], [idModele]
@Entity
@Table(name = "ressource", schema = "public", catalog = "pfeDb")
public class RessourceEntity {
private String idRessource;
private String nomIhmRessource;
private String identifiant;
private String idPeuplement;
private String idModele;
private String nomModele;
private String idDomaine;
private String fonctionTechnique;
private String typeRessource;
private Integer idImage;
private String commentaire;
private Integer idDetailSynoptique;
private ModeleEntity modeleByIdModele;
private SynoptiqueEntity synoptiqueByIdDetailSynoptique;
@Id
@Column(name = "id_ressource", nullable = false, length = 234)
public String getIdRessource() {
return idRessource;
}
public void setIdRessource(String idRessource) {
this.idRessource = idRessource;
}
@Basic
@Column(name = "nom_ihm_ressource", nullable = false, length = 128)
public String getNomIhmRessource() {
return nomIhmRessource;
}
public void setNomIhmRessource(String nomIhmRessource) {
this.nomIhmRessource = nomIhmRessource;
}
@Basic
@Column(name = "identifiant", nullable = false, length = 64)
public String getIdentifiant() {
return identifiant;
}
public void setIdentifiant(String identifiant) {
this.identifiant = identifiant;
}
@Basic
@Column(name = "id_peuplement", nullable = false, length = 102)
public String getIdPeuplement() {
return idPeuplement;
}
public void setIdPeuplement(String idPeuplement) {
this.idPeuplement = idPeuplement;
}
@Basic
public String getIdModele() {
return idModele;
}
public void setIdModele(String idModele) {
this.idModele = idModele;
}
@Basic
@Column(name = "nom_modele", nullable = false, length = 64)
public String getNomModele() {
return nomModele;
}
public void setNomModele(String nomModele) {
this.nomModele = nomModele;
}
@Basic
@Column(name = "id_domaine", nullable = true, length = 88)
public String getIdDomaine() {
return idDomaine;
}
public void setIdDomaine(String idDomaine) {
this.idDomaine = idDomaine;
}
@Basic
@Column(name = "fonction_technique", nullable = false, length = 64)
public String getFonctionTechnique() {
return fonctionTechnique;
}
public void setFonctionTechnique(String fonctionTechnique) {
this.fonctionTechnique = fonctionTechnique;
}
@Basic
@Column(name = "type_ressource", nullable = false, length = 8)
public String getTypeRessource() {
return typeRessource;
}
public void setTypeRessource(String typeRessource) {
this.typeRessource = typeRessource;
}
@Basic
@Column(name = "id_image", nullable = true)
public Integer getIdImage() {
return idImage;
}
public void setIdImage(Integer idImage) {
this.idImage = idImage;
}
@Basic
@Column(name = "commentaire", nullable = true, length = -1)
public String getCommentaire() {
return commentaire;
}
public void setCommentaire(String commentaire) {
this.commentaire = commentaire;
}
@Basic
@Column(name = "id_detail_synoptique", nullable = true)
public Integer getIdDetailSynoptique() {
return idDetailSynoptique;
}
public void setIdDetailSynoptique(Integer idDetailSynoptique) {
this.idDetailSynoptique = idDetailSynoptique;
}
@ManyToOne
@JoinColumn(name = "id_modele", nullable = false)
public ModeleEntity getModeleByIdModele() {
return modeleByIdModele;
}
public void setModeleByIdModele(ModeleEntity modeleByIdModele) {
this.modeleByIdModele = modeleByIdModele;
}
@ManyToOne
@JoinColumn(name = "id_detail_synoptique")
public SynoptiqueEntity getSynoptiqueByIdDetailSynoptique() {
return synoptiqueByIdDetailSynoptique;
}
public void setSynoptiqueByIdDetailSynoptique(SynoptiqueEntity
synoptiqueByIdDetailSynoptique) {
this.synoptiqueByIdDetailSynoptique =
synoptiqueByIdDetailSynoptique;
}
}
, а другой класс:
@Entity
@Table(name = "modele", schema = "public", catalog = "pfeDb")
public class ModeleEntity {
private String idModele;
private String nomModele;
private Integer idImage;
private String idVersionCatalogue;
private String idCategorie;
private String idDomaine;
private String idTypeModele;
private boolean accesUnique;
private String regle;
private String reglesGenerees;
private String commentaire;
private Integer objetId;
private Boolean interfaceCristal;
private ObjetModeleEntity objetModeleByObjetId;
private Collection<RessourceEntity> ressourcesByIdModele;
@Id
public String getIdModele() {
return idModele;
}
public void setIdModele(String idModele) {
this.idModele = idModele;
}
@Basic
public String getNomModele() {
return nomModele;
}
public void setNomModele(String nomModele) {
this.nomModele = nomModele;
}
@Basic
public Integer getIdImage() {
return idImage;
}
public void setIdImage(Integer idImage) {
this.idImage = idImage;
}
@Basic
public String getIdVersionCatalogue() {
return idVersionCatalogue;
}
public void setIdVersionCatalogue(String idVersionCatalogue) {
this.idVersionCatalogue = idVersionCatalogue;
}
@Basic
public String getIdCategorie() {
return idCategorie;
}
public void setIdCategorie(String idCategorie) {
this.idCategorie = idCategorie;
}
@Basic
public String getIdDomaine() {
return idDomaine;
}
public void setIdDomaine(String idDomaine) {
this.idDomaine = idDomaine;
}
@Basic
public String getIdTypeModele() {
return idTypeModele;
}
public void setIdTypeModele(String idTypeModele) {
this.idTypeModele = idTypeModele;
}
@Basic
@Column(name = "acces_unique", nullable = false)
public boolean isAccesUnique() {
return accesUnique;
}
public void setAccesUnique(boolean accesUnique) {
this.accesUnique = accesUnique;
}
@Basic
public String getRegle() {
return regle;
}
public void setRegle(String regle) {
this.regle = regle;
}
@Basic
public String getReglesGenerees() {
return reglesGenerees;
}
public void setReglesGenerees(String reglesGenerees) {
this.reglesGenerees = reglesGenerees;
}
@Basic
public String getCommentaire() {
return commentaire;
}
public void setCommentaire(String commentaire) {
this.commentaire = commentaire;
}
@Basic
public Integer getObjetId() {
return objetId;
}
public void setObjetId(Integer objetId) {
this.objetId = objetId;
}
@Basic
public Boolean getInterfaceCristal() {
return interfaceCristal;
}
public void setInterfaceCristal(Boolean interfaceCristal) {
this.interfaceCristal = interfaceCristal;
}
@ManyToOne
@JoinColumn(name = "objet_id")
public ObjetModeleEntity getObjetModeleByObjetId() {
return objetModeleByObjetId;
}
public void setObjetModeleByObjetId(ObjetModeleEntity
objetModeleByObjetId) {
this.objetModeleByObjetId = objetModeleByObjetId;
}
@OneToMany(mappedBy = "modeleByIdModele")
public Collection<RessourceEntity> getRessourcesByIdModele() {
return ressourcesByIdModele;
}
public void setRessourcesByIdModele(Collection<RessourceEntity>
ressourcesByIdModele) {
this.ressourcesByIdModele = ressourcesByIdModele;
}
}