Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Freeze after Exception
Freeze after Exception [message #757997] Thu, 17 November 2011 03:29
AmFreak Missing name is currently offline AmFreak Missing name
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 :(
Previous Topic:Mapping Compound PK with FK Reference?
Next Topic:EclipseLink Maven repository missing
Goto Forum:
  


Current Time: Sun Sep 21 16:12:38 GMT 2014

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

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