[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-558) @OneToMany(mappedBy="") can not recognize properties in parent classes

David Hay (JIRA) noreply at atlassian.com
Thu Jul 26 17:44:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27635 ] 

David Hay commented on ANN-558:
-------------------------------

Why is this a bad idea?  Is seems like it goes against the normal inheritance model of Java.  If the mappedBy property can't be found in the child class, but it's found in the parent class it should use that, especially if the inheritance strategy is single table.  Could you point me at some documentation that explains why such a mapping is a bad idea?  Thanks!

> @OneToMany(mappedBy="") can not recognize properties in parent classes
> ----------------------------------------------------------------------
>
>                 Key: ANN-558
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-558
>             Project: Hibernate Annotations
>          Issue Type: Bug
>          Components: binder
>    Affects Versions: 3.2.1
>            Reporter: Amir Pashazadeh
>
> @Entity
> @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
> public class A {
> @ManyToOne
> private B b;
> }
> @Entity
> @DiscriminatorValue("c")
> public class C extends A {
> }
> @Entity
> public class B {
> @OneToMany(mappedBy="b")
> private List<C> cs;
> }
> there would be an exception in this mapping, and it says that there is no such property found in C class (which is mapped by "b")
> ------
> by the way I'm not sure whether this is a Hibernate Annotations bug, or a Hibernate Core bug (I've not tested it without annotations).

-- 
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