openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darren Senel <>
Subject Re: Memory Usage
Date Mon, 29 Jun 2009 15:24:14 GMT

Hello Pinaki,

We declare the persistent domain classes in persistence.xml.  Here is our
persistence.xml content:

<persistence xmlns="" version="1.0">
  <persistence-unit name="active">
	  <property name="openjpa.TransactionMode" value="managed"/>
	  <property name="openjpa.ConnectionFactoryMode" value="managed"/>      
      <property name="openjpa.jdbc.DBDictionary"
      <property name="openjpa.Log" value="DefaultLevel=ERROR, Tool=FATAL,
      <property name="openjpa.jdbc.QuerySQLCache" value="false"/>

For each request we create an instance of one of the persistent classes as

PrimaryContentDTO primaryContent = new PrimaryContentDTO();

And then we load from the database using a primary key:

                emf = WCPSUtils.getEMF();
                // Set primary key
		BaseContentDTOPk pk = new BaseContentDTOPk();

		// Load from database
		EntityManager em = emf.createEntityManager();
		try {
			PrimaryContentDTO temp = em.find(this.getClass(), pk);

			// Need to merge returned values with this object
			if (temp != null)

			if (log.isDebugEnabled()) {
				log.debug("Begin loadFromDB()");
		} finally {
			em = null;

The WCPSUtils class returns the singleton instance of the

We have an inheritance hierarchy for most of the persistent classes. But the
one above follows this hierarchy:

BaseContentDTO -> ConfigDTO -> PrimaryContentDTO

BaseContentDTO has a one-to-many relationship to RepeatedAttribute
persistent class. We are eagerly fetching everything.  We only do reads from
the database, we have no inserts or updates.

I believe all the classes will be loaded using the same web application
class loader in WebSphere AppServer.

Hope this is the information you needed to help us analyze this issue.  Your
help is really appreciated.



Pinaki Poddar wrote:
> Hi,
>   Having a single instance of EntityManagerFactory and making it live for
> the entire application lifetime is a good practice. Can you tell us how
> the persistent domain classes for are being specified (and loaded) for the
> application? 
>   For example, do you declare them in <class> clause of persistence.xml?
> Or in a orm.xml file? 
> Or are they not declared at all explicitly and loaded dynamically by the
> application? 
> Also is the application using multiple classloaders to load these classes?
>   The container in PCRegistry that has occupied so much memory in the
> described profile is used to hold persistent domain class information.
> Knowing the classloading behavior of the application will help diagnosis.

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message