-->
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.  [ 2 posts ] 
Author Message
 Post subject: Odd Component Behavior
PostPosted: Fri Sep 19, 2003 6:07 pm 
Newbie

Joined: Tue Sep 16, 2003 7:05 pm
Posts: 3
Location: Los Angeles, CA
OK, this is weird. I have:

Code:
class A
{
  int    foo;
  int    bar;
  B     bletch;

  // Getters and setters here
}

class B
{
  StringBuffer    quux;

  public String getQuux()
  {
    return quux.toString();
  }

  public void setQuux(String quux)
  {
    this.quux.replace(0, this.quux.length(), quux);
  }
}


and an A table that has a varchar "baz" column.

In my A mapping, I have:

...
<component name="bletch" class="B">
<property name="quux" column="baz" type="string"/>
</component>
...

This gets me:

net.sf.hibernate.PropertyNotFoundException: Could not find a getter for bletch in class B

Which is weird, because I thought the whole point was to say that bletch is-a B, not B implements bletch as a property.

This is using Hibernate 2.0.3, by the way.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 19, 2003 10:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You understand it correctly:

Code:
<class name="A" ...>
    <component name="bletch" class="B">
        <property name="quux" column="baz" type="string"/>
    </component>
</class>


Says that class 'A' has a property named 'bletch', which is of type 'B'. Post your whole mapping so we can take a look.

For example, I have a Person class mapped as:
Code:
<class name="Person" ...>
    ...
    <component name="name" class="Name">
        <property name="salutation" column="salutation" />
        <property name="firstName" column="first_name" />
        <property name="familiarName" column="familiar_name" />
        <property name="middleName" column="mid_name" />
        <property name="lastName" column="last_name" />
        <property name="suffix" column="suffix" />
    </component>
</class>

Where person has a property named 'name'. It works...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.