-->
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: how to access parent's properties from joined-subclass
PostPosted: Tue May 10, 2005 8:34 am 
Newbie

Joined: Sun Apr 17, 2005 2:40 pm
Posts: 2
Location: the Netherlands
Hibernate version: 2.1.8

Mapping documents:

<class
name="Partij"
proxy="PartijProxy"
table="Partij"
>
<id
column="PartijID"
name="partijID"
type="integer"
>
<generator class="identity" />
</id>

<property
column="PartijNaam"
length="50"
name="partijNaam"
not-null="true"
type="string"
/>


<joined-subclass
name="User"
proxy="UserProxy"
table="Users"
>
<key column="PartijID"/>

<property
column="UserLogin"
length="50"
name="userLogin"
not-null="true"
type="java.lang.String"
/>
<property
column="UserPassword"
length="50"
name="userPassword"
not-null="true"
type="java.lang.String"
/>

</joined-subclass>
</class>


I have successfully used HibernateSynchronizer to generate lots of my applications classes. However in this particular case I can not get it right. I keep getting errors about partijNaam (the property in 'Partij') not being assigned a value. There are however no get and set methods available in 'User' for this property.

How can I model my 'User' object or change my hbm so that a user can be succesfully saved and updated by Hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 11:29 am 
Senior
Senior

Joined: Tue Feb 08, 2005 5:26 pm
Posts: 157
Location: Montréal, Québec - Canada
You could set the access="field" on this property, then you would not need a getter or a setter for this property.

But, if User inherits from Partij, then how come it does not have the getters-setter?

It is because they are private on Partij, or because User does not inherit from Partij?

_________________
Vincent Giguère
J2EE Developer


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 10, 2005 3:41 pm 
Newbie

Joined: Sun Apr 17, 2005 2:40 pm
Posts: 2
Location: the Netherlands
It does not have the setters and getters because HibernateSynchronizer did not add them and I was relying on HibernateSynchronizer to generate all of the objects for me. But your suggestion just made realize what is wrong. I missed the obvious: the User class should extend the Partij class.... inheritance, duh! Thanks a lot, sometimes the solution is just too easy to see.


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.