-->
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: Problem mapping properties with certain names
PostPosted: Thu Jun 29, 2006 2:26 pm 
Newbie

Joined: Thu Jun 29, 2006 1:55 pm
Posts: 2
Location: Argentina
I'm having problems trying to map certain properties.
Having a class with a property named nChilds and public getter/setter:
Code:
public class Test {
    private int nChilds;
    ....
    public int getNChilds() { return nChilds; }
    public void setNChilds(int nChilds) { this.nChilds = nChilds; }
    ....
}


The property is mapped as:
Code:
    <property name="nChilds" not-null="true"/>


And I get the exception:
Code:
org.hibernate.PropertyNotFoundException: Could not find a getter for nChilds in class ar.com.itboss.Test


When I replace all occurrences of nChilds to other name, like numberChilds it works. It seems the problem is when the property name is composed of several words and the first one is only a letter long. Why can't I map a property named like this?

The hibernate version I'm using is 3.0.5.

_________________
Luis Parravicini


Top
 Profile  
 
 Post subject: Re: Problem mapping properties with certain names
PostPosted: Thu Jun 29, 2006 2:41 pm 
Regular
Regular

Joined: Wed Feb 22, 2006 11:28 am
Posts: 65
Location: Santiago, Chile
lparra wrote:
I'm having problems trying to map certain properties.
Having a class with a property named nChilds and public getter/setter:
Code:
public class Test {
    private int nChilds;
    ....
    public int getNChilds() { return nChilds; }
    public void setNChilds(int nChilds) { this.nChilds = nChilds; }
    ....
}


The property is mapped as:
Code:
    <property name="nChilds" not-null="true"/>


And I get the exception:
Code:
org.hibernate.PropertyNotFoundException: Could not find a getter for nChilds in class ar.com.itboss.Test


When I replace all occurrences of nChilds to other name, like numberChilds it works. It seems the problem is when the property name is composed of several words and the first one is only a letter long. Why can't I map a property named like this?

The hibernate version I'm using is 3.0.5.


You were right. I do same in my JUnit, and throw the same exception. I think that was a Bug of Hibernate, and i think we can report it to Hibernate Author.

_________________
If you called Wisdom, please help to all to solve theirs problems.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 1:21 pm 
Newbie

Joined: Thu Jun 29, 2006 1:55 pm
Posts: 2
Location: Argentina
I've created issue HHH-1874 for this. Thanks neketsushonen.

_________________
Luis Parravicini


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.