openjpa

again about JPA/Hibernate bulk(batch) insert

Here is simple example I've created after reading several topics about jpa bulk inserts, I have 2 persistent objects User, and Site. One user could have many site, so we have one to many relations here. Suppose I want to create user and create/link several sites to user account. Here is how code looks like, considering my willing to use ...

Memory leak in Websphere 7 + EJB3, a lot of instances of ClassMapping

Hi, sorry for my english, I speak spanish. I recently migrate an application from ejb 2.x to ejb3 (approx. 300 entities), Im using WebSphere 7.0.0.9. After 10 hours of work, the system crash with an OutOfMemoryError. Analyzing the coredump, I see a lot of instance of the org.apache.openjpa.jdbc.meta.ClassMapping class (please see the a...

JPA Lookup Hierarchy Mapping

Given a lookup table: | ID | TYPE | CODE | DESCRIPTION | | 1 | ORDER_STATUS | PENDING | PENDING DISPOSITION | | 2 | ORDER_STATUS | OPEN | AWAITING DISPOSITION | | 3 | OTHER_STATUS | OPEN | USED BY OTHER ENTITY | If I have an entity: @MappedSuperclass @Table(name="LOOKUP") @Inheritance(strategy=In...

OpenJPA HSQLdb - how to handle IDs

Hi! I'm having trouble handling IDs of my databse tables using OpenJPA and HSQLdb. I created an Abstract class where I handle annotations and stuff to remap into the DB: // Property accessors @Id @Column(name = "IDTESTOBJEKT", unique = true, nullable = false) public Integer getIdtestobjekt() { return this.idtestobje...

HSQLdb permissions regarding OpenJPA

Hi! I'm (still) having loads of issues with HSQLdb & OpenJPA. Exception in thread "main" <openjpa-1.2.0-r422266:683325 fatal store error> org.apache.openjpa.persistence.RollbackException: user lacks privilege or object not found: OPENJPA_SEQUENCE_TABLE {SELECT SEQUENCE_VALUE FROM PUBLIC.OPENJPA_SEQUENCE_TABLE WHERE ID = ?} [code=-5501,...

how openjpa2.0 enhances entities at runtime?

Below is my test code: package jee.jpa2; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.EntityTransaction; import javax.persistence.Persistence; import javax.persistence.Query; import org.testng.annotations.BeforeClass; import org.testng.annotatio...

OpenJPA & MySQL persist wrong encoded characters

Hi all, my mysql db has character encoding utf8. In QueryBrowser i can see special characters are correct. In appplication using openjpa i can see the same values also correct. But when I persist object into DB, I have correct values in application but incorrect in DB! When I restart application that special characters in application ar...

Kodo / openjpa data cache watermark settings?

I'm trying to find information on what triggers a data cache cleardown in kodo / openjpa. I'm guessing there is a high watermark - at which point the cache will clear down data. Does it just remove a single item once you hit your cache size limit, or a whole load of stuff? Or maybe there is no clear down, and you simply get an error w...

How to detect entities automatically with openJPA?

I'm looking for an entity detection in OpenJPA. That I don't need to declare all entities in the persistence.xml. Edit: I'm sorry, I forgot to say that I develop a java se app. ...

JPA - Change table at runtime

Hi, I have a problem Tables sales_2009 sales_2008 sales_2007 And only one class (sales), How change the table at runtime? ...

Is there any JPA fluent API / Critera api for JPA 1.0? I'm using OpenJPA

Is there any jpa 1.0 fluent api/interface for query building? I'm using openjpa 1.x, so I'm stuck with JPA1. I found QueryByProxy, but its maven repo is not working properly. ...

OpenJPA, Jersey, JUnit: Using a different persistence unit for my unit tests?

Hi all. I'm building an application using OpenJPA 2.0.0, Jersey 1.3, and JUnit 4.8.1. I've set it up so I have two different persistence units defined in my persistence.xml: "default" and "unittest." Default is set up to connect to an Oracle instance, while unittest is set up to connect to a local H2DB embedded database file. I do th...

Configuring OpenJPA 1.3.1 with EhCache: plugin/alias not found

I'm trying to configure ehcache with openjpa. I get the following error: org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "DataCacheManager" with value "ehcache" caused an error "java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: ehcache". The alias or class name may have been misspelled, or the ...

IBM Websphere JPA configuration - how to update persistence.xml

I'm new to EJB 3 and the JPA. I've created a datasource in the appserver which is jdbc/AppDataSource. The default persistence provider is left as com.ibm.websphere.persistence.PersistenceProviderImpl. And I left the default jta data source JNDI name as AppDataSource itself. I'm actually confused regarding JTA and non-JTA. What different...

select from two tables using JPQL

Hi I m using JPQL to retrieve data. I can get data using the statement List persons = null; persons = em.createQuery("select p.albumName from PhotoAlbum p , Roleuser r where r = p.userId and r.userID = 1"); Now i can get the album names using this... int i=0; for (i=0;i<persons.size(); i++) { System.out.println("Testing n "...

How to inject custom object ids into JPA entities

I am using JPA 2 for an enterprise application, and my DBA's just hit me with a twist. They want me to use the group's centralized object ID generator for all my tables. This means rather than using table values or a sequence table, I will need to call a web service to get a batch of ~50 ids. Then, as I persist any new object, I would...

Detected reentrant flush in JPA

Hi I m using JPA to insert a row My update code as in here Now i m inserting a row using this code public void get_image (String id) { Object l = null; try { em = this.getEm(); EntityTransaction entr = em.getTransaction(); entr.begin(); newa.Options o = new newa.Options(); newa....

MappingException: InvocationTargetException

Hello guys, I have a small problem here and hope that someone can help me out. I wanna do a mapping from Object to Integer. The Object is marked as Fetchtype.Lazy. When I do the mapping I get the following error message: 11:31:46,569 ERROR MappingProcessor:253 - Field mapping error --> MapId: null Type: null Source parent clas...

JPA / OpenJPA Same value in all rows

I have a problem with OpenJPA I try to read all rows from a table but the primary key has always a same value(value = 0)!?!?!? for (Object o : em.createQuery("select x from AnnouncementsEntry x") .getResultList()) { //alway returns "0" in every row long id = ((AnnouncementsEntry) o).getEntryI...

Openjpa maven plugin error

Update 3: Addes following code to the pom so openjpa could find the persistence.xml file. Got some query errors left but I finally got openjpa to work :). <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> </resources> Update2: Set up maven p...