-->
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: Casting in a JPA query
PostPosted: Fri Oct 09, 2009 1:11 pm 
Newbie

Joined: Sun Apr 13, 2008 10:22 pm
Posts: 3
is it possible to cast the LONG type value that "COUNT(*)" returns to an INTEGER?

My query is along the lines of:
Code:
INSERT INTO EmployeeCount(date, employeeCount) SELECT :CURRENT_DATE, COUNT(*) from EmployeeTable


but I get the following exception:
Code:
java.lang.IllegalArgumentException: org.hibernate.QueryException: insertion type [org.hibernate.type.IntegerType@1144ba2] and selection type [org.hibernate.type.LongType@1719f30] at.....................


I tried CAST(COUNT(*) AS INTEGER) but I get this AST tree exception.

any suggestions?

Thanks guys,

M


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.