-->
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 criteria doesn't return a result
PostPosted: Sun Jul 20, 2008 10:47 pm 
Newbie

Joined: Sun Jul 20, 2008 10:16 pm
Posts: 1
I have a criteria for a search method,


Code:
Criteria criteria = session
               .createCriteria(PurchaseOrder.class)
               .add(Restrictions.eq("companyCode", code) )   
               .add(Restrictions.eq("poNumber", poNumber)) ;


Where poNumber is a Long value and companyCode is a object I wrote on my own. I've noticed that when I send in the second restriction in this manner, I get zero results ( there's at least one row in the table).

However if I submit it in this fashion :

Code:
   Criteria criteria = session
               .createCriteria(PurchaseOrder.class)
               .add(Restrictions.eq("companyCode", code) )   
               
               .add(Restrictions.eq("poNumber", new Long(9552118900099L))) ;


This returns exactly the result I want (1 row, criteria.list()). My question is: Am I doing something wrong in adding the criteria for the Long value?

I've tried looking at the contents of the criteria after adding the criteria and it looks all right (using toString()). I've tried looking at the generated sql but all I see are question marks in the binded parameters.
Also I've copied out the generated SQL statement and replaced the '?' with the correct values and run it against the database and it seemed all right.

Anyone have any ideas or help on this ? [/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.