Maxim Solodovnik | 27 Jan 19:53 2015

Huge String DB mapping

Hello All,

I'm trying to map Huge string to the DB:

public static final int MAX_LOG_SIZE = 1 * 1024 * 1024;
 <at> Lob
 <at> Column(name="ful_message", length = MAX_LOG_SIZE)
private String fullMessage;

Unfortunately I get column of type TEXT in my MySQL database :( (64K max)

I tried to remove  <at> Lob annotation, no luck

OpenJPA 2.3.0

Am I doing something wrong? Or it is bug in OpenJPA?

Thanks in advance!


Maxim aka solomax
zhourui | 1 Jan 05:33 2015

how to query list property with criteria query?

have entity like:
 <at> Entity
public class CompanyAttribute extends SliceJpaObject {
	 <at> PersistentCollection(fetch = FetchType.EAGER)
	private List<String> attributeList = new ArrayList<String>();

now need to select the List property 'attributeList' only in criteria query,
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<List&lt;String>> cq = cb.createQuery(List<String>.class);

CriteriaQuery<List&lt;String>> cq = cb.createQuery(List<String>.class); is
hoe to do it.


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

Trenton D. Adams | 17 Dec 01:21 2014

ClassCastException on maven enhancing

Good day,

I have a maven build.  When I run "mvn install" my unit tests run just 
fine, as does the enhancer...
[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer)  <at>  webdirectory ---
66  athome  INFO   [main] openjpa.Tool - Enhancer running on type 
190  athome  INFO   [main] openjpa.Tool - Enhancer running on type 

But, when I run "mvn install tomcat:deploy", the enhancer plugin tries 
to run again, and this...

[INFO] --- openjpa-maven-plugin:1.1:enhance (enhancer)  <at>  webdirectory ---
An error occurred while attempting to determine the version of 
[INFO] Total time: 9.535 s
[INFO] Finished at: 2014-12-16T17:18:11-07:00
[INFO] Final Memory: 13M/218M
[ERROR] Failed to execute goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance (enhancer) on project 
webdirectory: Execution enhancer of goal 
org.codehaus.mojo:openjpa-maven-plugin:1.1:enhance failed: 
(Continue reading)

Pinaki Poddar | 12 Dec 20:20 2014

Re: OpenJPA support for JPA 2.1: when?

May of JPA 2.1 have been developed on the branch Kevin had mentioned. As it
was quite a while I had looked at beautiful OpenJPA code (i am now a FOB in
the wobbly-goobly-gook Python/Shell Script world filled with super-wizards
:), the exact features I had implemented on that branch escapes me.

The essentials are
1. Stored Procedure support was well-cooked as it required new
constructs/concepts in OpenJPA
2. Many low-hanging features that had been part of OpenJPA in alternative
form are adapted to JPA 2.1 form

Will take a look when i get some free time. 

Any new or old committers ready to contribute to OpenJPA are welcome to
offer a hand to drive these prototypes to completion. 

Pinaki Poddar
Chair, Apache OpenJPA Project
View this message in context:
Sent from the OpenJPA Users mailing list archive at

jacksmith | 12 Dec 03:26 2014

OpenJPA generate wrong query when using postgres as DBDictionary

Our application is using OpenJPA 2.2 with Oracle, everything is working fine.

Now we need to move to postgres database, but we run into a basic issue, the
generated query is wrong, it has extra table in the FROM statement which
causes cartesian join.

any help will be deeply appreciated. if you need anything else, please let
me know.

It's also very easy to reproduce the issue, following is the method to
reproduce it:
* with postgres as dbdictionay, this method produces wrong query like (with
oracle it works fine):
= ?) 
* the correct query should be like:
public void getDeptOptionsByUser(String filterId) {

        List<Predicate> predicates = new ArrayList<Predicate>();
	CriteriaBuilder cb = em.getCriteriaBuilder();
	CriteriaQuery<Tuple> cq = cb.createTupleQuery();

	/* the following line is purposely added to reproduce the issue. our real
application code is
	* much more complex and we don't have a way to bypass the issue
(Continue reading)

Roberto Cortez | 11 Dec 16:44 2014

Re: OpenJPA support for JPA 2.1: when?

Forgive me with these very basic questions:
- All the JPA 2.1 work should be done in this svn
sandbox: Should we just pick a task
from the list here: and contribute to it?- Since
I'm not a committer, should I just send the patches for the code?
      From: Rick Curtis <curtisr7@...>
 To: users <users@...> 
Cc: Pinaki Poddar <pinaki.poddar@...> 
 Sent: Thursday, December 11, 2014 3:09 PM
 Subject: Re: OpenJPA support for JPA 2.1: when?

For those that are interested in this development effort, please take a
look at the jpa-2.1 development tasks[1]. There are some low hanging prelim
tasks that need to get taken care of prior to any real 2.1 work happening.

Pinaki -- I see you created a 2.1 development sandbox, do you have any info
on the changes that you've already started to prototype?



On Tue, Dec 9, 2014 at 10:50 PM, David Blevins <david.blevins@...>

> On Dec 8, 2014, at 11:55 AM, David Blevins <david.blevins@...>
> wrote:
(Continue reading)

Tester | 30 Nov 16:21 2014

Set cascading-persist gobally or through ReverseMappingTool

Dear OpenJPA community,

I use the OpenJPA ReverseMappingTool to programmatically create my
entities. The issues that I'm now encountering is the following error

Suggested actions: a) Set the cascade attribute for this field to
CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or "persist" or
"all" (JPA orm.xml),
 b) enable cascade-persist globally,
 c) ...

I see 3 possible solutions to change the CascadingType to Persist (the
ReverseMappingTool puts CascadinType.Merge by default it seems):
1) Pass a configuration to the ReverseMappingTool to add
CascadingType.Persist instead of the default CascadingType.Merge

=> I have been looking in the docs of the ReverseMappingTool, but I cannot
find a way to set it. Am I overlooking something?
2) Set CascadingType.Persist globally in a programmatic way.

=> I looked to add it through the JDBCConfiguration/OpenJPAConfiguration or
EntityManager, but here I still don't see way to set this globally
3) Manipulate the generated entity files. This is definitely possible, but
I would prefer option 1 or 2.

Anybody has an idea on how to achieve point 1 or 2?

Kind regards,
(Continue reading)

Charlie Mordant | 30 Nov 16:05 2014

OpenJPA and auto-commit

Hi OpenJPA Guru's,

I'm encountering an issue when openJPA participates to a global
transaction, I've got this weird error happening sometimes:

Caused by: <openjpa-2.3.0-r422266:1540826 nonfatal general error>
setAutoCommit(true) invalid during global transaction.

	at org.apache.openjpa.jdbc.meta.MappingTool.record(

	at org.apache.openjpa.jdbc.meta.MappingTool.record(

My persistence.xml is as simple as it can be:

<persistence-unit name="${project.artifactId}Pu" transaction-type="JTA">




 <property name="openjpa.Log" value="slf4j"/>

 <property name="openjpa.jdbc.SynchronizeMappings" value=
(Continue reading)

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)