Java 无法在hibernate JPA中检索孙子
Java 无法在hibernate JPA中检索孙子,java,hibernate,jpa,Java,Hibernate,Jpa,配置将文章类型作为子项,而文章类型可以将不同的文章类型作为子项。 我正在尝试检索所有配置及其子项(对于配置,所有文章类型)。 我在这里没有得到父母和孩子的文章类型。 我想使用配置实体检索所有授权子项 这是我的配置实体:- @Entity @Table(name = "tbl_configuration") @XmlRootElement public class Configuration extends BaseEntity implements Serializable { priv
配置
将文章类型
作为子项,而文章类型
可以将不同的文章类型
作为子项。我正在尝试检索所有
配置
及其子项(对于配置
,所有文章类型
)。我在这里没有得到父母和孩子的
文章类型。
我想使用配置实体检索所有授权子项
这是我的配置
实体:-
@Entity
@Table(name = "tbl_configuration")
@XmlRootElement
public class Configuration extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "config_index")
private Integer configIndex;
@Column(name = "config_nom")
private String configNom;
@Column(name = "config_revision")
private String configRevision;
@JsonManagedReference(value="configuration-article-type")
@OneToMany(mappedBy = "artTypPcIndexConfig", fetch = FetchType.EAGER)
private Collection<ArticleTypeParentChild> articleTypeParentChildCollection;
public Configuration()
{
}
public Configuration(Integer configIndex)
{
this.configIndex = configIndex;
}
public Integer getConfigIndex()
{
return configIndex;
}
public void setConfigIndex(Integer configIndex)
{
this.configIndex = configIndex;
}
public String getConfigNom()
{
return configNom;
}
public void setConfigNom(String configNom)
{
this.configNom = configNom;
}
public String getConfigRevision()
{
return configRevision;
}
public void setConfigRevision(String configRevision)
{
this.configRevision = configRevision;
}
public Collection<ArticleTypeParentChild> getArticleTypeParentChildCollection()
{
return articleTypeParentChildCollection;
}
public void setArticleTypeParentChildCollection(Collection<ArticleTypeParentChild> articleTypeParentChildCollection)
{
this.articleTypeParentChildCollection = articleTypeParentChildCollection;
}
}
ArticleType表实体:-
public class ArticleType extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "art_typ_index")
private Integer artTypIndex;
@Basic(optional = false)
@Column(name = "art_typ_index_designation")
private int artTypIndexDesignation;
@Basic(optional = false)
@Column(name = "art_typ_code")
private String artTypCode;
@Basic(optional = false)
@Column(name = "art_typ_code_effectivite")
private String artTypCodeEffectivite;
@Basic(optional = false)
@Column(name = "art_typ_numero_serie")
private boolean artTypNumeroSerie;
@Basic(optional = false)
@Column(name = "art_typ_version_materiel")
private boolean artTypVersionMateriel;
@Basic(optional = false)
@Column(name = "art_typ_version_logiciel")
private boolean artTypVersionLogiciel;
@Column(name = "art_typ_index_description")
private String artTypIndexDescription;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atrIndexArticleType")
private Collection<ArticleTypeReseau> articleTypeReseauCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atvIndexArticleType")
private Collection<ArticleTypeVariante> articleTypeVarianteCollection;
@JoinColumn(name = "art_typ_index_option", referencedColumnName = "opt_art_index")
@ManyToOne
private OptionArticle artTypIndexOption;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atpIndexArticleType")
private Collection<ArticleTypeProjet> articleTypeProjetCollection;
@OneToMany(mappedBy = "atvoIndexArticleType")
private Collection<ArticleTypeVarianteOption> articleTypeVarianteOptionCollection;
@JsonManagedReference(value="child-article-type")
@OneToMany(mappedBy = "artTypChildIndex", fetch = FetchType.EAGER)
private Collection<ArticleTypeParentChild> articleTypeChildCollection;
@JsonManagedReference(value="parent-article-type")
@OneToMany(mappedBy = "artTypParentIndex", fetch = FetchType.EAGER)
private Collection<ArticleTypeParentChild> articleTypeParentCollection;
@OneToMany(mappedBy = "atoIndexArtType")
private Collection<ArticleTypeOption> articleTypeOptionCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "locIndexArticleType")
private Collection<Localisation> localisationCollection;
@OneToMany(mappedBy = "atlIndexArticleType")
private Collection<ArticleTypeLocalisation> articleTypeLocalisationCollection;
public ArticleType()
{
}
public ArticleType(Integer artTypIndex)
{
this.artTypIndex = artTypIndex;
}
public ArticleType(Integer artTypIndex, int artTypIndexDesignation, String artTypCode, String artTypCodeEffectivite, boolean artTypNumeroSerie, boolean artTypVersionMateriel, boolean artTypVersionLogiciel)
{
this.artTypIndex = artTypIndex;
this.artTypIndexDesignation = artTypIndexDesignation;
this.artTypCode = artTypCode;
this.artTypCodeEffectivite = artTypCodeEffectivite;
this.artTypNumeroSerie = artTypNumeroSerie;
this.artTypVersionMateriel = artTypVersionMateriel;
this.artTypVersionLogiciel = artTypVersionLogiciel;
}
public Integer getArtTypIndex()
{
return artTypIndex;
}
public void setArtTypIndex(Integer artTypIndex)
{
this.artTypIndex = artTypIndex;
}
public int getArtTypIndexDesignation()
{
return artTypIndexDesignation;
}
public void setArtTypIndexDesignation(int artTypIndexDesignation)
{
this.artTypIndexDesignation = artTypIndexDesignation;
}
public String getArtTypCode()
{
return artTypCode;
}
public void setArtTypCode(String artTypCode)
{
this.artTypCode = artTypCode;
}
public String getArtTypCodeEffectivite()
{
return artTypCodeEffectivite;
}
public void setArtTypCodeEffectivite(String artTypCodeEffectivite)
{
this.artTypCodeEffectivite = artTypCodeEffectivite;
}
public boolean getArtTypNumeroSerie()
{
return artTypNumeroSerie;
}
public void setArtTypNumeroSerie(boolean artTypNumeroSerie)
{
this.artTypNumeroSerie = artTypNumeroSerie;
}
public boolean getArtTypVersionMateriel()
{
return artTypVersionMateriel;
}
public void setArtTypVersionMateriel(boolean artTypVersionMateriel)
{
this.artTypVersionMateriel = artTypVersionMateriel;
}
public boolean getArtTypVersionLogiciel()
{
return artTypVersionLogiciel;
}
public void setArtTypVersionLogiciel(boolean artTypVersionLogiciel)
{
this.artTypVersionLogiciel = artTypVersionLogiciel;
}
public String getArtTypIndexDescription()
{
return artTypIndexDescription;
}
public void setArtTypIndexDescription(String artTypIndexDescription)
{
this.artTypIndexDescription = artTypIndexDescription;
}
@XmlTransient
public Collection<ArticleTypeReseau> getArticleTypeReseauCollection()
{
return articleTypeReseauCollection;
}
public void setArticleTypeReseauCollection(Collection<ArticleTypeReseau> articleTypeReseauCollection)
{
this.articleTypeReseauCollection = articleTypeReseauCollection;
}
@XmlTransient
public Collection<ArticleTypeVariante> getArticleTypeVarianteCollection()
{
return articleTypeVarianteCollection;
}
public void setArticleTypeVarianteCollection(Collection<ArticleTypeVariante> articleTypeVarianteCollection)
{
this.articleTypeVarianteCollection = articleTypeVarianteCollection;
}
public OptionArticle getArtTypIndexOption()
{
return artTypIndexOption;
}
public void setArtTypIndexOption(OptionArticle artTypIndexOption)
{
this.artTypIndexOption = artTypIndexOption;
}
@XmlTransient
public Collection<ArticleTypeProjet> getArticleTypeProjetCollection()
{
return articleTypeProjetCollection;
}
public void setArticleTypeProjetCollection(Collection<ArticleTypeProjet> articleTypeProjetCollection)
{
this.articleTypeProjetCollection = articleTypeProjetCollection;
}
@XmlTransient
public Collection<ArticleTypeVarianteOption> getArticleTypeVarianteOptionCollection()
{
return articleTypeVarianteOptionCollection;
}
public void setArticleTypeVarianteOptionCollection(Collection<ArticleTypeVarianteOption> articleTypeVarianteOptionCollection)
{
this.articleTypeVarianteOptionCollection = articleTypeVarianteOptionCollection;
}
// @XmlTransient
public Collection<ArticleTypeParentChild> getArticleTypeParentChildCollection()
{
return articleTypeChildCollection;
}
public void setArticleTypeParentChildCollection(Collection<ArticleTypeParentChild> articleTypeParentChildCollection)
{
this.articleTypeChildCollection = articleTypeParentChildCollection;
}
// @XmlTransient
public Collection<ArticleTypeParentChild> getArticleTypeParentChildCollection1()
{
return articleTypeParentCollection;
}
public void setArticleTypeParentChildCollection1(Collection<ArticleTypeParentChild> articleTypeParentChildCollection1)
{
this.articleTypeParentCollection = articleTypeParentChildCollection1;
}
@XmlTransient
public Collection<ArticleTypeOption> getArticleTypeOptionCollection()
{
return articleTypeOptionCollection;
}
public void setArticleTypeOptionCollection(Collection<ArticleTypeOption> articleTypeOptionCollection)
{
this.articleTypeOptionCollection = articleTypeOptionCollection;
}
@XmlTransient
public Collection<Localisation> getLocalisationCollection()
{
return localisationCollection;
}
public void setLocalisationCollection(Collection<Localisation> localisationCollection)
{
this.localisationCollection = localisationCollection;
}
@XmlTransient
public Collection<ArticleTypeLocalisation> getArticleTypeLocalisationCollection()
{
return articleTypeLocalisationCollection;
}
public void setArticleTypeLocalisationCollection(Collection<ArticleTypeLocalisation> articleTypeLocalisationCollection)
{
this.articleTypeLocalisationCollection = articleTypeLocalisationCollection;
}
}
公共类ArticleType扩展BaseEntity实现可序列化
{
私有静态最终长serialVersionUID=1L;
@身份证
@基本(可选=假)
@列(name=“艺术类型索引”)
私有整数ArtTypex;
@基本(可选=假)
@列(名称=“艺术类型索引名称”)
私人艺术设计;
@基本(可选=假)
@列(名称=“艺术类型代码”)
私有字符串类型码;
@基本(可选=假)
@列(name=“艺术类型代码有效”)
私有字符串artTypCodeEffectivite;
@基本(可选=假)
@列(名称=“艺术类型数字系列”)
私有布尔型artTypNumeroSerie;
@基本(可选=假)
@列(名称=“艺术类型版本材料”)
私有布尔ArtTypVersionMaterial;
@基本(可选=假)
@列(name=“艺术类型版本逻辑”)
私有布尔ArtTypeVersionLogicel;
@列(名称=“艺术类型索引描述”)
私有字符串ArtTypedDescription;
@OneToMany(cascade=CascadeType.ALL,mappedBy=“atrIndexArticleType”)
私人收藏文章类型研究收藏;
@OneToMany(cascade=CascadeType.ALL,mappedBy=“atvindexactype”)
私人收藏ArticleTypeVariateCollection;
@JoinColumn(name=“art\u typ\u index\u option”,referencedColumnName=“opt\u art\u index”)
@许多酮
私人期权ArttypeIndexOption;
@OneToMany(cascade=CascadeType.ALL,mappedBy=“atpindexactype”)
私人收藏articleTypeProjetCollection;
@OneToMany(mappedBy=“atvoIndexArticleType”)
私人收藏物品类型差异选择收藏;
@JsonManagedReference(value=“子文章类型”)
@OneToMany(mappedBy=“artTypChildIndex”,fetch=FetchType.EAGER)
私人收藏;儿童收藏;
@JsonManagedReference(value=“父项目类型”)
@OneToMany(mappedBy=“artTypParentIndex”,fetch=FetchType.EAGER)
私人收藏;
@OneToMany(mappedBy=“atoIndexArtType”)
私人收藏物品类型选择收藏;
@OneToMany(cascade=CascadeType.ALL,mappedBy=“locIndexArticleType”)
私人收藏本地收藏;
@OneToMany(mappedBy=“atlIndexArticleType”)
私人收藏物品类型本地化收藏;
公共物品类型()
{
}
public ArticleType(整数ArtTypeIndex)
{
this.artTypIndex=artTypIndex;
}
public ArticleType(整数ArtTypeIndex、整数ArtTypeIndexDesignation、字符串ArtTypeCode、字符串ArtTypeCodeEffectivite、布尔ArtTypeNumeroserie、布尔ArtTypeVersionMaterial、布尔ArtTypeVersionLogiciel)
{
this.artTypIndex=artTypIndex;
this.arttypendexdesignation=arttypendexdesignation;
this.artTypCode=artTypCode;
this.artTypCodeEffectivite=artTypCodeEffectivite;
this.artTypNumeroSerie=artTypNumeroSerie;
this.artTypVersionMaterial=artTypVersionMaterial;
this.artTypVersionLogiciel=artTypVersionLogiciel;
}
公共整数getArtTypeIndex()
{
返回ArttyIndex;
}
公共void setArtTypeIndex(整数ArtTypeIndex)
{
this.artTypIndex=artTypIndex;
}
public int getArtTypeIndexDesignation()
{
返回ArtTypedExdesignation;
}
公共无效设置ArtTypeIndexDesignation(int ArtTypeIndexDesignation)
{
this.arttypendexdesignation=arttypendexdesignation;
}
公共字符串getArtTypCode()
{
返回artTypCode;
}
public void setArtTypCode(字符串artTypCode)
{
this.artTypCode=artTypCode;
}
公共字符串getArtTypCodeEffectivite()
{
返回artTypCodeEffectivite;
}
公共无效setArtTypCodeEffectivite(字符串artTypCodeEffectivite)
{
this.artTypCodeEffectivite=artTypCodeEffectivite;
}
公共布尔getArtTypNumeroSerie()
{
返回ArtTypeNumeroserie;
}
公共无效setArtTypNumeroSerie(布尔artTypNumeroSerie)
{
this.artTypNumeroSerie=artTypNumeroSerie;
}
公共布尔值getArtTypVersionMaterial()
{
返回ArtTypVersionMaterial;
}
public void setArtTypVersionMatriel(布尔ArtTypVersionMatriel)
{
this.artTypVersionMaterial=artTypVersionMaterial;
}
公共布尔getArtTypVersionLogiciel()
{
返回artTypVersionLogiciel;
}
public void setArtTypVersionLogiciel(布尔artTypVersionLogiciel)
{
this.artTypVersionLogiciel=artTypVersionLogiciel;
}
公共字符串getArtTypeIndexDescription()
{
返回艺术类型描述;
}
public void setArtTypeIndexDescription(字符串ArtTypeIndexDescription)
{
this.arttypendexdescription=arttypendexdescription;
}
@XmlTransient
公共集合GetArticleTypeReseareCollection()
{
归还物品类型重新收集;
}
公共无效SetArticleTypeReseaucole
public class ArticleType extends BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "art_typ_index")
private Integer artTypIndex;
@Basic(optional = false)
@Column(name = "art_typ_index_designation")
private int artTypIndexDesignation;
@Basic(optional = false)
@Column(name = "art_typ_code")
private String artTypCode;
@Basic(optional = false)
@Column(name = "art_typ_code_effectivite")
private String artTypCodeEffectivite;
@Basic(optional = false)
@Column(name = "art_typ_numero_serie")
private boolean artTypNumeroSerie;
@Basic(optional = false)
@Column(name = "art_typ_version_materiel")
private boolean artTypVersionMateriel;
@Basic(optional = false)
@Column(name = "art_typ_version_logiciel")
private boolean artTypVersionLogiciel;
@Column(name = "art_typ_index_description")
private String artTypIndexDescription;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atrIndexArticleType")
private Collection<ArticleTypeReseau> articleTypeReseauCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atvIndexArticleType")
private Collection<ArticleTypeVariante> articleTypeVarianteCollection;
@JoinColumn(name = "art_typ_index_option", referencedColumnName = "opt_art_index")
@ManyToOne
private OptionArticle artTypIndexOption;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "atpIndexArticleType")
private Collection<ArticleTypeProjet> articleTypeProjetCollection;
@OneToMany(mappedBy = "atvoIndexArticleType")
private Collection<ArticleTypeVarianteOption> articleTypeVarianteOptionCollection;
@JsonManagedReference(value="child-article-type")
@OneToMany(mappedBy = "artTypChildIndex", fetch = FetchType.EAGER)
private Collection<ArticleTypeParentChild> articleTypeChildCollection;
@JsonManagedReference(value="parent-article-type")
@OneToMany(mappedBy = "artTypParentIndex", fetch = FetchType.EAGER)
private Collection<ArticleTypeParentChild> articleTypeParentCollection;
@OneToMany(mappedBy = "atoIndexArtType")
private Collection<ArticleTypeOption> articleTypeOptionCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "locIndexArticleType")
private Collection<Localisation> localisationCollection;
@OneToMany(mappedBy = "atlIndexArticleType")
private Collection<ArticleTypeLocalisation> articleTypeLocalisationCollection;
public ArticleType()
{
}
public ArticleType(Integer artTypIndex)
{
this.artTypIndex = artTypIndex;
}
public ArticleType(Integer artTypIndex, int artTypIndexDesignation, String artTypCode, String artTypCodeEffectivite, boolean artTypNumeroSerie, boolean artTypVersionMateriel, boolean artTypVersionLogiciel)
{
this.artTypIndex = artTypIndex;
this.artTypIndexDesignation = artTypIndexDesignation;
this.artTypCode = artTypCode;
this.artTypCodeEffectivite = artTypCodeEffectivite;
this.artTypNumeroSerie = artTypNumeroSerie;
this.artTypVersionMateriel = artTypVersionMateriel;
this.artTypVersionLogiciel = artTypVersionLogiciel;
}
public Integer getArtTypIndex()
{
return artTypIndex;
}
public void setArtTypIndex(Integer artTypIndex)
{
this.artTypIndex = artTypIndex;
}
public int getArtTypIndexDesignation()
{
return artTypIndexDesignation;
}
public void setArtTypIndexDesignation(int artTypIndexDesignation)
{
this.artTypIndexDesignation = artTypIndexDesignation;
}
public String getArtTypCode()
{
return artTypCode;
}
public void setArtTypCode(String artTypCode)
{
this.artTypCode = artTypCode;
}
public String getArtTypCodeEffectivite()
{
return artTypCodeEffectivite;
}
public void setArtTypCodeEffectivite(String artTypCodeEffectivite)
{
this.artTypCodeEffectivite = artTypCodeEffectivite;
}
public boolean getArtTypNumeroSerie()
{
return artTypNumeroSerie;
}
public void setArtTypNumeroSerie(boolean artTypNumeroSerie)
{
this.artTypNumeroSerie = artTypNumeroSerie;
}
public boolean getArtTypVersionMateriel()
{
return artTypVersionMateriel;
}
public void setArtTypVersionMateriel(boolean artTypVersionMateriel)
{
this.artTypVersionMateriel = artTypVersionMateriel;
}
public boolean getArtTypVersionLogiciel()
{
return artTypVersionLogiciel;
}
public void setArtTypVersionLogiciel(boolean artTypVersionLogiciel)
{
this.artTypVersionLogiciel = artTypVersionLogiciel;
}
public String getArtTypIndexDescription()
{
return artTypIndexDescription;
}
public void setArtTypIndexDescription(String artTypIndexDescription)
{
this.artTypIndexDescription = artTypIndexDescription;
}
@XmlTransient
public Collection<ArticleTypeReseau> getArticleTypeReseauCollection()
{
return articleTypeReseauCollection;
}
public void setArticleTypeReseauCollection(Collection<ArticleTypeReseau> articleTypeReseauCollection)
{
this.articleTypeReseauCollection = articleTypeReseauCollection;
}
@XmlTransient
public Collection<ArticleTypeVariante> getArticleTypeVarianteCollection()
{
return articleTypeVarianteCollection;
}
public void setArticleTypeVarianteCollection(Collection<ArticleTypeVariante> articleTypeVarianteCollection)
{
this.articleTypeVarianteCollection = articleTypeVarianteCollection;
}
public OptionArticle getArtTypIndexOption()
{
return artTypIndexOption;
}
public void setArtTypIndexOption(OptionArticle artTypIndexOption)
{
this.artTypIndexOption = artTypIndexOption;
}
@XmlTransient
public Collection<ArticleTypeProjet> getArticleTypeProjetCollection()
{
return articleTypeProjetCollection;
}
public void setArticleTypeProjetCollection(Collection<ArticleTypeProjet> articleTypeProjetCollection)
{
this.articleTypeProjetCollection = articleTypeProjetCollection;
}
@XmlTransient
public Collection<ArticleTypeVarianteOption> getArticleTypeVarianteOptionCollection()
{
return articleTypeVarianteOptionCollection;
}
public void setArticleTypeVarianteOptionCollection(Collection<ArticleTypeVarianteOption> articleTypeVarianteOptionCollection)
{
this.articleTypeVarianteOptionCollection = articleTypeVarianteOptionCollection;
}
// @XmlTransient
public Collection<ArticleTypeParentChild> getArticleTypeParentChildCollection()
{
return articleTypeChildCollection;
}
public void setArticleTypeParentChildCollection(Collection<ArticleTypeParentChild> articleTypeParentChildCollection)
{
this.articleTypeChildCollection = articleTypeParentChildCollection;
}
// @XmlTransient
public Collection<ArticleTypeParentChild> getArticleTypeParentChildCollection1()
{
return articleTypeParentCollection;
}
public void setArticleTypeParentChildCollection1(Collection<ArticleTypeParentChild> articleTypeParentChildCollection1)
{
this.articleTypeParentCollection = articleTypeParentChildCollection1;
}
@XmlTransient
public Collection<ArticleTypeOption> getArticleTypeOptionCollection()
{
return articleTypeOptionCollection;
}
public void setArticleTypeOptionCollection(Collection<ArticleTypeOption> articleTypeOptionCollection)
{
this.articleTypeOptionCollection = articleTypeOptionCollection;
}
@XmlTransient
public Collection<Localisation> getLocalisationCollection()
{
return localisationCollection;
}
public void setLocalisationCollection(Collection<Localisation> localisationCollection)
{
this.localisationCollection = localisationCollection;
}
@XmlTransient
public Collection<ArticleTypeLocalisation> getArticleTypeLocalisationCollection()
{
return articleTypeLocalisationCollection;
}
public void setArticleTypeLocalisationCollection(Collection<ArticleTypeLocalisation> articleTypeLocalisationCollection)
{
this.articleTypeLocalisationCollection = articleTypeLocalisationCollection;
}
}