Announcement Announcement Module
Collapse
No announcement yet.
Sybase: errore retrive generate key Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sybase: errore retrive generate key

    Good morning,
    I'm using Spring 3.0.5, but i tried 3.1.1 with the same reults.
    The old database was Sybase 12 but now the db is version 15.
    The code with version 12 works fine, but now with the version 15 make an error when is executed "si07.executeAndReturnKey":
    "Unable to retrieve the generated key for the insert"
    The driver uses ins jtds-1.2.5

    The java code:
    Code:
    SimpleJdbcInsert si07 = new SimpleJdbcInsert(this.getDataSource());
    si07.setTableName("GDVistaUtente");
    si07.usingGeneratedKeyColumns("IdVistaUtente");
    si07.compile();
    Map<String, Object> par07 = new HashMap<String, Object>(2);
    par07.put("CodeUtente", uv.getCute());
    par07.put("NomeVistaUtente", uv.getTnom());
    par07.put("FlagDefault", uv.getFdfl());
    par07.put("CodeInsUtente",uv.getCinsute());
    par07.put("DataInsUtente",uv.getDinsute());
    BigDecimal ni07 = (BigDecimal) si07.executeAndReturnKey(par07);
    the error:
    Code:
    org.springframework.jdbc.core.metadata.TableMetaDataProviderFactory$1.processMetaData(TableMetaDataProviderFactory.java:90)  - Using GenericTableMetaDataProvider
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.initializeWithMetaData(GenericTableMetaDataProvider.java:166)  - GetGeneratedKeys is supported
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.initializeWithMetaData(GenericTableMetaDataProvider.java:184)  - GeneratedKeysColumnNameArray is supported for ASE
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:363)  - Retrieving metadata for SPEITA/dbo/GDVistaUtente
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: IdVistaUtente 2 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: CodeUtente 1 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: NomeVistaUtente 12 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: FlagDefault 2 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: CodeInsUtente 1 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: DataInsUtente 93 false
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: CodeUpdUtente 1 true
    org.springframework.jdbc.core.metadata.GenericTableMetaDataProvider.processTableColumns(GenericTableMetaDataProvider.java:399)  - Retrieved metadata: DataUpdUtente 93 true
    org.springframework.jdbc.core.simple.AbstractJdbcInsert.compileInternal(AbstractJdbcInsert.java:287)  - Compiled JdbcInsert. Insert string is [INSERT INTO GDVistaUtente (CodeUtente, NomeVistaUtente, FlagDefault, CodeInsUtente, DataInsUtente, CodeUpdUtente, DataUpdUtente) VALUES(?, ?, ?, ?, ?, ?, ?)]
    org.springframework.jdbc.core.simple.AbstractJdbcInsert.compile(AbstractJdbcInsert.java:269)  - JdbcInsert for table [GDVistaUtente] compiled
    org.springframework.jdbc.core.simple.AbstractJdbcInsert.executeInsertAndReturnKeyHolderInternal(AbstractJdbcInsert.java:441)  - The following parameters are used for call INSERT INTO GDVistaUtente (CodeUtente, NomeVistaUtente, FlagDefault, CodeInsUtente, DataInsUtente, CodeUpdUtente, DataUpdUtente) VALUES(?, ?, ?, ?, ?, ?, ?) with: [555555, default, 1, 555555, Wed Apr 18 08:49:12 CEST 2012, null, null]
    org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:840)  - Executing SQL update and returning generated keys
    org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:569)  - Executing prepared SQL statement
    org.springframework.jdbc.core.simple.AbstractJdbcInsert.prepareStatementForGeneratedKeys(AbstractJdbcInsert.java:536)  - Using generated keys support with array of column names.
    org.springframework.jdbc.core.JdbcTemplate$3.doInPreparedStatement(JdbcTemplate.java:859)  - SQL update affected 1 rows and returned 0 keys
    org.springframework.jdbc.core.JdbcTemplate.handleWarnings(JdbcTemplate.java:1258)  - SQLWarning ignored: SQL state '01000', error code '5702', message [ASE is terminating this process.
    ]
    2012-04-18 08:49:42,115 http-8080-Processor25 ERROR org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:414)  - Application exception overridden by rollback exception
    org.springframework.dao.DataIntegrityViolationException: Unable to retrieve the generated key for the insert: INSERT INTO GDVistaUtente (CodeUtente, NomeVistaUtente, FlagDefault, CodeInsUtente, DataInsUtente, CodeUpdUtente, DataUpdUtente) VALUES(?, ?, ?, ?, ?, ?, ?)
    	at org.springframework.jdbc.core.simple.AbstractJdbcInsert.executeInsertAndReturnKeyInternal(AbstractJdbcInsert.java:431)
    	at org.springframework.jdbc.core.simple.AbstractJdbcInsert.doExecuteAndReturnKey(AbstractJdbcInsert.java:380)
    	at org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey(SimpleJdbcInsert.java:122)
    	at it.arval.driver.dao.impl.JdbcUtenteVistaDAO.insert(JdbcUtenteVistaDAO.java:156)
    Any ideas?
Working...
X