wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Property versus Field based Persistence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Property versus Field based Persistence" Watch "Property versus Field based Persistence" New topic
Author

Property versus Field based Persistence

Akhil Maharaj
Ranch Hand

Joined: Sep 29, 2007
Posts: 63
All ,


Reference : EJB3.0 in action (Manning)

I am trying to understand the follwoing line



Annotations used with a setter method are ignored by the persistence provider for property-based access.


Any ideas ?

I under stand that the foolowing code also from the same book is Property based persistence

Sergio Tridente
Ranch Hand

Joined: Mar 22, 2007
Posts: 329

Originally posted by Akhil Maharaj:

I am trying to understand the follwoing line

� Annotations used with a setter method are ignored by the persistence provider for property-based access. �



Annotations should be applied to the getter methods when using property-based access. If you apply an annotation to a setter method, the annotation is ignored by the persistence provider.


Originally posted by Akhil Maharaj:

I understand that the foolowing code also from the same book is Property based persistence



Your code is using field-based access. Note that the @Id annotation (the only required annotation) is used on a field and not on a getter method of a property.
[ October 08, 2008: Message edited by: Sergio Tridente ]

SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

Akhil,

I think Sergio cleared your doubt. I was in same confusion when i started that chapter but if you just turn few pages you will understand that concept.
if you still have doubt do post here i will try to clear.

Regards,
Sudhakar


Regards
Sudhakar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Property versus Field based Persistence
 
Similar Threads
Second level cache does not work
Entity and set/get methods
JPA's context injection with Hibernate as engine
JPA/Hibernate: @GeneratedValue doesnt work
3 - level folder display in struts