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)

Stuart Bedoll | 3 Oct 12:01 2014

AUTO: Stuart Bedoll/Boulder/IBM is out of the office until 02/26/2003. (returning 10/06/2014)

I am out of the office until 10/06/2014.

My wife's mom passed away. I will be working part time from Ohio this week.
I will be checking email. My return date is tenative.

Note: This is an automated response to your message  "Moving from OpenJPA
2.0.1 to 2.3.0: fields not found" sent on 10/03/2014 2:52:58.

This is the only notification you will receive while this person is away.
Lionel | 3 Oct 10:52 2014

Moving from OpenJPA 2.0.1 to 2.3.0: fields not found


I had a working project using OpenJPA 2.0.1
We had to change the project to a maven build so we are now enhancing the
classes this way:


(Continue reading)

Mansour Al Akeel | 27 Sep 06:08 2014

exclude-unlisted-classes ignored

When creating EntityManagerFactory using OpenEJB,
exclude-unlisted-classes works as expected. However, when creating it
directly as in:

props.setProperty("javax.persistence.jdbc.driver", this.driver);
    props.setProperty("javax.persistence.jdbc.url", this.url);
    props.setProperty("javax.persistence.jdbc.user", this.username);
    props.setProperty("javax.persistence.jdbc.password", this.password);


    EntityManagerFactory emf =
Persistence.createEntityManagerFactory(null, props);

The classes are not scanned. The only classes that are loaded and
created tables into the DB are those listed in the persistence.xml

I noticed that openejb and openjpa has their own implementation of

I just need to confirm if this is a bug, or I am missing something.

Thank you.

Mansour Al Akeel | 26 Sep 01:39 2014

Maven Plugin and schema tools

I am a bit confused about maven plugin. Trying to create tables
directly from the Entities classes.

I know it can create a schema definition and produce xml file or sql
file, but is there a way to generate and write the schema directly to
the DB ?

This functionality is not hard to add to maven plugin, but if it
exist, I prefer to use it.

The plugin I am talking about

Thank you.

José Luis Cetina | 24 Sep 22:44 2014

ManyToMany tries to insert twice

Hi, im not sure if i have a clear concept about the Many to Many persist.

I have this scenario.

table: courses

table: documents

table: courses_documents

Then my entities:

public class Course{

   private int courseId;

     <at> ManyToMany(cascade = CascadeType.ALL)
     <at> JoinTable(name = "courses_documents",
            inverseJoinColumns =
                                 <at> JoinColumn(name="course_id"),
                                 <at> JoinColumn(name="document_id"))
    private Set<Document> documents;

(Continue reading)

Aron Lurie | 24 Sep 16:52 2014

Reverse mapping : table-filter?

Hi All,

Is there an equivalent feature / a way to specify to ignore certain 
tables based on a pattern in their name?

Hibernate has a "table-filter" : 

My use case is ignoring the tables in Oracle that start with "BIN$" 
which are tables belonging to the recycle bin.


Maxim Solodovnik | 18 Sep 18:08 2014

Table name is not escaped properly (MSSql)

Hello All,

I have enum field in my class: (full source [1])
 <at> Entity
 <at> Table(name = "om_user")
public class User implements Serializable, IDataProviderEntity {
public enum Right {
Admin // access to Admin module
, Room // enter the room
, Dashboard // access the dashboard
, Login // login to Om internal DB
, Soap // use rest/soap calls
 <at> ElementCollection(fetch = FetchType.EAGER)
 <at> Column(name = "right")
 <at> CollectionTable(name = "om_user_right", joinColumns =  <at> JoinColumn(name =
 <at> Enumerated(EnumType.STRING)
private Set<Right> rights = new HashSet<User.Right>();

Today we get bug report [2] according "right" is reserved word in MSSql.
Can It be escaped somehow by OpenJPA or the only option is to change column
name? (we are using OpenJPA 2.3.0)

Please NOTE table has name om_user due to "user" is reserver in derby and
it also not being escaped :(

Thanks in advance

(Continue reading)

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.