openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Marcourt <christo...@marcourt.ch>
Subject Re: JPQL and DB2 native code
Date Mon, 19 May 2014 06:09:15 GMT
Hi Kevin,

yes I'm using temporal data from DB2 :-).
I'm already querying DB2 in SQL native and I had to do a "mapper" for my
entities as my DAO is a generic one. Quite tough. My problem is the
@Inheritance annotation for the joined strategy. In JPA it's automatic but
in pure SQL : nada !

So that's why I was asking for a way to intercept JPQL parsing. But it
seems it's not possible.

I'm afraid I have to do it on my own.

Cheers.

Christophe Marcourt


2014-05-16 21:22 GMT+02:00 Kevin Sutter <kwsutter@gmail.com>:

> Hi Christophe,
> So, you are attempting to use the Temporal support for DB2?  That's pretty
> cool.  We had entertained that support a some time ago, but updating the
> JPQL is a killer.  Once we update the JPQL then we've broken the standard
> as defined by the specification.  So, integrating the Temporal support
> directly into the Java object model and the associated JPQL was
> deep-sixed...  At least until this becomes back of the JDBC/SQL standard.
>
> So, in the mean time, I would suggest using native SQL instead of
> attempting to use JPQL.  When using native SQL, OpenJPA just puts on the
> blinders and passes the SQL through to the backend database.  The OpenJPA
> manual [1] touches on this native SQL support.  But, you may also want to
> reference the specification [2] and/or the Pro JPA 2 book [3] for more
> information.
>
> Good luck,
> Kevin
>
> [1]
>
> http://ci.apache.org/projects/openjpa/trunk/docbook/manual.html#jpa_overview_sqlquery
> [2]  https://jcp.org/aboutJava/communityprocess/final/jsr317/
> [3]  http://www.amazon.com/Pro-JPA-2-Mike-Keith/dp/1430249269
>
>
> On Wed, May 14, 2014 at 2:50 AM, Christophe Marcourt <
> christophe@marcourt.ch
> > wrote:
>
> > Hello,
> >
> > I'm using a DB2 native functionality for the historic.
> > As the query are proprietary : select * from <table_name> *for
> system_time
> > between* <from_date> *and *<to_date> where <where_clause>... I
had to use
> > pure SQL.
> >
> > I'm having a problem as JPQL parser can't parse this query. The "for
> > system_time between ... and ..." is not known by JQPL.
> >
> > Is there a way to override, intercept or listen this parsing ?
> >
> > What is the object to use DBDictionary, JPQLParser, else ?
> >
> > Thank you for your help.
> >
> > Christophe Marcourt
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message