-->
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: Generated query including boolean types
PostPosted: Thu Sep 14, 2006 11:49 am 
Newbie

Joined: Thu Sep 14, 2006 11:35 am
Posts: 3
I'm having issues with Criteria queries.

My query call looks like...

DetachedCriteria criteria = DetachedCriteria.forClass(instance.getClass())
.add(Example.create(instance));

List results = getHibernateTemplate().findByCriteria(criteria);


My instance class has these fields...
private Integer issueId;
private Contact supplier;
private IssueComponent issueComponent;
private Product product;
private Contact ownerContact;
private String shortDesc;
private String longDesc;
private String fileName;
private String status;
private String criticality;
private String resolution;
private String resolutionDesc;
private boolean resolutionEmailSend;

I've created an instance of the above instance object and set the criticality field to "Low".
When I pass this object into my query, the generated query includes the resolutionEmailSend field and is scewing my query results.

Here is the generated query.

Hibernate: select this_.issue_id as issue1_0_, this_.supplier_id as supplier2_22_0_, this_.component_id as component3_22_0_, this_.product_id as product4_22_0_, this_.owner_contact_id as owner5_22_0_, this_.short_desc as short6_22_0_, this_.long_desc as long7_22_0_, this_.file_name as file8_22_0_, this_.status as status22_0_, this_.criticality as critica10_22_0_, this_.resolution as resolution22_0_, this_.resolution_desc as resolution12_22_0_, this_.create_ts as create13_22_0_, this_.last_mod_ts as last14_22_0_, this_.create_contact_id as create15_22_0_, this_.last_mod_contact_id as last16_22_0_, this_.version_int as version17_22_0_, this_.resolution_email_ind as resolution18_22_0_ from issue this_ where (this_.criticality=? and this_.resolution_email_ind=?)


How do I keep the boolean types from being included in the generated query?

Thanks in advance.


Top
 Profile  
 
 Post subject: TinyInt types as well
PostPosted: Mon Sep 18, 2006 11:11 am 
Newbie

Joined: Thu Sep 14, 2006 11:35 am
Posts: 3
Fo the hell of it, I changed the boolean to a byte, and the same query was generated.

<property name="resolutionEmailSend" type="boolean">
<column name="resolution_email_ind" not-null="true" />
</property>

<property name="resolutionEmailSend" type="byte">
<column name="resolution_email_ind" not-null="true" />
</property>

??


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.