-->
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: isXXX() versus getXXX() for boolean properties
PostPosted: Wed Dec 14, 2005 11:56 am 
Newbie

Joined: Fri Nov 25, 2005 8:36 am
Posts: 7
I have a problem with boolean properties.

When I persist a class with AccessType.PROPERTY having a method "boolean isXXX()", then Hibernate persists the XXX boolean field.

So far so good, but if don't wish this field to be persistent or want to annotate it somewhat, I am not able to place an annotation in front of the "isXXX()" method.
However, I can annotate the "boolean getXXX()" method (that is not supposed to exist BTW).

So I end up with two getters per boolean field : the isXXX() for Hibernate, and the getXXX() for annotating the Java code.

This is a little annoying to say the least, does anyone has a clue ? Thanks.

Robert


Top
 Profile  
 
 Post subject: Re: isXXX() versus getXXX() for boolean properties
PostPosted: Wed Dec 14, 2005 12:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
bobx24 wrote:
I am not able to place an annotation in front of the "isXXX()" method.


What do you mean?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 12:57 pm 
Newbie

Joined: Fri Nov 25, 2005 8:36 am
Posts: 7
I mean for instance that this annotation :
Code:
@Transient boolean isXXX() { return xxx; }

- can't be entered using the JSR220 Eclipse plugin
- if entered manually, is flagged as an error by the Eclipse compiler
Quote:
("Property 'isXXX' is note persistent: Name must follow getXXX pattern")

On the other hand, this one is accepted :
Code:
@Transient boolean getXXX() { return xxx; }


Robert


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 1:14 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Eclipse JSR-220 is buggy. Hibernate Annotations support @Transient in "is" getters.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 2:41 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
...and you should hopefully be able to enter what you want in the source code.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 4:26 am 
Newbie

Joined: Fri Nov 25, 2005 8:36 am
Posts: 7
Well, that's part of my problem : the Eclipse compiler won't compile "@Transient boolean isXXX()" even if it's manually entered.
May be the JSR220-ORM plugin "extended" the compiler in some way.
Robert


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 7:33 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This definitly should work. raise an issue in Eclipse issue tracking.

_________________
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.