-->
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: addScalar() doesn't work on named sql queries
PostPosted: Thu Dec 03, 2009 12:43 pm 
Regular
Regular

Joined: Tue Oct 10, 2006 2:21 pm
Posts: 58
A google search on Transformer usage shows several sites that explain how to use it.

For example:

http://relation.to/2133.lace
http://prasadmarrapu.blogspot.com/2008/07/result-transformers-in-hibernate.html

which nicely fill in some gaps in documentation.

However all these examples use inline SQL (Session.createSQLQuery()) rather than named SQL queries
(session.getNamedQuery()). Even after casting the result of the latter to a SQLQuery (the cast succeeds), if addScalar() is called on the SQLQuery, an UnsupportedOperationException is thrown on AbstractList.add() (which that method always throws if invoked). It appears that there might be some magic combination of <resultset> <return-scalar> or other mapping-file elements that would prevent this from happening, but I wasn't able to ferret it out, and fell back to using createSQLQuery() on the same SQL, which does not have the problem.

I think this is probably a bug. Is there a workaround?


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.