[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4233) cant bind a child using mappedby relating to a parent attribute(polymorphism)

Nicholas Stuart (JIRA) noreply at atlassian.com
Thu Mar 18 10:20:32 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35877#action_35877 ] 

Nicholas Stuart commented on HHH-4233:
--------------------------------------

Emmanuel can you please describe why this is 'bad'. You keep saying that here, and in another ticket about this same issue. I've searched and can't find your ever present 'reason' for not wanting this.

ANN-558 for reference, closed with no real explanation.

Forum post noted about with no real explanation. 
Another post with no explanation: https://forum.hibernate.org/viewtopic.php?p=2370576
A big long blog on how to work around this issue, but no explanation of why the issue exists: http://chriswongdevblog.blogspot.com/2009/10/polymorphic-one-to-many-relationships.html

And apparently as stated above OpenJPA works the expected way. If some kind of real reason can be given I would be happy to read and understand it but it would be great if this feature was available.

> 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.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list