-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem with two classes mapped to the same table
PostPosted: Wed Feb 07, 2007 7:18 am 
Newbie

Joined: Wed Feb 07, 2007 7:09 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1.3

I have two classes:

First class:

<hibernate-mapping>
<class name="serito.model.DaConsultaFmto" table="DA_FORMATO" discriminator-value="268">
<id name="idFormato" type="long" column="ID_FORMATO">
<generator class="identity"/>
</id>
<discriminator column="ID_ENTIDAD_DISENO" type="integer"/>
<property name="ubEntorno" type="elmonte.aej.hibernate.TrimmedStringType" column="UB_ENTORNO"/>
<property name="idObjetoNegocio" type="long" column="ID_OBJETO_NEGOCIO"/>
<property name="FCreacion" type="date" column="F_CREACION"/>
<property name="FVigencia" type="date" column="F_VIGENCIA"/>
<property name="fechaFin" type="date" column="FECHA_FIN"/>
<property name="estado" type="elmonte.aej.hibernate.TrimmedStringType" column="ESTADO"/>
<property name="idSuceso" type="long" column="ID_SUCESO"/>
</class>
</hibernate-mapping>


Second class:

<hibernate-mapping>
<class name="serito.model.DaEntidadFmto" table="DA_FORMATO" discriminator-value="131">
<id name="idFormato" type="long" column="ID_FORMATO">
<generator class="identity"/>
</id>
<discriminator column="ID_ENTIDAD_DISENO" type="integer"/>
<property name="ubEntorno" type="elmonte.aej.hibernate.TrimmedStringType" column="UB_ENTORNO"/>
<property name="idObjetoNegocio" type="long" column="ID_OBJETO_NEGOCIO"/>
<property name="FCreacion" type="date" column="F_CREACION"/>
<property name="FVigencia" type="date" column="F_VIGENCIA"/>
<property name="fechaFin" type="date" column="FECHA_FIN"/>
<property name="estado" type="elmonte.aej.hibernate.TrimmedStringType" column="ESTADO"/>
<property name="idSuceso" type="long" column="ID_SUCESO"/>
</class>
</hibernate-mapping>

The two classes are mapped to the same table, with a discriminator value.
The values are insert corecctly but when i get values with "from DaEntidadFmto" or with criteria i get ALL the values from the table. With discriminator 268 and 131.
I tried with polymorphism="explicit" but i get the same result.

Is there a solution other than create a filter?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.