How possible use table names with quotes in formula tag?
My example:
Code:
<class name="OrderList" table="`OrderList`">
<id name="OrderListId" .../>
<many-to-one name="product"
class="Product"
column="productId"
/>
</class>
Code:
<class name="Product" table="`Product`">
<id name="productId" .../>
<property name="name"/>
<property name="orderCount">
<formula>
(select count(*) from "OrderList" T where T.productId = productId)
</formula>
</property>
</class>
In this case hibernare generate wrong sql. Hibernate adding product table alias
product0 (see below) and query failed:
Code:
select
product0.productid as productid,
product0.name as name
( select (count*) from product0."OrderList" T where T.productId = prodyct0.productId ) as formula0
from "Product" product0