Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Objects still exists after commit
Objects still exists after commit [message #989942] Mon, 10 December 2012 07:43 Go to next message
xuehan xu is currently offline xuehan xuFriend
Messages: 1
Registered: December 2012
Junior Member
Hello, everyone.

My situation is as follows:

My dao class is defined like the following:

class JpaDao extends JpaDaoSupport{

......

public insert(Object obj){
getTemplate().getEntityManager().persist(obj);
}

public merge(Object obj){
getTemplate().getEntityManager().merge(Object obj);
}

public detach(Object obj){
getTemplate().getEntityManager().detach(obj);
}
}

In my program, I used the class to persist objects. After I commited the transactions and detached my objects persisted or merged by the above class, there's still a lot of copies of my objects exists in memory, which led to a high memory usage. I used jprofiler to debug the program and discovered that all these copies are referenced by "UnitOfWorkCacheKey" or "RepeatableWriteUnitOfWork" objects.

Is this normal? How can I delete these copies from memory?
Thanks.

[Updated on: Tue, 11 December 2012 01:15]

Report message to a moderator

Re: Objects still exists after commit [message #990300 is a reply to message #989942] Tue, 11 December 2012 18:27 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

It sounds like you are still holding onto the EntityManager. The EntityManager represents a single persistence context, they should not live beyond a transaction or request.

James : Wiki : Book : Blog : Twitter
Previous Topic:EQL / JPQL Operator -datepart- Usage
Next Topic:JPQL query with ElementCollection throw exception
Goto Forum:
  


Current Time: Fri Apr 19 00:27:36 GMT 2024

Powered by FUDForum. Page generated in 0.01872 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top