Hi!
Is it possible to do nested instantiation (new()...) in a select??
The real case: I have a query like this
Code:
select distinct
new SomeStrangeObject(
(select count(id) from SomeObject where date=current_date()),
(select count(id) from SomeObject where date<current_date()),
(select count(id) from SomeObject where date>current_date()),
)
from SomeObject
with a single new SomeStrangeObject(): I would like to rewrite the query like this one:
Code:
select distinct
new SomeStrangeObject(
new Map(
(select count(id) from SomeObject where date=current_date()),
(select count(id) from SomeObject where date<current_date()),
(select count(id) from SomeObject where date>current_date()),
)
)
from SomeObject
So my SomeStrangeObject class can have only a single constructor with one Map parameter
instead of one constructor for any number of parameters...
I've read in the forum of some patch that let do this but the post refers to 2004 and
hibernate 2, and it seems (=looking at the changelog) this feature is not present in
the newest releases of hibernate...
thank you everybody for helps and suggestions!!
A.