this exception is not handled properly (on project remove)
-
this exception is not handled properly (on project remove)
Exception in thread "Thread-13" javax.persistence.EntityNotFoundException: No row with the given identifier exists: [lcsb.mapviewer.model.cache.UploadedFileEntry#12092]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:118)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:1044)
at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:963)
at org.hibernate.engine.spi.CascadingActions$1.cascade(CascadingActions.java:57)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:471)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:396)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:197)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.internal.DefaultDeleteEventListener.cascadeAfterDelete(DefaultDeleteEventListener.java:391)
at org.hibernate.event.internal.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:322)
at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:158)
at org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:72)
at org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:1011)
at org.hibernate.internal.SessionImpl.delete(SessionImpl.java:947)
at lcsb.mapviewer.persist.dao.BaseDao.delete(BaseDao.java:141)
at lcsb.mapviewer.services.impl.ProjectService$1.run(ProjectService.java:277)
at java.lang.Thread.run(Thread.java:748)
-
moreover there is no foreign key between project and uploaded file. sql to remove invalid references:
update project_table set file_entry_id = null where not file_entry_id in (select id from file_entry_table);
-
foreign key must also be added
Edited by Piotr Gawron