Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Freeze after Exception
Freeze after Exception [message #757193] Thu, 17 November 2011 03:29 Go to next message
AmFreak Missing name is currently offline AmFreak Missing nameFriend
Messages: 25
Registered: June 2011
Junior Member
Hi,

my program freezes after i for example try to insert non unique data into an uniqe field.

javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.apache.derby.client.am.BatchUpdateException:
...


It doesn't freeze after the exception, but as soon as i try to get data from the database.

Heres my code for saving into the database:

public void saveProjects(List<Project> projects){
		for(ListIterator<Project> iter = projects.listIterator(); iter.hasNext();) 
		{
			em.persist(iter.next());	
		}	
		save();
		firePropertyChange("projects", null, null);
	}


public void save(){
try{
		if(transaction == null || !transaction.isActive())
		{
			transaction = em.getTransaction();
			transaction.begin();
		}
		transaction.commit();
} catch (RuntimeException e) {
         if (em.getTransaction().isActive()) {
             try {
                em.getTransaction().rollback();
             } catch (RuntimeException er) {
                
             }




As soon as the save is done the propertyChange is fired and a treeview requests the list of projects from the database to use as it's input. That's the point where the program hangs.
All what i get then is
[EL Fine]: Connection(384464201)--SELECT ID, DESCRIPTION, nameIndex FROM PROJECT
on the console and the program freezes.

I tried things like em.clear, em.flush or em.close and em=emf.createEntityManager() but the program always freezes Sad

Re: Freeze after Exception [message #757808 is a reply to message #757193] Mon, 21 November 2011 18:42 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

It seems that the transaction is some how leaving locks on your database. Are you sure you are rolling back the transaction?

Can you try a different database, maybe it is an issue in Derby.


James : Wiki : Book : Blog : Twitter
Previous Topic:PerformanceMonitor in Standalone or OSGI environment?
Next Topic:Re: Freeze after Exception
Goto Forum:
  


Current Time: Sat Apr 20 01:03:02 GMT 2024

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

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

Back to the top