-->
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.  [ 4 posts ] 
Author Message
 Post subject: SQL case when problem with Cloudscape
PostPosted: Thu Jan 06, 2005 7:43 pm 
Newbie

Joined: Mon Jul 26, 2004 2:52 pm
Posts: 11
Hibernate version:
2.1.4

Database version
Cloudscape 10

HQL
BillConfig.getAllBillingConfigurationsByOwnerId =
SELECT BC
FROM BillConfig BC
WHERE BC.reportConfig.usageContract.owner.id = :ownerId
GROUP BY BC



Generated SQL and error

select billconfig0_.ID as ID1_, case when billconfig0__3_.ID is not null then 1 when billconfig0__4_.ID is not null then 2 when billconfig0__5_.ID is not null then 3 when billconfig0__1_.ID is not null then 4 when billconfig0__2_.ID is not null then 5 when billconfig0_.ID is not null then 0 end as clazz_1_, billconfig0_.REPORT_CONFIG_ID as REPORT_C3_39_1_, reportconf1_.RLQueryContext as RLQuery51_0_ from RPT_BILL_CONFIG billconfig0_ left outer join RPT_EXTERNAL_BILL_CONFIG billconfig0__1_ on billconfig0_.ID=billconfig0__1_.ID left outer join RPT_COST_BILL_CONFIG billconfig0__2_ on billconfig0_.ID=billconfig0__2_.ID left outer join RPT_UNIQUE_USER_BILL_CONFIG billconfig0__3_ on billconfig0_.ID=billconfig0__3_.ID left outer join RPT_HIGH_WATERMARK_BILL_CONFIG billconfig0__4_ on billconfig0_.ID=billconfig0__4_.ID left outer join RPT_TOKEN_BILL_CONFIG billconfig0__5_ on billconfig0_.ID=billconfig0__5_.ID left outer join ReportConfiguration reportconf1_ on billconfig0_.REPORT_CONFIG_ID=reportconf1_.id where billconfig0_.ID=33226753

Note the error message below which doesn't seem to make sense.

2005-01-05 22:16:13,096 ERROR [upm.actions] [PoolThread-11] Failed to display billing configurations summary
2005-01-05 22:16:13,096 ERROR [upm.actions] [PoolThread-11] Failed to display billing configurations summary
[Incident# 1730-962] com.macrovision.flexnet.platform.exceptions.FLEXnetHibernateException: :Cause: could not load by id: [com.macrovision.flexnet.reporting.bizobjects.BillConfig#33226753] :Cause: Types 'INTEGER' and 'CHAR' are not type compatible. (Neither type is assignable to the other type.)
at com.macrovision.flexnet.platform.services.persistence.PersistenceService.getQueryResultsByHQLQuery(PersistenceService.java:351)
at com.macrovision.flexnet.platform.services.persistence.PersistenceService.getQueryResults(PersistenceService.java:371)



SQL that works

changing integers to strings seems to work

select billconfig0_.ID as ID1_, case when billconfig0__3_.ID is not null then '1' when billconfig0__4_.ID is not null then '2' when billconfig0__5_.ID is not null then '3' when billconfig0__1_.ID is not null then '4' when billconfig0__2_.ID is not null then '5' when billconfig0_.ID is not null then '0' end as clazz_1_, billconfig0_.REPORT_CONFIG_ID as



Is it possible to tell Hibernate to generate the right SQL? Could we change the Hibernate Dialect for Cloudscape?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 1:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you have a patch that make it work then sure, change the dialect and submit it to JIRA

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 8:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Even better, fix this bug in cloudscape!

(You might notice that cloudscape/derby is not officially supported, because of a raft of small bugs like this.)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 15, 2005 4:37 am 
Newbie

Joined: Sat Jan 15, 2005 3:06 am
Posts: 4
Check http://opensource.atlassian.com/project ... se/HB-1224, it may help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.