maTayefi / spellbook-dictionary

Automatically exported from code.google.com/p/spellbook-dictionary
0 stars 0 forks source link

Fix word delete #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
word deletion does not work because of the changes you made to the model - 
in particular dictionary entries are referenced by uncommitted dictionary 
entries, which in my opinion is unnecessary since locally added/updated 
words can simply be marked by a boolean flag. Anyways - fix the delete 
problem ASAP.

javax.persistence.PersistenceException: 
org.hibernate.exception.ConstraintViolationException: could not execute 
update query
    at 
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerIm
pl.java:1179)
    at 
org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerIm
pl.java:1112)
    at 
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(Abstr
actEntityManagerImpl.java:1189)
    at 
org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:10
8)
    at 
com.drowltd.spellbook.core.service.DictionaryService.deleteWord(DictionaryS
ervice.java:244)
    at 
com.drowltd.spellbook.ui.desktop.SpellbookFrame.deleteWordDefinition(Spellb
ookFrame.java:1339)
    at 
com.drowltd.spellbook.ui.desktop.SpellbookFrame.access$2900(SpellbookFrame.
java:80)
    at 
com.drowltd.spellbook.ui.desktop.SpellbookFrame$27.actionPerformed(Spellboo
kFrame.java:1162)
    at 
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at 
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318
)
    at 
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:
387)
    at 
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at 
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListene
r.java:236)
    at 
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
    at java.awt.Component.processMouseEvent(Component.java:6263)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
    at java.awt.Component.processEvent(Component.java:6028)
    at java.awt.Container.processEvent(Container.java:2041)
    at java.awt.Component.dispatchEventImpl(Component.java:4630)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at 
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
    at 
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
    at 
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
    at java.awt.Container.dispatchEventImpl(Container.java:2085)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at 
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.jav
a:269)
    at 
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:1
84)
    at 
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.jav
a:174)
    at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at 
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: org.hibernate.exception.ConstraintViolationException: could not 
execute update query
    at 
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96
)
    at 
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.jav
a:66)
    at 
org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:110)
    at 
org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl
.java:421)
    at 
org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.j
ava:283)
    at 
org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1278)
    at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
    at 
org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:178)
    at 
org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99
)
    ... 30 more
Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint 
violation: FK775FA2A3BE93002B: PUBLIC.UNCOMMITTED_DICTIONARY_ENTRIES 
FOREIGN KEY(DICTIONARY_ENTRY_ID) REFERENCES PUBLIC.DICTIONARY_ENTRIES(ID); 
SQL statement:
delete from DICTIONARY_ENTRIES where word=? and dictionary_id=? [23003-117]
    at org.h2.message.Message.getSQLException(Message.java:105)
    at org.h2.message.Message.getSQLException(Message.java:116)
    at org.h2.message.Message.getSQLException(Message.java:75)
    at 
org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java
:377)
    at 
org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferent
ial.java:394)
    at 
org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java
:273)
    at org.h2.table.Table.fireConstraints(Table.java:768)
    at org.h2.table.Table.fireAfterRow(Table.java:783)
    at org.h2.command.dml.Delete.update(Delete.java:75)
    at org.h2.command.CommandContainer.update(CommandContainer.java:72)
    at org.h2.command.Command.executeUpdate(Command.java:208)
    at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStateme
nt.java:140)
    at 
org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:
129)
    at 
org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:101)
    ... 36 more

Original issue reported on code.google.com by lord...@gmail.com on 9 May 2010 at 3:45

GoogleCodeExporter commented 8 years ago

Original comment by iivalchev@gmail.com on 9 May 2010 at 4:41