-->
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.  [ 4 posts ] 
Author Message
 Post subject: hbm2java tool is getting me angry:lowercase and uppercase
PostPosted: Thu Sep 16, 2004 6:43 am 
Newbie

Joined: Mon Aug 23, 2004 9:23 am
Posts: 12
Hibernate version: 2.0

I just write to tell that hbm2java has some features that in my opinion shouldn't exists. It is just my opinion but maybe more people had the same problem I have. I speak about uppercase and lowercase characters. My fields' names has got uppercase and lowercase letters as well, and Middlegen works fine and doesn't change them. I like the names of my tables' fields. But hbm2java usually changes them and I don't know who can find it useful. I can understand that the first letter of a class' name have to be uppercase but I would like the rest of the name with the same format. It happens with singular and plural forms as well. Even I had a table field called "aB" and after using hbm2java, the class field is just "a".
Sorry for my complaint but it is quite important for me.
Thanks and kind regards,
Jose Luis


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 8:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hbm2java does what hibernate expects from a property name - namely that it obeys the JavaBean spec for properties.

But anyway - show an example of what you don't like and then show me what you do like and that it still works! ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 8:47 am 
Newbie

Joined: Mon Aug 23, 2004 9:23 am
Posts: 12
Hello,
Sorry, I have solved it now.
What I do is use Strings to find classes' methods and fields and invoke or use them during runtime.
So suppose I have a field called "VVVpVV". When I tried to find a method called for example "getVVVpVV" what I found was what hbm2java had generated: "getVvvpVv" so I wasn't able to find the method using its name. I just want you to know that I didn't know why it was implemented in this way but if you say that it follows some kind of spec, well, I have nothing else to say.
I have had to implement a Strings filter to obtain the correct name:
The field name has to follow these rules:

-the first and second letters are always lowercase
-when the previous letter from an uppercase letter is uppercase too, this second letter becomes lowercase, else it remains uppercase.

I think that is enough.
Thanks for your answer and sorry,
Jose Luis


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 16, 2004 9:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Yes.

look at java.beans.Introspector.decapitalize and
net.sf.hibernate.tools.hbm2java.FieldPropert.beanDecapitalize

and remember that a field and a property is TWO different things!

_________________
Max
Don't forget to rate


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