Subject hibernate and select from select
Author Marco Parmeggiani
Hi, back on the list after some quite time.
I have a question on Hibernate and firebird and i've already asked on
the hibernate forum. Maybe here there someone more firebird oriented.

Hibernate 3.0.5
Firebird 1.5.2
I have a mapping (table-per-concrete-class, chapter 10.1.5, reference
3.0.5) that generates a query of this type:

select plottable0_.PL_ID as PL1_, plottable0_.AR_CX as AR1_2_,
plottable0_.LI_X1 as LI1_3_, plottable0_.clazz_ as clazz_
from (
select null as AR_CX, null as LI_X1, PL_ID, 0 as clazz_
from Plottable
union
select AR_CX, null as LI_X1, PL_ID, 1 as clazz_
from ARCO
union
select null as AR_CX, LI_X1, PL_ID, 2 as clazz_
from LINEA ) plottable0_

This query is not good for Firebird...
I can see problems in 2 diferent points:
1.
select ... from (select

NOT SUPPORTED AFAIK

2.
select AR_CX, null as LI_X1, PL_ID, 1 as clazz_
from ARCO
union
select null as AR_CX, LI_X1, PL_ID, 2 as clazz_
from LINEA

executing this out of hibernate gives me syntax error.


so, the question is: how to solve this problem?
How to tell hibernate to generate valid firebird SQL?

Thanks