olyalikov | 10 Sep 16:26 2014

EntityManager.find ClassCastException for wrong but existing id


I have base entity and 2 inheritors e.g. Person and Document.
If I try to find Person entity and provide id of the Document entity I get
ClassNotFoundException but it should return either null or
If I provide just some wrong non existing id I get null.
Here is link to the maven project with test:  openjpa-find-test.zip
Should I post a bug in issue tracker?


View this message in context: http://openjpa.208410.n2.nabble.com/EntityManager-find-ClassCastException-for-wrong-but-existing-id-tp7587085.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

rrac | 25 Aug 15:15 2014

OpenJPA Enhancement in Play Framework

We are trying to set up Play Framework 2.3.3 with OpenJPA. We are unable 
to make Runtime or Build Time enhancement work. OpenJPA works when 
setting the RuntimeUnenhancedClasses property to supported in 
persistance.xml, but that's not recommended for production and is a 
no-go. We tried using the javaagent JVM parameter with no luck like 
this: activator -J-javaagent:lib/openjpa-all-2.3.0.jar run.

How can the enhancer be configured?

View this message in context: http://openjpa.208410.n2.nabble.com/OpenJPA-Enhancement-in-Play-Framework-tp7587064.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
José Luis Cetina | 19 Aug 19:26 2014

openjpa.Enhance - You have enabled runtime enhancement, but have not specified the set of persistent classes.

Hi, i have a maven project, in my project i have a maven plugin for
enhancement, when i execute the plugin i can see the "enhancement running"
lines for each entity, like this:

INFO   [main] openjpa.Tool - Enhancer running on type "class

But when i run my server (Apache TomEE 1.6.0) i see a warning message:

239  classpath-bootstrap  INFO   [main] openjpa.Enhance - You have enabled
runtime enhancement, but have not specified the set of persistent classes.
 OpenJPA must look for metadata for every loaded class, which might
increase class load times significantly.

If i could see that the enhancement is running when i clean and install the
pom of my maven project, then why this message is show?


(Continue reading)

Manoel Pedro | 19 Aug 03:44 2014

multiple inheritance levels

Is it possible to have "multiple levels" of inheritance?
Consider: Location -> Point -> AbsolutePoint -> GeographicPoint

Using joinded inheritance the discriminator "accumulates", eg:

Relative to Location, Point has just one discriminator "PT", for
AbsolutePoint there is "ABS" relative to Point and "PT" relative to
Location. Tables and classes follow.


 loc_id   | numeric(20,0) | not null
 cat_code | character(6)  | not null
"loc_pkey"        PRIMARY KEY, btree (loc_id)
"fk_loc_cat_code" FOREIGN KEY (cat_code) REFERENCES loc_cat_code(code)

 point_id | numeric(20,0) | not null
 cat_code | character(6)  | not null
"point_pkey" PRIMARY KEY, btree (point_id)
"fk_point_cat_code" FOREIGN KEY (cat_code) REFERENCES point_cat_code(code)
"point_point_id_fkey" FOREIGN KEY (point_id) REFERENCES loc(loc_id)

(Continue reading)

Christoph Weiss | 11 Aug 20:24 2014

Container Managed EntityManager - is there a chance to control flush calls ?

Dear Community, 

We are running OpenJPa with "container managed" EntityManagers (using 
WebSphere Application Server). 
Because of technical reasons we want to explicitly control when the 
EntityManager executes the flush. 

First I thought that the parameter "FlushMode" could be a solution, but 
reading the documentation I understood it isn't.
So is there any other way to really control when the flush is executed? 

Any reply is appreciated. Thanks for your help in advance! 

Christoph Weiss 
maurojava | 6 Aug 10:47 2014

Fetch Plain. what it is?

hi all . While i read from


i have view that OPENJPA has Fetch Plain . 
What it is please ? 
i not know about it .

tank you .

View this message in context: http://openjpa.208410.n2.nabble.com/Fetch-Plain-what-it-is-tp7587024.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Christoph Weiss | 31 Jul 21:13 2014

Own UpdateManager - but issue with "isPersistent" and "isFlushed" for new JPA entities

Dear Community, 

For our project we added an own UpdateManager for OpenJPA.  We use the 
UpdateManager to do "explicit updates" for our JPA entities. 
This means that we use the UpdateManager to filter the set of JPA objects 
and to pass forward only  those JPA entities that we want be explicitly 
insert or update in the database. 

The UpdateManager is defined in the persistence.xml and working fine: 

 <property name="openjpa.jdbc.UpdateManager" value="OurOwnUpdateManager" 

However we have an issue with new JPA entities we create within our use 
case / transaction.
The issue:  The new entities are created at the beginning and known to the 
EntityManager when we create them. 
They are in the initial newState with isFlush=false and isPersist = false. 
So far so good. 

However when we run a "flush() operation" - e.g. to update the another 
objects. The new objects change the state to isPersist and isFlushed. 
However no update is happening on the database. 
Even if they are not passed from our UpdateManager to the 

At the end when we pass the objects (e.g. in the third flush operation) 
the EntityManager thinks that the objects are already existing and does an 
update on the tables instead of the an insert. 
And so our application fails. 
(Continue reading)

Christoph Weiss | 31 Jul 20:53 2014

Fw: How to Trace the used Transaction from the EntityManager

Dear User Group,

I am using OpenJPA in combination with WebSphere 8 within a customer 
In the project we are using multiple Stateless EJB and typically we are 
calling multiple EJBs for a piece of business logic. 
Each EJB is performing some JPA actions (database read / update).

Now we want to make sure that a "piece of business logic" is running one 
For this we are using the  <at> TransactionAttribute REQUIRED annotation. 

However taking a look at the EJBs (during the debugging) we see that each 
EJB seems to work with an own EntityManager (at least based on the object 
So we are not sure if the "business logic is really carried out at one 

Thus following questions: 
1.) Is there any way to trace / log the Transaction that is used by the 
EntityManager (at the end of the day) ? 

We activated the openjpa.jdbc,SQL Trace and see the following log 
[29.07.14 10:17:34:692 CEST] 000000db jdbc_SQL      3   openjpa.jdbc.SQL: 
Trace: <t 1902712361, conn -1754159499> executing prepstmnt -341855657

Is "t 1902712361" the transaction used? (or is this just another 
identifier in the SQL context) 

(Continue reading)

Ado | 25 Jul 12:53 2014

conditional join clause

Hi, I would like to ask for help with creating query from criteria api, but
I want to simulate the conditional join clause from standard SQL, for

"from VOUCHER v left join USER_VOUCHER uv on ((v.VOUCHER_ID =
uv.VOUCHER_ID) and uv.USER_ID=2).."

More info:

I have two entities mapped to tables

 <at> Entity
 <at> Table(name = "voucher")
public class Voucher implements Serializable {
    private static final long serialVersionUID = 1L;
     <at> Id
     <at> GeneratedValue(strategy = GenerationType.IDENTITY)
     <at> Basic(optional = false)
     <at> Column(name = "VOUCHER_ID")
    private Integer voucherId;
     <at> Column(name = "VOUCHER_NAME")
    private String voucherName;
     <at> OneToMany(mappedBy = "voucherId")
    private Collection<UserVoucher> userVoucherCollection;

    public Voucher() {
//rest ommited

(Continue reading)

Marc Logemann | 24 Jul 23:05 2014

MariaDB vs. MySQL


i am fighting weird issues with an openjpa application on MariaDB while all
these are non existant on MySQL. Things like "fetch join" are just
different or better said with openjpa 2.2.0 and MariaDB problematic in some

I even see different SQLs being created from the same JPAQL Queries. Is
this possible at all?

Thanks for infos.
Kalpa Welivitigoda | 20 Jul 20:14 2014

Create H2 database even before adding records


I am developing an application with H2 in memory database.

The issue is that the table is created only after I add a record. Before
that, if I search for a record it says that the table is not found. I want
to create the table at the time the application starts rather than waiting
for a record to be added. Is there any property that serves this

Following is the content of persistence.xml,

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
    <persistence-unit name="rest-jpa">

            <property name="openjpa.jdbc.SynchronizeMappings"

I have the datasource defined in context.xml as follows,

<?xml version="1.0" encoding="UTF-8"?>
(Continue reading)