[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4233?page=c...
]
Emmanuel Bernard commented on HHH-4233:
---------------------------------------
Again, this model is not sound and claiming we can support it would simply be fooling you.
It's not a bidirectional relationship it's some Frankenstein tri-directional
one.
I can write code that associates a Dog to a Person and get it loaded as a Cat. Java does
not support duck (or dog or cat) typing ;)
Try and represent your model with the bidirectional association (and not two different
associations) into UML and you will see you cannot.
cant bind a child using mappedby relating to a parent
attribute(polymorphism)
-----------------------------------------------------------------------------
Key: HHH-4233
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4233
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Environment: osx 10.4, java 1.5
Reporter: Nino Martinez
Attachments: JPA101.zip
This is pseudo class hieracy
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
Mammal
{
@ManyToOne
Person owner;
}
@Entity
Cat extends Mammal
Person{
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE,
CascadeType.REMOVE }, mappedBy = "owner")
private List<Cat> cats = new ArrayList<Cat>();
}
it gives the error mission property:
javax.persistence.PersistenceException: org.hibernate.AnnotationException: mappedBy
reference an unknown target entity property:
Cat.owner in Person.cats
This is the related thread on hibernate forum:
http://forum.hibernate.org/viewtopic.php?p=2380570#2380570
I can confirm that the same example does work when using OpenJPA as a provider. Please
see attached project for reference.
Please do not hesitate me if you have questions.
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira