Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPQL queries on Virtual Access Method fields(JPQL queries on Virtual Access Method fields (Extensible Entities))
JPQL queries on Virtual Access Method fields [message #1061731] Mon, 03 June 2013 15:50 Go to next message
John Dugo is currently offline John DugoFriend
Messages: 13
Registered: October 2011
Junior Member
I was wondering if its possible to write JPQL queries against fields that are defined as Virtual? If so, whats the syntax?

For example:

@VirtualAccessMethods(get = "getFlexField", set = "setFlexField")
class SomeEntity{
Map<String,Object> flexFields;

Object getFlexField(String field);
void setFlexField(String field, Object value);

if i have the following dynamically defined:

<entity class="SomeEntity">
<basic name="FLEX_1" attribute-type="java.lang.Double" access="VIRTUAL">
<column name="FLEX_1"/>

Can I write a JPQL query that will load all 'SomeEntity' objects where FLEX_1 is some value?

"SELECT e FROM SomeEntity e WHERE e.FLEX_1 = 3"

(syntax is bogus but something like this)

Re: JPQL queries on Virtual Access Method fields [message #1061883 is a reply to message #1061731] Tue, 04 June 2013 13:54 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The virtual attribute's "name" can be used in JPQL or Criteria. In your case this would be "FLEX_1".

(your syntax is correct)

James : Wiki : Book : Blog : Twitter
Previous Topic:EclipseLink DBWS with JPQL
Next Topic:Accesing Eclipselink DBWS
Goto Forum:

Current Time: Mon Jun 18 12:09:39 GMT 2018

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

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

Back to the top