-->
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: Use secondary table in @Formula
PostPosted: Mon Oct 13, 2008 5:22 am 
Beginner
Beginner

Joined: Wed Jan 16, 2008 8:16 am
Posts: 23
Hi,



Is there a possibility to use a secondary table in a @Formula (e.g. @Formula(value="query", table="SECONDARY_TABLE")? If not, maybe a workaround exists?

I have heard, that I can make @Formula's lazy. How can I do that?

hibernate.version = 3.2.5GA

Best regards,
Michi


Top
 Profile  
 
 Post subject: Re: Use secondary table in @Formula
PostPosted: Mon Oct 13, 2008 10:19 pm 
Newbie

Joined: Fri Jul 14, 2006 12:05 pm
Posts: 19
michael.kohlhuber wrote:
Hi,



Is there a possibility to use a secondary table in a @Formula (e.g. @Formula(value="query", table="SECONDARY_TABLE")? If not, maybe a workaround exists?

I have heard, that I can make @Formula's lazy. How can I do that?

hibernate.version = 3.2.5GA

Best regards,
Michi

You can code a subselect as a formula expression by putting it in parentheses, something like this:

Code:
@Formula("(select x.name from contacts x where x.id = contact_id)")


I don't see any annotation support for lazy-loading individual properties, but I've done it using XML mapping documents. See http://www.hibernate.org/hib_docs/v3/reference/en-US/html/performance.html#performance-fetching-lazyproperties.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 14, 2008 2:18 am 
Beginner
Beginner

Joined: Wed Jan 16, 2008 8:16 am
Posts: 23
Hi,

thank you for your reply. Currently I use subselects, but for larger tables the performance is quite bad.
I hope that hibernate will allow the configuration of secondary tables for @Formula's.

Best regards,
Michi


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.