-->
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: Bizarre Null Occurring
PostPosted: Sun Sep 19, 2004 4:18 am 
Newbie

Joined: Fri Jul 30, 2004 3:11 pm
Posts: 18
Basically I have a class that I am writing some code to fill a bunch of properties and then I'm persisting it. Several properties are Integer, several are String. The persistence goes fine and all the properties get into the table. Then I do a query and get back all the records, and all the properties are there but one, which is null (see unit test below for prop openings). There is another Integer property that is being returned.

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

<hibernate-mapping package="com.onassignment.search">
<class name="JobListing" table="joblistings">
<id
column="jobListingKey"
name="JobListingKey"
type="integer"
>
<generator class="vm" />
</id>
<property
column="listed"
length="10"
name="Listed"
not-null="true"
type="date"
/>
<property
column="startDate"
length="10"
name="StartDate"
not-null="false"
type="date"
/>
<property
column="jobtypekey"
length="10"
name="Jobtypekey"
not-null="true"
type="string"
/>
<property
column="jobtitle"
length="32"
name="Jobtitle"
not-null="true"
type="string"
/>
<property
column="hotjobcode"
length="11"
name="Hotjobcode"
not-null="false"
type="integer"
/>
<property
column="openings"
length="11"
name="Openings"
not-null="true"
type="integer"
/>
<property
column="shift"
length="11"
name="Shift"
not-null="false"
type="integer"
/>
<property
column="employer"
length="40"
name="Employer"
not-null="true"
type="string"
/>
<property
column="bonustype"
length="11"
name="Bonustype"
not-null="false"
type="integer"
/>
<property
column="divisionkey"
length="11"
name="Divisionkey"
not-null="true"
type="integer"
/>
<property
column="description"
name="Description"
not-null="false"
type="string"
/>
<property
column="state"
length="2"
name="State"
not-null="true"
type="string"
/>
<property
column="city"
length="40"
name="City"
not-null="true"
type="string"
/>
<property
column="duration"
length="11"
name="Duration"
not-null="false"
type="integer"
/>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
String qstring = "from JobListing";
List listings = session.find(qstring);
JobListing listing = (JobListing) listings.get(0);
log.info("Description = " + listing.getDescription());
log.info("# of openings = " + listing.getOpenings());

Full stack trace of any exception that occurs:
NPE
Name and version of the database you are using:
MySQL
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2004 8:06 pm 
Newbie

Joined: Fri Jul 30, 2004 3:11 pm
Posts: 18
Here is the debug level dump:

12:00:50,371 ? DEBUG Loader:680 - Hydrating entity: com.onassignment.search.JobListing#188
12:00:50,376 ? DEBUG DateType:68 - returning '19 September 2004' as column: listed
12:00:50,380 ? DEBUG DateType:64 - returning null as column: startDate
12:00:50,383 ? DEBUG StringType:68 - returning 'OR' as column: jobtypekey
12:00:50,387 ? DEBUG StringType:68 - returning 'O/R Assistant' as column: jobtitle
12:00:50,390 ? DEBUG IntegerType:64 - returning null as column: hotjobcode
12:00:50,393 ? DEBUG IntegerType:64 - returning null as column: openings

and yet here are the results from mysql:

mysql> select listed, jobtypekey, jobtitle, openings from joblistings;
+------------+------------+---------------+----------+
| listed | jobtypekey | jobtitle | openings |
+------------+------------+---------------+----------+
| 2004-09-19 | OR | O/R Assistant | 3 |


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.