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.