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.  [ 3 posts ] 
Author Message
 Post subject: Table in quotes in formula tag
PostPosted: Tue Jun 13, 2006 11:08 am 
Newbie

Joined: Tue Jun 13, 2006 10:45 am
Posts: 2
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


Last edited by gamaliya on Wed Jun 14, 2006 4:00 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 13, 2006 2:19 pm 
Beginner
Beginner

Joined: Fri May 26, 2006 7:15 am
Posts: 20
Location: Vandavasi, TamilNadu
May i know, y u need that quotes ?

<formula>
(select count(*) from "OrderList" T where T.productId = productId)
</formula>

_________________
gajini
------------------


Top
 Profile  
 
 Post subject: Hibernate generate wrong sql for tables in quotes.
PostPosted: Wed Jun 14, 2006 3:54 am 
Newbie

Joined: Tue Jun 13, 2006 10:45 am
Posts: 2
gajini wrote:
May i know, y u need that quotes ?

<formula>
(select count(*) from "OrderList" T where T.productId = productId)
</formula>


Yes, but hibernate generate wrong sql for table in quotes as described above.


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