This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello Nimo, it depends on how the JPA Implementation access the properties if it is defined to access via a setter/getter then you should add them, otherwise it will access the properties with reflection.
In your example you should add the setter and getter because your composite id it's not generated or you will have to also use reflection to change it's value
Joined: Jun 28, 2008
I use hibernate and found out, that I do not need to have getter/setter for my EmbeddedID (all works fine).
However, for all my other fields I have getter/setter and annotate the @Column to my getter (instead of field-annotation).
I have a minor question, I do not know, when do I need to instantiate an Object in my Entity-Bean(do I have to? should I?)