Robert G | 17 Nov 03:05 2014

None of the download links work?

All of the download links return "Not Found" for me.

- Robert
Dave Westerman | 12 Nov 15:46 2014

Dynamic DataSource Selection with JPA

I am working with a group that has an application that has a very critical 
need for high availability and performance. To make a long story short, 
they want to use DB2 HADR for availability. But they also want to use the 
DB2 HADR read-on-standby facility if the application server is co-located 
with the database server, for performance reasons. 

The above details aren't really important here. But what I would like to 
know is if there is a way to dynamically choose which datasource the JPA 
calls will be using at runtime, based on some algorithm. All update calls 
to a JPA entity will always use the primary datasource. But if the entity 
is only being read, then the standby datasource may be the one used if the 
servers are co-located. 

I'm not sure if this is even feasible with JPA, but hopefully someone here 
can tell me. 

Jörn Gersdorf | 10 Nov 08:30 2014

Enable Query Cache, but selectively


I´d like to enable OpenJPA´s query cache in a selective way, i. e. it
should be disabled unless I enable it explicitly using

I´ve figured out that this requires
FetchConfigurationImpl$ConfigurationState#queryCache to be set to false by
default, however, there does not seem to be a configuration property for

So I ended up subclassing JDBCBrokerFactory and configure this via property
openjpa.BrokerFactory (see code below).

However I wonder if there is an easier way to achieve this?

Thanks and best regards,


<property name="openjpa.BrokerFactory"
value="de.dwpbank.wp2d.wprecon.model.cache.CustomJDBCBrokerFactory" />

public class CustomJDBCBrokerFactory extends JDBCBrokerFactory {

    public CustomJDBCBrokerFactory(JDBCConfiguration conf) {

(Continue reading)

Sandhya Turaga | 7 Nov 05:51 2014

Fw: Please unsubscribe me.

Hi Kevin, 
    I have sent an email to "" to
unsubscribe me from user list as well. But I am not unsubscribed . Need help with this . Thanks.

      On Thursday, November 6, 2014 12:48 PM, Sandhya Turaga <turagasandy <at>> wrote:

 Please unsubscribe me . thanks.

Trenton D. Adams | 6 Nov 08:25 2014

Standalone Example

Hi Guys,

Where can I find the best openjpa standalone example?  Preferably with a 
maven build.  I have checked the site, and googled, and nothing decent 
seems to come up.


Pawel Veselov | 6 Nov 06:57 2014
Gerald Barker | 3 Nov 22:43 2014

FetchGroup and EhCache Datacache

If I retrieve an object that gets cached (method is Cacheable) according to
fields in a fetch group in a query and then do another query for the same
object, but with a different fetch group and fields (more eagerly loaded
fields) then the second query is resolved in the cache with the eagerly
fetched fields from the first query, but not the second. 

Is this the expected behavior (it is not the desired behavior).

View this message in context:
Sent from the OpenJPA Users mailing list archive at

Henrik Melander | 3 Nov 17:54 2014

Re: Java enum column incompatibility warning

Hi all,
I have experienced exactly the same going from 1.2.2 to 2.4.0 (openjpa-2.4.0-nonfinal-1598334.jar). (I
think it was the same with 2.3.0 also)

Having an old database with the columns as varchar2(255) and must keep it that way for various reasons.

I know it is only a warning but is it possible to force creation of a fixed (not calculated) column size?

Using annotations and "length=255" is apparently not working.
 <at> Column(name = "mime_type", length = 255) // Not working

Best regards,
Henrik Melander

On 05/23/2014 04:5149 PM, Jason Reilly wrote:
Changing *just* the openjpa dependency version to 2.2.2 in my pom, the
schema creation looks like this:

CREATE TABLE file_data (file_data_id BIGINT NOT NULL, date_created TIMESTAMP, md5 VARCHAR(255),
mime_type VARCHAR(255), name VARCHAR(255), path VARCHAR(32672), PRIMARY KEY (file_data_id));


On 05/23/2014 10:49 AM, Kevin Sutter wrote:
> Hi Jason,
> Something's out of whack...  I went to the code that determines the size to
> use for enum fields and it has used the largest enum string length since
> 2006...  We have never defaulted to 255 for  <at> Enumerated types, for any
> database...
(Continue reading)

gouessej | 13 Oct 17:56 2014

javax.persistence.EntityListeners is never called


I use javax.persistence.EntityListeners. The persistent classes of the entities are correctly added
into persistence.xml. My test case works correctly with Hibernate and OpenJPA except that the annotated
methods (with  <at> PostLoad,  <at> PreUpdate,  <at> PrePersist and  <at> PostRemove) are never called by OpenJPA whereas
they are called by Hibernate. Am I missing anything obvious? Best regards.

Kevin Sutter | 8 Oct 00:43 2014

Re: Moving from OpenJPA 2.0.1 to 2.3.0: fields not found

I would suggest trying to turn on Trace, but there doesn't seem to be a lot
of tracing in this particular area of the code...  :-(  It still might be
worth a shot.  Maybe an earlier log entry might shed some light on why this
is going awry...

I'm going to suggest one quick change just to see if it makes a
difference.  It shouldn't, but I stumbled on this the first time I read
your code, so maybe the OpenJPA code is making the same mistake...

Instead of referencing a final String field for your mappedBy field, what
happens if you just insert the actual string?  For example, instead of...
    mappedBy = CAService._domainFieldName,
do this...
    mappedBy = "domains",

I know it shouldn't make a difference, but it might isolate the source of
the error if this does work.

Thanks, Kevin

On Tue, Oct 7, 2014 at 10:49 AM, Lionel <lsavouillan@...> wrote:

> Hello,
> First, thanks a lot for your answer. :)
> In the past, we were using an ant build the project so also to run the JPA
> enhancer but for a company strategy reason we are moving to a maven build
> process.
(Continue reading)

Pinaki Poddar | 6 Oct 01:32 2014

Re: Audit logging in OpenJPA2.1.

> Is there a way to implement such a logging in earlier versions of OpenJPA? 


Core OpenJPA kernel has all the necessary functionality for audit
if you are *not* interested in the 'delta' between the current and
pre-change state of an entiity, the task becomes simpler. As you have noted
a standard LifCycle Event State change callback mechnism should suffice.

>  I cannot get a reference to entity manager in event listener.
You can albeit with some work.
The persistence entity when enhanced, implements a PersistenceCapable
interface. Hence, it is safe to cast the persistence entity to a
PersistenceCapable. The PersistenceCapable.pcGetGenericContext() method
returns you an object which is a Persistence Conext -- which is same (for
all practical purpose) as an EntityManager.
The Persistence Context in OpenJPA is called Broker. So it is safe to cast
the result of PersistenceCapable.pcGetGenericContext() to Broker. Broker has
all the methods you will find on an EntityManager. Actually EntityManager is
implemented as a very thin delegation layer on Broker.

You could always get a deeper and better explanation on the source (remember
OpenJPA is Open Source :) and JavaDoc.

Regards --

Pinaki Poddar
Chair, Apache OpenJPA Project
(Continue reading)