|
| Re: Mapping entity property to stored functioncall - possible? [message #513036 is a reply to message #512463] |
Mon, 08 February 2010 11:01   |
James Sutherland Messages: 1834 Registered: July 2009 |
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
|
|
|
| Re: Mapping entity property to stored functioncall - possible? [message #513761 is a reply to message #513036] |
Thu, 11 February 2010 02:57  |
Thomas Haskes Messages: 142 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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.01809 seconds