-->
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: Aplha hbm2java problem with properties Names
PostPosted: Mon May 23, 2005 5:54 pm 
Regular
Regular

Joined: Mon Jun 14, 2004 1:42 pm
Posts: 80
Location: Brazil
Hibernate version:
3.0.3
Mapping documents:
Code:
...
      <property
         name="eMail"
         column="eMail"

         type="string"
         not-null="true"
        >
      </property>
...

Full stack trace of any exception that occurs:
18:44:16,234 ERROR [STDERR] org.hibernate.PropertyNotFoundException: Could not find a getter for eMail in class suporte.Contato
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:213)
problem
the cvs version is generating the class code as:
Code:
    public String getEMail() {
        return this.eMail;
    }
   
    public void setEMail(String eMail) {
        this.eMail = eMail;
    }

But it can't be found by hibernate, becouse it doesn't follow an obscure catch in the java beans specification, that a property that has the first letter lowercase and the second letter uppercase should have set/get methods starting by lowercase too.
So I just rewrite my class with geteMail instead of getEMail ...
Code:
    public String geteMail() {
        return this.eMail;
    }
   
    public void seteMail(String eMail) {
        this.eMail = eMail;
    }


Them all works. If I'm right, I can fill a bug request :)
Thanks

_________________
Alexandre Torres
--------------------


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 8:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It is a known issue but file the request so it is not forgotten.


Top
 Profile  
 
 Post subject: Should be flexible
PostPosted: Thu Jun 16, 2005 1:37 pm 
Beginner
Beginner

Joined: Wed Jun 15, 2005 7:14 pm
Posts: 28
It seems like the naming convention should be flexible to both. I think the only downside is that if it is flexible, then you couldn't have a property called eMail and EMail, which is bad programming practice anyway.
I just worked through a middlegen problem with this. Middlegen just uses the convention not the exception, so the eMail getter would be getEMail, which hibernate has a problem with. So I have to hand-change the generated Java class created by hbm2java each time... not a big deal, but it would be nice for it to be flexible.


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.