-->
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: Retrieval problems with hibernate 2.1
PostPosted: Tue Aug 09, 2005 11:21 am 
Newbie

Joined: Tue Aug 09, 2005 10:29 am
Posts: 10
Howdy all!

I'm using an implict join to fetch info from 3 tables.

They are: P, PD and PRV.
Unique id:s in P and PD, not in PRV.

I query PD on firstName and fetch the entry in P and the entries in PRV.
P.id = 1
PD.id = 1
PRV.id = 1, PRV.priv = A
PRV.id = 1, PRV.priv = B
PRV.id = 1, PRV.priv = C

HQL:

from P p,PD pd,PRV pr where pd.firstName="Erik"and pd.playerId = p.playerId and pd.playerId = pr.playerId

In the result set the P and PD is correct. However, PRV is not.
Instead of returning PRV.priv=A;PRV.priv=B etc I get PRV.priv=A.
In fact it is the same object.

Running the sql returns the correct data.

Help anyone?

Hibernate version:
2.1
Mapping documents:

<hibernate-mapping>
<class
name="PD"
table="network.p_d"
dynamic-update="true"
dynamic-insert="true"
mutable="true"
>

<id
name="Id"
column="player_id"
type="java.lang.Integer"
unsaved-value="any"
>
<generator class="assigned">
</generator>
</id>

<property
name="firstName"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="first_name"
/>

</class>
</hibernate-mapping>

<hibernate-mapping>
<class
name="P"
table="network.p"
dynamic-update="true"
dynamic-insert="true"
mutable="true"
>

<id
name="Id"
column="player_id"
type="java.lang.Integer"
unsaved-value="null"
>
<generator class="native">
</generator>
</id>

</class>
</hibernate-mapping>

<hibernate-mapping>
<class
name="PRV"
table="network.prv"
dynamic-update="true"
dynamic-insert="true"
>

<id
name="Id"
column="player_id"
type="java.lang.Integer"
unsaved-value="any"
>
<generator class="assigned">
</generator>
</id>


<property
name="privCode"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="priv_code"
/>

</class>

</hibernate-mapping>

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

Full stack trace of any exception that occurs:
NONE
Name and version of the database you are using:
MySQL 4.0
The generated SQL (show_sql=true):
select playerdo0_.player_id as player_id0_, playerdeta1_.player_id as player_id1_, privileges2_.player_id as player_id2_, playerdo0_.foreign_id as foreign_id0_, playerdo0_.operator_id as operator3_0_, playerdo0_.security_rating as security4_0_, playerdo0_.password as password0_, playerdo0_.nickname as nickname0_, playerdo0_.email_hash as email_hash0_, playerdo0_.city as city0_, playerdo0_.foreign_username as foreign_9_0_, playerdo0_.foreign_username_lowercase as foreign10_0_, playerdo0_.status_code as status_11_0_, playerdeta1_.first_name as first_name1_, playerdeta1_.last_name as last_name1_, playerdeta1_.address1 as address11_, playerdeta1_.address2 as address21_, playerdeta1_.state as state1_, playerdeta1_.zip as zip1_, playerdeta1_.country_code as country_8_1_, playerdeta1_.phone as phone1_, playerdeta1_.title as title1_, playerdeta1_.date_of_birth as date_of11_1_, playerdeta1_.email as email1_, privileges2_.priv_code as priv_code2_ from network_player_beta.player playerdo0_, network_player_beta.player_details playerdeta1_, network_player_beta.player_privilege privileges2_ where (playerdeta1_.first_name="Erik"and playerdeta1_.player_id=playerdo0_.player_id )and(playerdeta1_.player_id=privileges2_.player_id )
Debug level Hibernate log excerpt:

NONE


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.