-->
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: Hibernate Collection Fetch problem with fixed length CHAR
PostPosted: Tue Apr 29, 2008 8:34 am 
Newbie

Joined: Sat Apr 26, 2008 10:45 pm
Posts: 4
I have 2 simple tables called ITEM ( primry key ID CHAR(10)) and BID (FK ITEM_ID CHAR(10) references ID(ITEM)).

Both primary key and foreign keys are CHAR(10)

In the entity I have a bidirectional one to many relationship( Item to Bid [1..N])

Hibernate is not retrieving the list of Bids from Item instance. I am doing eager fetching.The generated sql is just fine but the list is empty.

For Example say ITEM table has got a row with Primary key "ONE"
and BID Table has got 3 rows with BID.ITEM_ID as "ONE"

itemObject.getBids("ONE"); -----> returns an Empty List


How ever if I pad the input with spaces and make its length 10, I can get the Bid collection from Item.

itemObject.getBids("ONE[7 spaces padding]"); -----> returns a list of 3 Bids

I know that this is happening for CHAR datatype, does anyone knows how to solve this?


The detailed source code is in my previous posting "Topic: Hibernate problem with Fixed Length CHAR"

Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Mapping documents: NA, we are using JPA

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

Full stack trace of any exception that occurs: No excep[tion occurs

Name and version of the database you are using: Derby 10.2.2.0

The generated SQL (show_sql=true):


Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


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.