Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Using views in CriteriaQuery(CriteriaQuery)
Using views in CriteriaQuery [message #719286] Fri, 26 August 2011 15:33 Go to next message
Chris Oman is currently offline Chris Oman
Messages: 2
Registered: August 2011
Junior Member
The situation: web form that allows the user to fill out information to be used in a query.

Technologies: EclipseLink, H2, Glassfish

Problem: I have gotten nearly everything to work exactly as I want with the CriteriaQuery. The one problem I have remaining is that I want the user to also be allowed to type in a keyword and use the H2 'FT_SEARCH_DATA()' fulltext search function. I couldn't figure out how to use functions in the where portion of the CriteriaQuery, so I have created a view to do essentially the same thing as that function.

I am still having trouble figuring out how to include that view as a joined table in the CriteriaQuery. Has anyone done anything like this before? Can it be done?

Thanks,
Chris

[Updated on: Fri, 26 August 2011 15:34]

Report message to a moderator

Re: Using views in CriteriaQuery [message #720535 is a reply to message #719286] Tue, 30 August 2011 19:17 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use the CriteriaBuilder.function() API to call a database function.

Critieria only allows querying objects, so there is no way to query a view (or table) unless it is mapped to an object.


James : Wiki : Book : Blog : Twitter
(no subject) [message #720544 is a reply to message #719286] Tue, 30 August 2011 19:17 Go to previous message
James is currently offline James
Messages: 272
Registered: July 2009
Senior Member
You can use the CriteriaBuilder.function() API to call a database function.

Critieria only allows querying objects, so there is no way to query a view (or table) unless it is mapped to an object.

--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Previous Topic:(no subject)
Next Topic:Different objects in different queries
Goto Forum:
  


Current Time: Wed Sep 03 02:29:10 GMT 2014

Powered by FUDForum. Page generated in 0.13984 seconds