エラー: によって引き起こさ:org.hibernate.AnnotationException:com.xxx.data.dao.classes.Categories.categoriesLang、未知の参照プロパティ:不明なmappedBy com.xxx .data.dao.classes.superclasses.CategoriesLang.categories@MappedSuperclass:不明なmappedBy
マイセットアップ:
にHibernate 3.5.6
public interface CategoriesLangInt {
int id_categories = 0;
Categories categories = null;
String name = "";
String description = "";
int getId_categories();
void setId_categories(int id_categories);
Categories getCategories();
void setCategories(Categories categories);
String getName();
void setName(String name);
String getDescription();
void setDescription(String description);
}
@MappedSuperclass
public abstract class CategoriesLang implements CategoriesLangInt {
@Id
@Column(name = "id_categories")
private int id_categories = 0;
@OneToOne
@JoinColumn(name = "id_categories")
private Categories categories;
@Size(max = 50)
private String name = "";
@Size(max = 350)
private String description = "";
@Override
public int getId_categories() {
return id_categories;
}
@Override
public void setId_categories(int id_categories) {
this.id_categories = id_categories;
}
@Override
public Categories getCategories() {
return categories;
}
@Override
public void setCategories(Categories categories) {
this.categories = categories;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getDescription() {
return description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
}
@Entity
@Table(name="categories")
public class Categories implements Serializable {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id_categories;
private boolean active;
@OneToOne(mappedBy="categories")
private CategoriesLangInt categoriesLangInt;
public Integer getId_categories() {
return id_categories;
}
public void setId_categories(Integer id_categories) {
this.id_categories = id_categories;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public CategoriesLangInt getCategoriesLangInt() {
return categoriesLangInt;
}
public void setCategoriesLangInt(CategoriesLangInt categoriesLangInt) {
this.categoriesLangInt = categoriesLangInt;
}
}
UPDATEは、ITを解決しよう!私は成功し、最終的に研究を行って、長い時間の後
。それはうまく動作します!
@Entity
@Table(name="categories")
public class Category implements Serializable {
private Integer id;
private boolean active;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
}
public interface CategoryInt{
int getCategory_id();
void setCategory_id(int category_id);
String getName();
void setName(String name);
String getDescription();
void setDescription(String description);
void setCategory(Category category);
Category getCategory();
}
@MappedSuperclass
public abstract class CategoryLang implements CategoryInt{
private int category_id;
private String name;
private String description;
private Category category;
@Override
@Id
public int getCategory_id() {
return category_id;
}
@Override
public void setCategory_id(int category_id) {
this.category_id = category_id;
}
@Override
@Size(max = 50)
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
@Size(max = 350)
public String getDescription() {
return description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@Override
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
public Category getCategory() {
return category;
}
@Override
public void setCategory(Category category) {
this.category = category;
}
}
@Entity
@Table(name = "en_categories")
public class CategoryEN extends CategoryLang implements Serializable {}
@Entity
@Table(name = "es_categories")
public class CategoryES extends CategoryLang implements Serializable {}
非常Nizet、ありがとうございました。 – Dani