Freeze after Exception [message #757997] |
Thu, 17 November 2011 03:29 |
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 :(
|
|
|
Powered by
FUDForum. Page generated in 0.03622 seconds