hello dear community!
with my first post here, I'd like to outline a problem I'm trying to solve. I'm a hibernate beginner, so please tutor me a bit if I'm totally out :)
Error is:
Code:
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.my.model.entity.ItemPriceHistorySell.item references an unknown entity: com.my.model.entity.Item
at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:103)
at org.hibernate.cfg.AnnotationConfiguration.processEndOfQueue(AnnotationConfiguration.java:502)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:484)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:334)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1359)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:858)
let's have a look at the ItemPriceHistorySell class:
Code:
package com.my.model.entity;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@Entity
public class ItemPriceHistorySell extends ItemPriceHistory {
@ManyToOne
private Customer customer;
// accessors
}
and at the referenced Item class:
Code:
package com.my.model.entity;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class Item extends PersistentEntity {
private boolean enabled;
private String name;
private boolean is_catalog_item;
public Item() {
}
// accessors
}
I guess the problem lies in a fact, that this is an abstract class and thus is not "bound" by hibernate at it's startup directly. What should I do?
this is an example of how I subclass this Item:
Code:
package com.my.model.entity;
import java.util.List;
import javax.persistence.Entity;
@Entity
public class ItemSet extends Item {
@OneToMany
private List<Item> items;
public ItemSet() {
}
// accessors
}
edit: well, my first time here and a useless post... I forget to put the right @OneToMany mapping at the other side of this relation... sorry