Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7565387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:08:30+00:00 2026-05-30T14:08:30+00:00

Error: Caused by: org.hibernate.AnnotationException: Unknown mappedBy in: com.xxx.data.dao.classes.Categories.categoriesLang, referenced property unknown: com.xxx.data.dao.classes.superclasses.CategoriesLang.categories My setup:

  • 0

Error:
Caused by: org.hibernate.AnnotationException: Unknown mappedBy in: com.xxx.data.dao.classes.Categories.categoriesLang, referenced property unknown: com.xxx.data.dao.classes.superclasses.CategoriesLang.categories

My setup:

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 SOLVED IT!!!

After a long time doing research in the end I succeed. It works fine!

EER

@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 {}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:08:32+00:00Added an answer on May 30, 2026 at 2:08 pm

    First of all, an interface may not define fields, but only methods. The fields you have declared in the interface are in fact public static final constants.

    After, the Categories entity has a CategoriesLangInt field, but Hibernate has no way to know which entity this field represents, since there might be several entities implementing this interface. You must use the targetEntity attribute of the OneToOne annotation to tell Hibernate which entity is referenced.

    Finally, the id_categories column in CategoriesLang is mapped twice: once as an ID, and once as a JoinColumn. You must either remove the id_categories field and annotate the categories field with @Id, or leave id_categories field as it is and add the @MapsId annotation to categories.

    Side note: you should respect the Java naming conventions (no underscore in fields and methods), and rename Categories to Category, CategoriesLang to CategoryLang, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following error Caused by: org.hibernate.HibernateException: Wrong column type in TestTable for
I get a Caused by: org.hibernate.SessionException: Session is closed! error when I click on
I get an error: Caused by: java.lang.ClassNotFoundException: org.hibernate.annotations.common.reflection.ReflectionManager i'n pom.xml i have: <dependency> <groupId>org.hibernate</groupId>
I have some inherited code that uses hibernate. I'm getting the following error: Caused
how can i solve this exception? Exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with
I just spent half an one our to find out what caused the Error-Message
I'm having an error where I am not sure what caused it. Here is
I'm getting this error when trying to access my webservice running inside tomcat. Caused
When i run my spring junit test i got this error message : Caused
Im a newbie to hibernate and I'm facing an error while trying to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.