Displaying posts tagged with



OpenJPA Auto Detach Configuration and Memory Issues

When I was doing some work with OpenJPA, I found there is a possible memory leaking issue when OpenJPA is used for data access without the proper configuration of the parameter of auto detach (openjpa.AutoDetach).
The scenario that the memory issue may happen:

One EntityManagerFactory and One EntityManager are used throughout the whole session;
The session contains [...]


How to Configure Spring beans.xml File: Collection properties and EntityManagerFactory Examples

Java beans in Spring can also have their collection properties populated in the beans.xml file. The collection properties here mean things like List, Map and Array.
For example, if you want to create a JPA EntityManagerFactory with a set of connection properties, these properties can be configured in beans.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" [...]


Remember to Clear Entity Manager if Entities No Longer Used

Recently  a lesson was learned about the proper use of Java JPA to persist a large number of records into database in a batch process.

Some times it is necessary to load the records line by line from a large file and insert into the database table. There can be several ways to do this:

Use the [...]