-->
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.  [ 5 posts ] 
Author Message
 Post subject: where object is null??
PostPosted: Fri May 21, 2004 6:33 pm 
Beginner
Beginner

Joined: Mon Jan 12, 2004 3:39 pm
Posts: 23
Hi,


i tried to execute a HQL select where object o has a relationship with object x and I nedd to get all o objects with x == null s I ddi

select o from Object where o.x is null

but I got an exception

How can I do this?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 21, 2004 7:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Would be really helpful to probably tell us the exception message and stacktrace?


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 10:56 am 
Beginner
Beginner

Joined: Mon Jan 12, 2004 3:39 pm
Posts: 23
(net.sf.hibernate.QueryException) net.sf.hibernate.QueryException: path expression ends in a composite value: eventosini0_.eventoSinistroApolice [SELECT distinct o FROM fenaseg.rns.bo.EventoSinistroApolice as o WHERE 1=1 and o.eventoSinistroApolice is null ]


the object EventoSinistroApolice has a relationship with itself . This was created so we could trace all of its updates. What I'm trying to do is select the last inserted object wich is the one pointing to "null".


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 11:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Show your mapping


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 22, 2004 1:20 pm 
Beginner
Beginner

Joined: Mon Jan 12, 2004 3:39 pm
Posts: 23
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="fenaseg.rns.bo.EventoSinistroApolice"
table="EVENTO_SINISTRO_APOLICE"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="EVENTO_SINISTRO_APOLICE"
</meta>

<composite-id>
<meta attribute="class-description" inherit="false">
@hibernate.id
generator-class="assigned"
</meta>
<key-property
name="idEvento"
column="ID_EVENTO"
type="java.lang.Integer"
length="6"
>
<meta attribute="field-description">
@hibernate.property
column="ID_EVENTO"
length="6"
</meta>
</key-property>
<!-- bi-directional many-to-one association to ContratoSeguroVeiculo -->
<key-many-to-one
name="contratoSeguroVeiculo"
class="fenaseg.rns.bo.ContratoSeguroVeiculo"
>
<meta attribute="field-description">
@hibernate.many-to-one
column="FK_ID_CONTRATO_VEICULO_EVENTO""
</meta>
<meta attribute="field-description">
@hibernate.many-to-one
column="FK_ID_SEGURADORA_CONTRATO""
</meta>
<column name="FK_ID_CONTRATO_VEICULO_EVENTO" />
<column name="FK_ID_SEGURADORA_CONTRATO" />
</key-many-to-one>

</composite-id>

<property
name="dtOcorrencia"
type="java.sql.Timestamp"
column="DT_OCORRENCIA"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_OCORRENCIA"
length="7"
</meta>
</property>
<property
name="dtCadast"
type="java.sql.Timestamp"
column="DT_CADAST"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_CADAST"
length="7"
</meta>
</property>
<property
name="dtAviso"
type="java.sql.Timestamp"
column="DT_AVISO"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_AVISO"
length="7"
</meta>
</property>
<property
name="dtFechamentoEvento"
type="java.sql.Timestamp"
column="DT_FECHAMENTO_EVENTO"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_FECHAMENTO_EVENTO"
length="7"
</meta>
</property>
<property
name="dtCancel"
type="java.sql.Timestamp"
column="DT_CANCEL"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_CANCEL"
length="7"
</meta>
</property>
<property
name="stOrigem"
type="java.lang.String"
column="ST_ORIGEM"
not-null="true"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="ST_ORIGEM"
length="1"
not-null="true"
</meta>
</property>

<!-- associations -->
<!-- bi-directional one-to-many association to ItemSinistroVeiculo -->
<set
name="itemSinistroVeiculos"
lazy="false"
inverse="true"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"

@hibernate.collection-key
column="FK_ID_EVENTO_VEICULO"
@hibernate.collection-key
column="FK_ID_CONTRATO_VEICULO_EVENTO"
@hibernate.collection-key
column="FK_ID_SEGURADORA_CONTRATO"
@hibernate.collection-one-to-many
class="fenaseg.rns.bo.ItemSinistroVeiculo"
</meta>
<key>
<column name="FK_ID_EVENTO_VEICULO" />
<column name="FK_ID_CONTRATO_VEICULO_EVENTO" />
<column name="FK_ID_SEGURADORA_CONTRATO" />
</key>
<one-to-many
class="fenaseg.rns.bo.ItemSinistroVeiculo"
/>
</set>
<!-- uni-directional one-to-one association to EventoSinistroApolice -->
<many-to-one
name="eventoSinistroApolice"
class="fenaseg.rns.bo.EventoSinistroApolice"
>
<meta attribute="field-description">
@hibernate.many-to-one
@hibernate.column name="FK_ID_EVENTO_ALT"
@hibernate.column name="FK_ID_CONTRATO_VEIC_EV_ALT"
@hibernate.column name="FK_ID_SEGURADORA_CTO_EV_ALT"
</meta>
<column name="FK_ID_EVENTO_ALT" />
<column name="FK_ID_CONTRATO_VEIC_EV_ALT" />
<column name="FK_ID_SEGURADORA_CTO_EV_ALT" />
</many-to-one>
<!-- bi-directional many-to-one association to Operador -->
<many-to-one
name="operador"
class="fenaseg.rns.bo.Operador"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_OPERADOR"
@hibernate.column name="FK_ID_SEGURADORA_OPERADOR"
</meta>
<column name="FK_ID_OPERADOR" />
<column name="FK_ID_SEGURADORA_OPERADOR" />
</many-to-one>
<!-- bi-directional many-to-one association to ItemContratoFrota -->
<many-to-one
name="itemContratoFrota"
class="fenaseg.rns.bo.ItemContratoFrota"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_ITEM_CONTRATO_FROTA"
@hibernate.column name="FK_ID_CONTRATO_FROTA"
@hibernate.column name="FK_ID_SEGURADORA_CTO_FROTA"
@hibernate.column name="FK_ID_VEICULO_FROTA"
</meta>
<column name="FK_ID_ITEM_CONTRATO_FROTA" />
<column name="FK_ID_CONTRATO_FROTA" />
<column name="FK_ID_SEGURADORA_CTO_FROTA" />
<column name="FK_ID_VEICULO_FROTA" />
</many-to-one>

<joined-subclass name="fenaseg.rns.bo.LocalEvento" table="LOCAL_EVENTO">
<key>
<column name="FK_ID_EVENTO" />
<column name="FK_ID_CONTRATO_VEICULO_EVENTO" />
<column name="FK_ID_SEGURADORA_CONTRATO" />
</key>
<property
name="nuCep"
type="java.lang.Integer"
column="NU_CEP"
length="9"
>
<meta attribute="field-description">
@hibernate.property
column="NU_CEP"
length="9"
</meta>
</property>
<property
name="dtBoletimOcorrencia"
type="java.sql.Timestamp"
column="DT_BOLETIM_OCORRENCIA"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="DT_BOLETIM_OCORRENCIA"
length="7"
</meta>
</property>
<property
name="stOrigemLocalEvento"
type="java.lang.String"
column="ST_ORIGEM"
not-null="true"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="ST_ORIGEM"
length="1"
not-null="true"
</meta>
</property>

<!-- associations -->
<!-- bi-directional many-to-one association to Delegacia -->
<many-to-one
name="delegacia"
class="fenaseg.rns.bo.Delegacia"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_DELEGACIA"
</meta>
<column name="FK_ID_DELEGACIA" />
</many-to-one>
<!-- bi-directional many-to-one association to Municipio -->
<many-to-one
name="municipio"
class="fenaseg.rns.bo.Municipio"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_MUNICIPIO"
@hibernate.column name="FK_ID_UF_MUNICIPIO"
</meta>
<column name="FK_ID_MUNICIPIO" />
<column name="FK_ID_UF_MUNICIPIO" />
</many-to-one>
<!-- bi-directional many-to-one association to TipoLocal -->
<many-to-one
name="tipoLocal"
class="fenaseg.rns.bo.TipoLocal"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_TP_LOCAL"
</meta>
<column name="FK_ID_TP_LOCAL" />
</many-to-one>
<!-- bi-directional many-to-one association to UF -->
<many-to-one
name="uf"
class="fenaseg.rns.bo.Uf"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="FK_ID_UF"
</meta>
<column name="FK_ID_UF" />
</many-to-one>

</joined-subclass>

</class>
</hibernate-mapping>


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