-->
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.  [ 5 posts ] 
Author Message
 Post subject: Dynamic instantiation with null value
PostPosted: Thu Feb 19, 2009 9:36 am 
Newbie

Joined: Thu Feb 19, 2009 9:34 am
Posts: 4
Hi everyone,

Is it possible to use dynamic instantiation with null value in HQL ?
Something like this :

Code:
select new ArticleAggregation(null, article.name, null, sum(article.value))
from article
group by article.quantity, article.name, article.description


Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 10:04 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
No, I guess its not possible, as hibernate cannot determine the appropriate constructor.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 11:09 am 
Newbie

Joined: Thu Feb 19, 2009 9:34 am
Posts: 4
mmerder wrote:
No, I guess its not possible, as hibernate cannot determine the appropriate constructor.


Thank you for your answer.
But it could be resolved by a cast mechanism... If it was ever implemented...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 12:05 pm 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Or by another constructor, if you can add one. ;-)

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2009 12:16 pm 
Newbie

Joined: Thu Feb 19, 2009 9:34 am
Posts: 4
It is not a good solution for me, because my HQL request is generated dynamically.
So I would have to implement all potential constructors.
Which is not possible because some parameters are in the same type...

In my Example :
Code:
ArticleAggregation(String name, Long quantity)
ArticleAggregation(String description, Long quantity)


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