Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Custom SQL Functions?
Custom SQL Functions? [message #388106] Thu, 21 May 2009 23:54 Go to next message
Spencer Uresk is currently offline Spencer UreskFriend
Messages: 13
Registered: July 2009
Junior Member
I am looking into the viability of porting our applications to EclipseLink
from Hibernate. One thing I haven't been able to easily figure out is how
to register custom SQL functions. For example, we have some setup in
Hibernate for use with Oracle Text by extending the OracleDialect and
registering them like this:

registerFunction("score", new StandardSQLFunction("score",
Hibernate.INTEGER));
registerFunction("contains", new StandardSQLFunction("contains",
Hibernate.INTEGER));

I'm assuming to do the same in EclipseLink we would extend the
Oracle10Platform and somehow register them in there, but I can't see any
obvious ways of doing that. I also haven't been able to find any
documentation that describes how one would do this.

Are there any examples or documentation anywhere I can look at to learn
how to do this?

Thanks.

- Spencer
Re: Custom SQL Functions? [message #388118 is a reply to message #388106] Mon, 25 May 2009 17:38 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

How are these functions used, from queries?

In EclipseLink you can define your own expression operators using the
ExpressionOperator class and registering these with the platform or with
ExpressionOperator. You can then use them in EclipseLink Expression
queries using the Expression getFunction(int) API.

You cannot currently use them in JPQL however (please log a bug for that).

You can also any database function using getFunction(String) and just give
the database function name. You could also use native SQL for the query.

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Previous Topic:Object database db4o EclipseLink integration
Next Topic:JPQL and Spatial Queries
Goto Forum:
  


Current Time: Mon Jan 20 10:06:05 GMT 2025

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

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

Back to the top