-->
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.  [ 3 posts ] 
Author Message
 Post subject: Annotation on getter vs annotation on field
PostPosted: Tue May 29, 2007 7:18 am 
Newbie

Joined: Tue May 29, 2007 7:09 am
Posts: 2
Hi all,
In the (wonderfull) bauer book, when mapping association with component (p307). The book puts the annotation (CollectionOFElements, Parent ... for example) on the field. In my situation it's never works, annotation seem to be silently ignored.
But when I put them on the getter, it's all work.

Is it a typo / bug or should I investigate more deeply ?

I've used hibernate 3.2.1 (annotation etc ... 3.2.1) and also hibernate 3.2.4 ( .... ) conforming to the compatibility matrix with the same result.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 29, 2007 11:20 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It depends where you put the @Id annotation. If it's on a field, all others also go on fields. If it's on a getter method, all others have to be a getter method. If you download the source code for CaveatEmptor, you should find working examples of @CollectionOfElements.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 29, 2007 11:49 am 
Newbie

Joined: Tue May 29, 2007 7:09 am
Posts: 2
It's all Ok now Many thanks Christian.


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

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.