-->
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: Using Function in formula
PostPosted: Wed Feb 01, 2006 12:52 pm 
Newbie

Joined: Fri Nov 05, 2004 11:09 am
Posts: 6
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2

I am trying to use a function in the formula tag in an object, but while execution it appends the table name as alias for that function by which it fails to execute the query.

Ex:
@hibernate.class table="TTABLE"
...
...
@hibernate.property formula="(SELECT MYFUNC FROM DUAL)"
public String get..() {
...
}
public void set..() {
..
}

while execution the query looks as follows:
SELECT ttable.id, (select ttable.MYFUNC from dual) from ttable

instead of
SELECT ttable.id, (select MYFUNC from dual) from ttable

Any suggestion regarding this would be appreciated.

Thank you
Prasasd


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 9:32 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Specify the schema in your formula. For SQLServer, this would be
Code:
@hibernate.property formula="(SELECT dbo.MYFUNC FROM DUAL)"
For postgres, it would be
Code:
@hibernate.property formula="(SELECT public.MYFUNC FROM DUAL)"
I'm not sure about other DBs.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 3:15 pm 
Newbie

Joined: Fri Nov 05, 2004 11:09 am
Posts: 6
Thank you tenwit, that works if we qualify the function with scema name.


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.