Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Virtual columns (@Formula of Hibernate)
Virtual columns (@Formula of Hibernate) [message #500349] Wed, 25 November 2009 12:41 Go to next message
Eclipse UserFriend
Hi!

Does anybody know if EclipseLink has an equivalent to Hibernate's @Formula ( http://docs.jboss.org/hibernate/stable/annotations/reference /en/html/entity.html#d0e2273)?

I would like to automatically populate the "currentPrice" attribute of a "Product" entity with the price valid for today which has to be reat from another database table.
Re: Virtual columns (@Formula of Hibernate) [message #500532 is a reply to message #500349] Thu, 26 November 2009 09:36 Go to previous messageGo to next message
Eclipse UserFriend
There is no direct equivalent (please log an enhancement), but depending on what you want to do, there are ways to accomplish the same thing.

EclipseLink defines a TransformationMapping which can map a computed value from multiple field values, or access the database.

You can override the SQL for any CRUD operation for a class using its descriptor's DescriptorQueryManager.

You could define a VIEW on your database that performs the function and map your Entity to the view instead of the table.

You can also perform minor translations using Converters or property get/set methods.
Re: Virtual columns (@Formula of Hibernate) [message #500637 is a reply to message #500349] Fri, 27 November 2009 04:27 Go to previous message
Eclipse UserFriend
Hi James, thanks for your hints. I think I can do what I want with one of the options you mentioned, I just have to select the best one for my case Smile

I filed an enhancement request for having the easy to use @Formula feature in EclipseLink as well:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=296324
Previous Topic:Why does weaving prevent initalization of class variable
Next Topic:How to set JDBC fetch size on JPA query?
Goto Forum:
  


Current Time: Sat Jul 19 04:26:56 EDT 2025

Powered by FUDForum. Page generated in 0.03918 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top