Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may be having issues related to the mixing of fields and methods in your annotations. For example, if you have an @Id annotation in your parent class BaseParent, then Hibernate will by default look at fields and not methods.</p> <p>So basically if you had something like this:</p> <pre><code>public class BaseParent { @Id private Integer id; protected List&lt;Child&gt; children; } public class Parent extends BaseParent { @ManyToOne public List&lt;Child&gt; getChildren() {super.getChildren();} } </code></pre> <p>Hibernate is going to have a problem determining the @ManyToOne annotation. Also, that would probably explain why adding the annotation to the field in the parent class made it work.</p> <p>On the same page that is mentioned above (<a href="http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/html_single/index.html#d0e253" rel="nofollow noreferrer">http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/html_single/index.html#d0e253</a>), there is also this paragraph:</p> <blockquote> <p>Depending on whether you annotate fields or methods, the access type used by Hibernate will be field or property. The EJB3 spec requires that you declare annotations on the element type that will be accessed, i.e. the getter method if you use property access, the field if you use field access. <strong>Mixing EJB3 annotations in both fields and methods should be avoided</strong>. Hibernate will guess the access type from the position of @Id or @EmbeddedId.</p> </blockquote> <p>So, to get it to work, you probably want to choose one or the other (field vs method) and be consistent. That way, you will not come across these "strange" hibernate issues.</p> <p>Anyways, hope that is helpful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload