-->
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: Error in SQL generation when mapping a many-to-one key
PostPosted: Tue Jun 14, 2005 3:04 pm 
Newbie

Joined: Thu Nov 25, 2004 12:28 pm
Posts: 2
I have a mapping of a composite-id with two columns.

Class 1:

<hibernate-mapping>
<class
name="br.gov.mpdft.consultafeitos.negocio.bo.ProcessoBO"
table="PROC_DADOS"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version">

<composite-id>
<key-property name="numero" column="nr_proc" type="java.lang.String" length="15" />
<key-property name="origem" column="origem" type="java.lang.String" length="15" />
</composite-id>


<property
name="inquerito"
type="java.lang.String"
update="true"
insert="true"
access="property"
>
<column
name="nr_inq"
length="3"
not-null="true"
sql-type="char"
/>
</property>

<property
name="tombo"
type="java.lang.String"
update="true"
insert="true"
access="property">
<column
name="nr_tombo"
length="15"
not-null="true"
sql-type="char" />
</property>

</class>

</hibernate-mapping>

Class 2:

<hibernate-mapping
>
<class
name="br.gov.mpdft.consultafeitos.negocio.bo.EnvolvidoBO"
table="Envolvido"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>

<composite-id>
<key-property name="nome" column="nm_envolv" type="java.lang.String" length="50" />
<key-many-to-one name="processo" class="br.gov.mpdft.consultafeitos.negocio.bo.ProcessoBO">
<column name="nr_proc" />
<column name="origem" />
</key-many-to-one>
</composite-id>

<many-to-one
name="tipoEnvolvido"
class="br.gov.mpdft.consultafeitos.negocio.bo.TipoEnvolvidoBO"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
>
<column
name="cd_tp_envolv"
not-null="true"
sql-type="char"
/>
</many-to-one>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-EnvolvidoBO.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

The problem is: when I try to make a select in class EnvolvidoBO, the generate SQL (for SQL Server) is incorrect:

select count(*) as col_0_0_ from Envolvido envolvidob0_, PROC_DADOS processobo1_ where (envolvidob0_.nr_proc, envolvidob0_.origem)=processobo1_.nr_proc and processobo1_.st_sigiloso='N' and (envolvidob0_.nm_envolv like '%deniz valentim franco%')

Does anybody know the possible cause and how to solve this problem.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 7:44 pm 
Beginner
Beginner

Joined: Mon Jun 13, 2005 5:52 pm
Posts: 43
http://forum.hibernate.org/viewtopic.php?t=943726


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.