-->
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: many-to-one doesn't retrieve info from other tables
PostPosted: Mon Apr 11, 2005 11:43 am 
Newbie

Joined: Fri Mar 12, 2004 11:04 am
Posts: 10
3 tables : USERS, GROUPS, USERSGROUPS(relation many to one on the first two)

When I execute a query on USERGROUPS(see below) , I recieve data from USERGROUPS, USERS and GROUPS retrun fields values "null" for "String types" and "0" for "integer type".

Work's fine before with Hib 2.1, some extra info with Hib 3.0?

Remark: leazy=false (default)


------------------------------------------------
Hibernate version: 3.0

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="be.dzafer.models.Util_MOD" table="UTILISATEURS">
<id column="UTILISATEUR_USER_ID" name="util_i_id" type="integer">
<generator class="native"/>
</id>
<property column="UTILISATEUR_NOM" name="util_s_nom" type="string"/>
<property column="UTILISATEUR_FONCTION" name="util_s_fonc" type="string"/>
<property column="UTILISATEUR_CODE_SECTION_LABO"
name="util_s_codSecLab" type="string"/>
<property column="USERNAMECREATE" name="util_s_userNamCre" type="string"/>
<property column="DATETIMECREATE" name="util_c_datTimCre"/>
<property column="USERNAMEMODIFY" name="util_s_userNamMod" type="string"/>
<property column="DATETIMEMODIFY" name="util_c_datTimMod"/>
<property column="UTILISATEUR_LOGIN" name="util_s_login" type="string"/>
<property column="UTILISATEUR_PASSWORD" name="util_s_password" type="string"/>
</class>
<class name="be.dzafer.models.UtilG_MOD" table="UTIL_GROUPES">
<id column="UTILGRP_ID" name="utilg_i_id" type="integer">
<generator class="native"/>
</id>
<property column="UTILGRP_NAME" name="utilg_s_name" type="string"/>
<property column="UTILGRP_DESCRIPTION" name="utilg_s_desc" type="string"/>
</class>
<class name="be.dzafer.models.UtilUG_MOD" table="UTIL_UTILGRP">
<id column="UTILUG_ID" name="utilug_i_id" type="integer">
<generator class="native"/>
</id>
<many-to-one column="UTILUG_GRPID" name="utilG_MOD" class="be.dzafer.models.UtilG_MOD" not-null="false" />
<many-to-one column="UTILUG_USERID" name="util_MOD" class="be.dzafer.models.Util_MOD" not-null="false" />
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

query = session.createQuery("FROM UtilUG_MOD as ug " +
"WHERE ug.utilG_MOD = :p1 ");

query.setParameter("p1", Integer.valueOf(utilG_MOD.getUtilg_i_id()));
list = query.list();

Full stack trace of any exception that occurs: No errors!

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

The generated SQL (show_sql=true):

Hibernate: select utilg_mod0_.UTILGRP_ID as UTILGRP1_, utilg_mod0_.UTILGRP_NAME as UTILGRP2_1_, utilg_mod0_.UTILGRP_DESCRIPTION as UTILGRP3_1_ from UTIL_GROUPES utilg_mod0_ order by utilg_mod0_.UTILGRP_NAME

Hibernate: select utilg_mod0_.UTILGRP_ID as UTILGRP1_, utilg_mod0_.UTILGRP_NAME as UTILGRP2_1_, utilg_mod0_.UTILGRP_DESCRIPTION as UTILGRP3_1_ from UTIL_GROUPES utilg_mod0_ where (utilg_mod0_.UTILGRP_ID=?)

Hibernate: select utilug_mod0_.UTILUG_ID as UTILUG1_, utilug_mod0_.UTILUG_GRPID as UTILUG2_2_, utilug_mod0_.UTILUG_USERID as UTILUG3_2_ from UTIL_UTILGRP utilug_mod0_ where (utilug_mod0_.UTILUG_GRPID=?)

Hibernate: select utilg_mod0_.UTILGRP_ID as UTILGRP1_, utilg_mod0_.UTILGRP_NAME as UTILGRP2_1_, utilg_mod0_.UTILGRP_DESCRIPTION as UTILGRP3_1_ from UTIL_GROUPES utilg_mod0_ order by utilg_mod0_.UTILGRP_NAME


Debug level Hibernate log excerpt:


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.