-->
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: Query by Example Problem
PostPosted: Thu Aug 17, 2006 3:25 am 
Newbie

Joined: Tue Jul 11, 2006 10:41 pm
Posts: 11
Hi,


i wonder has anyone encountered this before?

Supposed i have this POJO as below

Code:
private String id; //PK
     private Date createddate;
     private String updatedby;
     private Date updateddate;
     private char deleted;

     //Init my Bean
     Object rates = new Object();
     rates.id("2");
     rates.setCreateddate(sqlDate);
     rates.setBcc("1");


Then i Created a QBE

Code:
   Criteria criteria = PersistenceUtil.currentSession().createCriteria(
            "Rates";
     criteria.add(Example.create(rates).ignoreCase());


How come i get this in my SQL generated by Hibernate
(lower(this_.BCC)=? and this_.CREATEDDATE=? and this_.DELETED=?)


Basically there are two things above.
1. I set my Id which is my primary key , why it dont appear in the SQL
2. how come the DELETED condition come out when i never set it in my BEAN. I guess because HIbernate thinks char is a primitive type so it couldnt compare it to null thats why hibernate includes it.


But when i see my log it binds ' ' to my DELETED field


How to solve this??
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 23, 2007 12:00 pm 
Newbie

Joined: Wed Jan 18, 2006 12:00 pm
Posts: 4
Is the solution for this to simply start using an object instead of a primitive data type? (Integer instead of an int etc.)


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.