-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Is setter-access and field-access mixable?
PostPosted: Tue Dec 23, 2008 7:00 am 
Newbie

Joined: Tue Aug 19, 2008 9:30 am
Posts: 10
I'd normaly prefer field access but page 564 of "Java Persistence with Hibernate" states that this is not such a good idea for the identifier property:
Quote:
As long as you access only the database identifier property, no
initialization of the proxy is necessary. (Note that this isn’t true if you map the
identifier property with direct field access; Hibernate then doesn’t even know that
the getId() method exists. If you call it, the proxy has to be initialized.)

But on page 70 it's written that
Quote:
If you placed the @Id annotation
on the getId() method, you’d enable access to properties through getter and setter
methods by default. Hence, all other annotations are also placed on either
fields or getter methods, following the selected strategy.

What me bothers is the "all other annotations are also placed" part? Is this only the default behaviour or cann't i mix setter-access and field access at all?

/Stephan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.