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 Dugo
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">
<attributes>
<basic name="FLEX_1" attribute-type="java.lang.Double" access="VIRTUAL">
<column name="FLEX_1"/>
</basic>
</attributes>
</entity>

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 Sutherland
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: Fri Sep 19 03:48:02 GMT 2014

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

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