-->
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.  [ 7 posts ] 
Author Message
 Post subject: Annotations only recognized on getters, not setters
PostPosted: Fri Feb 03, 2006 11:49 am 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Hibernate version:
Hibernate 3.1.1, Annotations 3.1B8

I recently put a @Id annotation on the setter half of a getter/setter pair of methods defining a property, and it was ignored. Moving the annotation to the getter method worked. I was using "property" style annotations, not "field".

I didn't see anything in the persistence or Java Beans specs that gave priority to the getter side, so I'm thinking this might be an annotations bug, but wanted to check before filing with Jira.
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 05, 2006 6:45 am 
Beginner
Beginner

Joined: Wed Aug 24, 2005 5:32 am
Posts: 23
The Pulic Final Draft does say that the annotation should be set on the getters:

section 2.1.1
Quote:
"If the entity has property-based access, the persistence provider runtime accesses persistent
state via the property accessor methods. All properties not annotated with the Transient
annotation are persistent. The property accessor methods must be public or protected. When
property-based access is used, the object/relational mapping annotations for the entity class
annotate the getter property accessors."



Eyal Lupu


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 05, 2006 8:52 am 
Newbie

Joined: Fri Jan 27, 2006 10:48 am
Posts: 2
eyall wrote:
The Pulic Final Draft does say that the annotation should be set on the getters:


BTW, can anybody point me on this draft, especially on source of ejb3-persistance.jar? I can not find source for this jar in Hibernate distributive. I understand, that it is not part of Hibernate, but my naive google request did not hlp me in searching of sources.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 3:24 am 
Beginner
Beginner

Joined: Wed Aug 24, 2005 5:32 am
Posts: 23
Hi,
You can find the spec's draft at the JCP site, the sources are at GlassFish project. This is the CVSView root of the annotations subtree:
https://glassfish.dev.java.net/source/browse/glassfish/persistence-api/src/java/#dirlist

Eyal Lupu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 4:05 am 
Newbie

Joined: Thu Dec 22, 2005 4:09 am
Posts: 8
Thank you. Not so easy as just downlodable zip with sources, but at least I can see JavaDoc comments now.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 11:14 am 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Thanks Eyal, you've better eyes than I.
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 2:03 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The one I use are in the hibernate CVS in HibernateExt/ejb-api
I usually catch up faster than Sun

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.