Project

General

Profile

bug #7353

SpecimenTypedesignationsWorkingsetEditor: error on saving after changing kindOfUnit

Added by Andreas Kohlbecker 8 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Highest
Category:
cdm-vaadin
Target version:
Start date:
04/19/2018
Due date:
% Done:

100%

Severity:
critical
Found in Version:
Tags:

Description

Changing the kindOfUnit from can cause the situation in which an already existing DerivedUnit is to be persistet twice:

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
               at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
               at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
               at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
               at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
               at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207)
               at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)
               at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2886)
               at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3386)
               at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
               at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:560)
               at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:434)
               at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
               at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
               at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1282)
               at eu.etaxonomy.cdm.service.SpecimenTypeDesignationWorkingSetServiceImpl.save(SpecimenTypeDesignationWorkingSetServiceImpl.java:177)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.lang.reflect.Method.invoke(Method.java:498)
               at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
               at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
               at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
               at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
               at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
               at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
               at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
               at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
               at com.sun.proxy.$Proxy858.save(Unknown Source)
               at eu.etaxonomy.cdm.vaadin.view.name.SpecimenTypeDesignationWorkingsetEditorPresenter.saveBean(SpecimenTypeDesignationWorkingsetEditorPresenter.java:251)
               at eu.etaxonomy.cdm.vaadin.view.name.SpecimenTypeDesignationWorkingsetEditorPresenter.saveBean(SpecimenTypeDesignationWorkingsetEditorPresenter.java:63)
               at eu.etaxonomy.vaadin.mvp.AbstractEditorPresenter.onEditorSaveEvent(AbstractEditorPresenter.java:69)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
               at java.lang.reflect.Method.invoke(Method.java:498)
               at org.vaadin.spring.events.internal.MethodListenerWrapper.publish(MethodListenerWrapper.java:78)
               at org.vaadin.spring.events.internal.ListenerCollection.publish(ListenerCollection.java:167)
               at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:116)
               at org.vaadin.spring.events.internal.ScopedEventBus.publish(ScopedEventBus.java:109)
               at eu.etaxonomy.vaadin.mvp.AbstractPopupEditor$SaveHandler.postCommit(AbstractPopupEditor.java:265)
               ... 83 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '3d6af4dc-23c1-4bd7-be53-061b978df7fc' for key 'UK_27bp7fmyeik8x3y8norvgtsr3'
               at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
               at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
               at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
               at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
               at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
               at com.mysql.jdbc.Util.getInstance(Util.java:387)
               at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:932)
               at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
               at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
               at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
               at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
               at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551)
               at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
               at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)
               at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)
               at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5094)
               at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)
               at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:384)
               at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204)
               ... 118 more

This problem is caused by DerivedUnits not being deleted correctly in the DerivedUnitConverter.convertTo() method. This method is changing the persisted state when eve a conversion takes place, this is anyway an antipattern and should be avoided. --> #7354


Related issues

Blocked by Edit - bug #7354: DerivedUnitConverter handles associated SpecimenTypeDesignation correctly Closed 04/19/2018

Associated revisions

Revision 3baf1767 (diff)
Added by Andreas Kohlbecker 8 months ago

fix #7353 SpecimenTypedesignationsWorkingsetEditor: adapting to changes in DerivedUnitConverter and blockig kindOfUnit changes in case of multiple typeDesignations per specimen

History

#1 Updated by Andreas Kohlbecker 8 months ago

  • Tags set to phycobank
  • Project changed from AlgenRegistrierung to Edit
  • Category set to cdm-vaadin
  • Assignee set to Andreas Kohlbecker
  • Priority changed from New to Highest
  • Target version set to Release 5.0
  • Severity set to critical
  • Found in Version set to Release 4.14

#2 Updated by Andreas Kohlbecker 8 months ago

  • Category changed from cdm-vaadin to cdmlib

#3 Updated by Andreas Kohlbecker 8 months ago

  • Category changed from cdmlib to cdm-vaadin

#4 Updated by Andreas Kohlbecker 8 months ago

  • Blocked by bug #7354: DerivedUnitConverter handles associated SpecimenTypeDesignation correctly added

#5 Updated by Andreas Kohlbecker 8 months ago

  • Description updated (diff)

#6 Updated by Andreas Kohlbecker 8 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#7 Updated by Andreas Kohlbecker 5 months ago

  • % Done changed from 50 to 100

this no longer happens

#8 Updated by Andreas Kohlbecker 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)