-->
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.  [ 6 posts ] 
Author Message
 Post subject: referencing primary key in inherited subclass
PostPosted: Wed Jan 14, 2004 5:24 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
<joined-subclass name="Productos.Producto" table="T_Producto">
<key column="P_IdProducto"/>
<property name="IdProducto" column="P_IdProducto" type="int"/>
<many-to-one name="organizacion" class="Common.Organizacion" column="F_IdOrganizacion"/>
<bag name="suplementos" lazy="false" cascade="all" inverse="true">
<key column="F_IdProducto" />
<one-to-many class="Productos.Suplemento"/>
</bag>
</joined-subclass>

How do i refer from the code P_idproducto,the property idproducto throws me an excpetion and in the key tag i cannot insert the name property.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 5:28 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've never try with 'key' column, but the following should work
Code:
<property name="IdProducto" column="P_IdProducto" type="int" update="false" insert="false"/>

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2004 5:36 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
<property name="IdProducto" column="P_IdProducto" type="int" update="false" insert="false"/>

Always returns zero ,any idea?.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 3:08 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
getter / setter broken

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 12:15 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
What do you mean by "getter / setter broken".
The getters and setter are correct, ve already check them.
I need the primary key for using it in the following sentence:
losSuplementos = GuiSGP.session.find("from Suplemento where F_IdProducto ="+ idProducto
+ " and A_Habilitado =" + 1 + " and A_BajaLogica =" + 0);

Where id producto is the primary key ,Does exist a alternative way to do this?.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 1:41 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Eh! the pk is mapped in the super class, so use it.

_________________
Emmanuel


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