José Luis Cetina | 19 Aug 19:26 2014
Picon

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
com.xx.yy.zz.MyClassName".

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?

Plugin:

 <!--OPENJPA ENHANCMENT-->
            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>${plugins.openjpa.maven.plugin}</version>
                <configuration>
                    <includes>
                        com/xx/yy/entities/**/*
                    </includes>
                    <excludes>
                        com/xx/yy/entities/**/*_.class
(Continue reading)

Manoel Pedro | 19 Aug 03:44 2014
Picon

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.

(thanks)

"public.loc"
----------+---------------+-----------
 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)

"public.point"
----------+---------------+-----------
 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)

"public.abs_point"
-----------------------+---------------+-----------------------
(Continue reading)

Christoph Weiss | 11 Aug 20:24 2014
Picon

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! 

Cheers
Christoph Weiss 
maurojava | 6 Aug 10:47 2014
Picon

Fetch Plain. what it is?

hi all . While i read from

http://www.slideshare.net/pinaki.poddar/jest-rest-on-openjpa
<http://www.slideshare.net/pinaki.poddar/jest-rest-on-openjpa>  

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

tank you .
Mauro

--
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
Picon

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 
BatchingConstraintUpdateManager.update(). 

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
Picon

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 
project. 
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 
transaction. 
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 
id).
So we are not sure if the "business logic is really carried out at one 
piece". 

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 
statement: 
[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
Picon

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
example

"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
Picon

MariaDB vs. MySQL

Hi,

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
JPQLs.

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
Picon

Create H2 database even before adding records

Hi,

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
requirement.

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">

<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>java:/comp/env/jdbc/restDB</jta-data-source>
        <class>org.wso2.as.ee.Student</class>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
        </properties>
    </persistence-unit>
</persistence>

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

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

artaxerxe | 15 Jul 13:39 2014
Picon

Problems with OpenJPA when deploying in Apache Servicemix and Spring. (OSGi environment)

Hello everyone. For a time I'm striving with a problem that I have with
OpenJPA. I'm trying to deploy my bundle that contains OpenJPA entities in an
OSGi compliant server, namely Apache Servicemix. I'm accessing the OpenJPA
entities using Spring. The problem is that when I make the deployment for my
bundle, I get this error:

openjpa.Runtime - An error occurred while registering a ClassTransformer
with PersistenceUnitInfo: name 'openjpa-test', root URL [bundle://240.0:1].
The error is logged along with this warning. Load-time class transformation
will not be available.<openjpa-2.3.0-r422266:1540826 nonfatal general error>
org.apache.openjpa.util.GeneralException: Resource does not exist:
bundle://240.0:1
	at
org.apache.openjpa.meta.AbstractCFMetaDataFactory.getPersistentTypeNames(AbstractCFMetaDataFactory.java:635)
	at
org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNamesInternal(MetaDataRepository.java:1478)
	at
org.apache.openjpa.meta.MetaDataRepository.getPersistentTypeNames(MetaDataRepository.java:1470)
	at
org.apache.openjpa.enhance.PCClassFileTransformer.<init>(PCClassFileTransformer.java:103)
	at
org.apache.openjpa.enhance.PCClassFileTransformer.<init>(PCClassFileTransformer.java:67)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:284)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl.<init>(PersistenceProviderImpl.java:266)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:169)
	at
org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
(Continue reading)

Mansour Al Akeel | 12 Jul 13:03 2014
Picon

Problem creating table with <at> IdClass an foreign keys constraints

Hello all,

To demonstrate the problem and make it easier to get help, I have created
an application here:

https://github.com/malakeel/jpa-id-class-example

This application is to create tables with constrains from JPA entities.
Tables are created, however I am unable to generate
the foreign key constrains.

Here's the description of the entities. We have the Services Entity, with
fields relates the service provider to the
client, and the service type. The Service Entity has its primary keys
(service provider and client). Both are Person(s).

When this application is run using  <at> IdClass(ServicePK.class), I get the
exception:

<openjpa-2.3.0-r422266:1540826 fatal user error>
org.apache.openjpa.persistence.ArgumentException: The id class specified by
type "class com.example.Service" does not match the primary key fields of
the class.  Make sure your identity class has the same primary keys as your
persistent type, including pk field types. Mismatched property: "client"
    at
org.apache.openjpa.meta.ClassMetaData.validateAppIdClassPKs(ClassMetaData.java:2225)
    at
org.apache.openjpa.meta.ClassMetaData.validateAppIdClass(ClassMetaData.java:2099)
    at
org.apache.openjpa.meta.ClassMetaData.validateIdentity(ClassMetaData.java:2035)
(Continue reading)


Gmane