net.ucanaccess.jdbc.UcanaccessSQLException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • First goes mappings, logs, code etc. Below find lyric description. Mapping: {code:xml} <class name="SimcCodedAddressTypeTest$SampleTestEntity2" table="address_entity2"> <id name="id" column="id" type="int"> <generator class="native"></generator> </id> <set name="sampleVOS" table="vos"> <key column="FKentity" not-null="true"> </key> <composite-element class="pl.frati.dynx.contact.hibernate.types.SimcCodedAddressTypeTest$SampleVO"> <property name="id" not-null="true" /> <property name="name" /> <property name="address" type="pl.frati.dynx.contact.hibernate.types.SimcCodedAddressType"> <column name="simc_1" /> <column name="street_1" /> <column name="building_no_1" /> <column name="flat_no_1" /> <column name="postal_code_1" /> <column name="post_office_1" /> </property> </composite-element> </set> </class> {code} Assume that there is entity that contains two value objects in the set, and the code tries to remove one of them: {code:java} session = sf.openSession(); session.beginTransaction(); entity = (SampleTestEntity2) session.get(SampleTestEntity2.class, entityId); Assert.assertNotNull(entity); Assert.assertNotNull(entity.sampleVOS); Assert.assertEquals(2, entity.sampleVOS.size()); Assert.assertTrue(entity.sampleVOS.contains(vo1)); Assert.assertTrue(entity.sampleVOS.contains(vo2)); entity.sampleVOS.remove(vo2); session.getTransaction().commit(); session.close(); {code} This will cause an exception that is attached, but most important part is: {panel} org.hibernate.exception.GenericJDBCException: could not delete collection rows: [pl.frati.dynx.contact.hibernate.types.SimcCodedAddressTypeTest$SampleTestEntity2.sampleVOS#1] at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) Caused by: java.sql.SQLException: Invalid argument in JDBC call: parameter index out of range: 3 at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) [...] at pl.frati.dynx.contact.hibernate.types.SimcCodedAddressType.nullSafeSet(SimcCodedAddressType.java:195) [...] Caused by: org.hsqldb.HsqlException: Invalid argument in JDBC call: parameter index out of range: 3 at org.hsqldb.error.Error.error(Unknown Source) {panel} and the log is: {panel} Hibernate: delete from vos where FKentity=? and id=? 2014-02-18 17:46:11,536 INFO - HHH000010: On release of batch it still contained JDBC statements [[org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl]] 2014-02-18 17:46:11,537 WARN - SQL Error: -423, SQLState: S1000 [[org.hibernate.engine.jdbc.spi.SqlExceptionHelper]] 2014-02-18 17:46:11,537 ERROR - Invalid argument in JDBC call: parameter index out of range: 3 [[org.hibernate.engine.jdbc.spi.SqlExceptionHelper]] {panel} *What happens?* Well it seems that there is some kind of bug in handling CompositeUserType. Hibernate tries to delete given Value Object. Normally, if there are no not-null properties in the composite-element everything goes fine - Hibernate runs following query: {panel} delete from vos where FKentity=? and id=? and name=? and simc_1=? and street_1=? and building_no_1=? and flat_no_1=? and postal_code_1=? and post_office_1=? {panel} However when any field is marked as not-null this causes creation of primary key. Lets assume that field {{id}} in composite-element is marked not-null. This should result in following SQL: {panel} delete from vos where FKentity=? and id=? {panel} And it does. The problem is that Hibernate still tries to bind values of {{address}} property, despite it does not belong to primary key. As they are not expected (only FKentity and id are expected) this causes index out of range exception, as there is no third parameter, so there is no parameter to bind to. *Workaround*: Mark all properties in composite-element as {{not-null="false"}}. *Other facts*: 1. when no CompositeUserType is used everything works fine 2. when UserType is used everything works fine as well 3. CompositeUserType used in entity works fine
    via by Rafal Figas,
  • Schema level sequences in HSQL
    via Stack Overflow by Michal
    ,
  • Set text tables hsqldb Java
    via Stack Overflow by Souad
    ,
    • net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.6 estado del cursor incorrecto: cursor indicado no está abierto at net.ucanaccess.jdbc.UcanaccessResultSet.getMetaData(UcanaccessResultSet.java:480) at negocio.CtrlVendedores.buildTableModel(CtrlVendedores.java:38) at negocio.CtrlVendedores.cargarListaVendedores(CtrlVendedores.java:23) at ui.GestionVentas.<init>(GestionVentas.java:95) at ui.GestionVentas$1.run(GestionVentas.java:63) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.sql.SQLException: estado del cursor incorrecto: cursor indicado no está abierto at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source) at org.hsqldb.jdbc.JDBCResultSet.checkClosed(Unknown Source) at org.hsqldb.jdbc.JDBCResultSet.getMetaData(Unknown Source)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,