Skip to main content



      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 04:01 Go to next message
Eclipse UserFriend
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 11:01 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Mapping entity property to stored functioncall - possible? [message #513761 is a reply to message #513036] Thu, 11 February 2010 02:57 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 09:13:10 EDT 2025

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

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

Back to the top