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: Returning list of correct size, but with random null values
PostPosted: Mon Sep 13, 2004 4:01 pm 
Newbie

Joined: Mon Sep 13, 2004 3:34 pm
Posts: 2
The mapping below describes a model where I'd like to have certain items (in this case, a mechanical Jack) assigned to a Job. The relationship is established using the "reservedJobId" field in the "jacks" table. If it is assigned to no job, then the value is NULL.

Everything works fine when the table contains no NULL values for reservedJobId. However, when any of the rows contain a NULL value for that column, Hibernate starts acting strange. When I request a list (code shown below), it will return a List of the correct size, but only the first object will be valid. The rest will be null entries. What's stranger is when I do a consecutive request for the same list in the same section, the first TWO entries will be valid. This pattern of behavior repeats itself for every consecutive request (i.e., on the third request, the first three entries will be valid, on the fourth four, etc).

I've verified that Hibernate is generating the correct SQL.

Anyone have any idea what could be going on? Thanks in advance

Hibernate version: 2.1.5

Mapping documents:

Code:
<class name="Job" table="jobs" >
   <id name="id" type="long" column="id">
      <generator class="native" />
   </id>   
   
   <property name="proposalName" />
   <property name="description" />
</class>

<class name="Jack" table="jacks">
   <id name="id" type="long">
      <generator class="native" />
   </id>
   <many-to-one name="model" class="Jack$JackModel" cascade="none" column="modelId" />
   
   <many-to-one name="reservedJob"
            class="Job"
            cascade="all"
            column="reservedJobId"
            not-null="false"/>
</class>


Code between sessionFactory.openSession() and session.close():
Code:
List l = s.createQuery("from com.vbar.vt.model.Jack").list();


Name and version of the database you are using: MySQL 4.1.x

The generated SQL (show_sql=true):
Code:
select jack0_.id as id, jack0_.modelId as modelId, jack0_.reservedJobId as reserved3_ from jacks jack0_



[/code]


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.