-->
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: Malformed query in one-to-may relationship +inheritance
PostPosted: Fri Oct 02, 2009 12:47 am 
Newbie

Joined: Fri Oct 02, 2009 12:31 am
Posts: 2
I'm getting a malformed query when getting the relationaship 'asegurados' with the following configuration:

<hibernate-mapping package="com.metlife.mimet.emisiongmmi.entity">
<class name="Solicitud" table="SOLICITUD" schema="EMISION_WEB">
<id name="id" type="int">
<column name="ID_SOLICITUD" />
<generator class="native" />
</id>
<set name="asegurados" table="ASEGURADO" lazy="false" cascade="all-delete-orphan">
<key column="ID_SOLICITUD" />
<one-to-many class="Asegurado" />
</set>
</class>
</hibernate-mapping>

'Asegurado' class is an inherited one...
<hibernate-mapping package="com.metlife.mimet.emisiongmmi.entity" schema="PERSONA">
<class name="Persona" table="PERSONA" abstract="true">
<id name="id" type="int">
<column name="ID_PERSONA" />
<generator class="identity" />
</id>
<discriminator column="TIPO_PERSONA" type="string"/>
<subclass name="PersonaFisica" discriminator-value="FISICA" abstract="true">
<join table="FISICA" inverse="true">
<key column="ID_PERSONA"/>
<property name="curp" type="string">
<column name="CURP" length="18" not-null="true" />
</property>
</join>
<subclass name="Asegurado" discriminator-value="FISICA" >
<join table="ASEGURADO" schema="EMISION_WEB" inverse="true">
<key column="ID_ASEGURADO" />
<property name="fechaNacimiento" type="date">
<column name="FECHA_NACIMIENTO" length="10" />
</property>
</join>
</subclass>
</subclass>

</class>
</hibernate-mapping>

So, hibernate is looking for my KEY column in the first class of the inheritance tree:
select ...
from PERSONA asegurados0_
inner join FISICA asegurados0_1_ ...
inner join ASEGURADO asegurados0_2_ ...
where asegurados0_.ID_SOLICITUD=?

ID_SOLICITUD IS NOT IN PERSONA, IS IN ASEGURADO TABLE.

The question is: How can I tell to hibernate where to look for that column?

THAKS IN ADVANCE!

TMM


Top
 Profile  
 
 Post subject: Re: Malformed query in one-to-may relationship +inheritance
PostPosted: Fri Oct 02, 2009 11:44 am 
Newbie

Joined: Fri Oct 02, 2009 12:31 am
Posts: 2
solve.

only change <subclass to <joined-subclass


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.