Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Mapping entity property to stored functioncall - possible?
Mapping entity property to stored functioncall - possible? [message #512463] Fri, 05 February 2010 09:01 Go to next message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Hi all,

does anyone know whether it is possible to map an entity property to a
stored function call instead of mapping it to a table column?

Thanks, Tom
Re: Mapping entity property to stored functioncall - possible? [message #513036 is a reply to message #512463] Mon, 08 February 2010 16:01 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

There is no easy way to do this, so please log an enhancement request.

Some options include,
- Use an EclipseLink Converter to perform the same conversion in Java as the database function would.
- Define a database view that applies the function, and map to the view instead of the table.
- Use custom SQL to map to the object, using a DescriptorCustomizer you can override the readObject and readAll queries to use your own custom SQL.
- Use the function name inside the @Column name, this will work for simple one table SQL, but will fail for joins when aliases are used.
- Subclass DatabaseField to handle printing functions and set it into your mapping.


James : Wiki : Book : Blog : Twitter
Re: Mapping entity property to stored functioncall - possible? [message #513761 is a reply to message #513036] Thu, 11 February 2010 07:57 Go to previous message
Thomas Haskes is currently offline Thomas HaskesFriend
Messages: 147
Registered: July 2009
Senior Member
Am 08.02.2010 17:02, schrieb James:
> There is no easy way to do this, so please log an enhancement request.

Done.

>
> Some options include,
> - Use an EclipseLink Converter to perform the same conversion in Java as
> the database function would.
> - Define a database view that applies the function, and map to the view
> instead of the table.
> - Use custom SQL to map to the object, using a DescriptorCustomizer you
> can override the readObject and readAll queries to use your own custom SQL.
> - Use the function name inside the @Column name, this will work for
> simple one table SQL, but will fail for joins when aliases are used.
> - Subclass DatabaseField to handle printing functions and set it into
> your mapping.
>
Previous Topic:@EntityListeners not inherited when TABLE_PER_CLASS inheritance strategy is used?
Next Topic:externalize eclipselink.target-database property
Goto Forum:
  


Current Time: Tue Mar 19 09:51:24 GMT 2024

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

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

Back to the top