-->
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: Error creating example with Id
PostPosted: Fri Mar 30, 2007 4:51 am 
Newbie

Joined: Fri Mar 30, 2007 4:46 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.2.0.cr4

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="[mypackage].Usuario" table="USUARIOS" lazy="false" >
<id name="idUsuario" column="IDUSUARIO" type="java.lang.String" />
<property name="apellido1" column="APELLIDO1" type="java.lang.String" />
<property name="apellido2" column="APELLIDO2" type="java.lang.String" />
<many-to-one name="centro" column="CODCENTRO" class="[mypackage].Centro" />
<property name="codPrograma" column="CODPROGRAMA" type="java.lang.Integer" />
<property name="extension" column="EXTENSION" type="java.lang.Integer" />
<property name="movil" column="MOVIL" type="java.lang.String" />
<property name="nombre" column="NOMBRE" type="java.lang.String" />
<property name="telefono" column="TELEFONO" type="java.lang.String" />
<property name="email" column="EMAIL" type="java.lang.String" />
</class>
</hibernate-mapping>

Name and version of the database you are using:
SQL Server 2005

The generated SQL (show_sql=true):

[STDOUT] Hibernate: select top 9 this_.IDUSUARIO as IDUSUARIO16_2_, this_.APELLIDO1 as APELLIDO2_16_2_, this_.APELLIDO2 as APELLIDO3_16_2_, this_.CODCENTRO as CODCENTRO16_2_, this_.CODPROGRAMA as CODPROGR5_16_2_, this_.EXTENSION as EXTENSION16_2_, this_.MOVIL as MOVIL16_2_, this_.NOMBRE as NOMBRE16_2_, this_.TELEFONO as TELEFONO16_2_, this_.EMAIL as EMAIL16_2_, centro2_.CODIGO as CODIGO4_0_, centro2_.NOMBRE as NOMBRE4_0_, centro2_.DOMICILIO as DOMICILIO4_0_, centro2_.CODBARRIO as CODBARRIO4_0_, centro2_.TELEFONO1 as TELEFONO5_4_0_, centro2_.TELEFONO2 as TELEFONO6_4_0_, centro2_.CODAGZONA as CODAGZONA4_0_, agenciazon3_.agenciazonaid as agenciaz1_0_1_, agenciazon3_.DENOMINACION as DENOMINA2_0_1_ from USUARIOS this_ left outer join CENTRO centro2_ on this_.CODCENTRO=centro2_.CODIGO left outer join AGENCIAZONA agenciazon3_ on centro2_.CODAGZONA=agenciazon3_.agenciazonaid where (1=1)

The problem was that when adding a criteria via Example.create( criterios ) that includes a value in the ID, Hibernate doesn´t include this value as a filter, and the SQL generated doesn´t have a where clause including this value.

Does anyone knows what is happend?


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.