openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Hoover" <>
Subject RE: OpenJPA + Native Query = Meta Data
Date Mon, 28 Jan 2013 15:49:44 GMT
Thanks for the suggestions Kevin! I'd like to stay clear of listeners if I
can so I can keep it localized to the handful of use cases where I actually
need it :/

I'm not sure if this is the best solution or not, but I seem to be running
out of practical solutions that will keep metadata isolated. I figured that
in this case I'm already using a native query. So, why not just capture the
connection from the entity manager and create the native statement that will
allow access to the metadata. The only problem is the
entityManager.unwrap(java.sql.Connection.class) seems to be unpredictable.
Sometimes I receive "java.lang.IllegalStateException: No transactional
EntityManager available" and
l.Connection.class) likes to call "synchronizeMappings" in
JDBCBrokerFactory#newBrokerImpl(String user, String pass) even though the
OpenJPA documentation (version 2.2.1) indicates that the lack of
"openjpa.jdbc.SynchronizeMappings" will prevent such a call. Maybe I'm
missing something here?

-----Original Message-----
From: Kevin Sutter [] 
Sent: Thursday, January 24, 2013 9:34 AM
Subject: Re: OpenJPA + Native Query = Meta Data

Not that I am aware of...  Of course, OpenJPA has access to and utilizes the
metadata while processing the result set, but I don't see a means of
providing that metadata back to the application.  Since OpenJPA is
open-source, we always welcome new feature submissions...  :-)

One alternative that might work for you is to tie into OpenJPA's JDBC
Listeners [1].  If you tied into the post execute statement listener, you
could get access to the jdbc-related artifacts and do your own parsing of
the information.  Maybe not quite as easy as the eclipselink feature, but
would that provide the metadata you are looking for?



On Tue, Jan 22, 2013 at 2:11 PM, Will Hoover <> wrote:

> Is there any feature in OpenJPA that will allow capture of a queries 
> metadata (similar to "eclipselink.result-type"="Map")?
> I'm trying to capture a rowid from a native query update call.

View raw message