-->
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.  [ 2 posts ] 
Author Message
 Post subject: Virtual column
PostPosted: Tue Mar 17, 2009 5:56 am 
Newbie

Joined: Tue Mar 17, 2009 5:06 am
Posts: 2
I use hibernate annotation for get data from DataBase
I want to creat fild maxValue in class and fill it value ( select MAX(Object.fieldCount) from Object)

I try use annotation @Formula(value="select MAX(Object.fieldCount) from Object") but It dosn't work

How shoud do this ?

Thanks for helping


Top
 Profile  
 
 Post subject: Re: Virtual column
PostPosted: Tue Mar 17, 2009 8:17 am 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
vadey wrote:
I use hibernate annotation for get data from DataBase
I want to creat fild maxValue in class and fill it value ( select MAX(Object.fieldCount) from Object)

I try use annotation @Formula(value="select MAX(Object.fieldCount) from Object") but It dosn't work

How shoud do this ?

Thanks for helping


Try to use ( ) inside your formula
Code:
@Formula(value="(select max(author.id) from author)")
public Long getMaxId() {
     return maxId;
}


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