I'm seeing the same set of oracle numbers reused over and over and no
sequence increment. Any ideas what might be causing the problem? Here's the
details.
I'm running my struts application inside Eclipse using the SYSDEO Tomcat
plugin and Tomcat 4.1.27.
I'm connecting to Oracle 9i.
My oracle sequence is as follows.
SEQUENCE_NAME MIN_VALUE MAX_VALUE INCREMENT_BY C O
CACHE_SIZE
------------------------------ ---------- ---------- ------------ - -
----------
LAST_NUMBER
-----------
LOG_SEQ 1 1.0000E+27 1 N N
20
187731
My DbEntity definition is:
<db-entity name="LOG">
<db-attribute name="ADMINISTRATIVE_USER_ID" type="INTEGER" length="8"/>
<db-attribute name="FIELD_NAME" type="VARCHAR" isMandatory="true"
length="32"/>
<db-attribute name="FOREIGN_RECORD_KEY" type="INTEGER" length="8"/>
<db-attribute name="LOG_ID" type="INTEGER" isPrimaryKey="true"
isMandatory="true" length="8"/>
<db-attribute name="MODIFICATION_DATE" type="DATE" isMandatory="true"/>
<db-attribute name="NEW_VALUE" type="VARCHAR" length="255"/>
<db-attribute name="OLD_VALUE" type="VARCHAR" length="255"/>
<db-attribute name="TABLE_NAME" type="VARCHAR" isMandatory="true"
length="32"/>
<db-attribute name="USER_ID" type="INTEGER" length="8"/>
<db-key-generator>
<db-generator-type>ORACLE</db-generator-type>
<db-generator-name>LOG_SEQ</db-generator-name>
<db-key-cache-size>20</db-key-cache-size>
</db-key-generator>
</db-entity>
Starting with a new instance of my application, I start generating sequence
numbers between 187711 (20 below the LOG_SEQ.LAST_NUMBER value, 20 being my
cache size) and 187716. However, the This does not increase the database's
LOG_SEQ.LAST_NUMBER. It remains constant at 187731, the value before the
application started.
This is suspiciously (and the cache size is 20 both in the oracle table
and in my model definition).
Note that
cayenne WARN [Thread-6 09-10 17:44:43] QueryLogger: INSERT INTO LOG
(ADMINISTRATIVE_USER_ID, FIELD_NAME, FOREIGN_RECORD_KEY, LOG_ID,
MODIFICATION_DATE, NEW_VALUE, OLD_VALUE, TABLE_NAME, USER_ID) VALUES (?, ?,
?, ?, ?, ?, ?, ?, ?)
cayenne WARN [Thread-6 09-10 17:44:43] QueryLogger: [batch bind: NULL,
'lastConnectDate', 56, 187716, '2003-09-10 17:44:43.14', 'Wed Sep 10
17:44:43 EDT 2003', 'Wed Sep 10 00:00:00 EDT 2003', 'User', 56]
cayenne WARN [Thread-6 09-10 17:44:43] QueryLogger: [batch bind: NULL,
'failedPasswordResets', 56, 187717, '2003-09-10 17:44:43.14', '0', '0',
'User', 56]
cayenne WARN [Thread-6 09-10 17:44:43] QueryLogger: [batch bind: NULL,
'failedPasswords', 56, 187718, '2003-09-10 17:44:43.14', '0', '0', 'User',
56]
[...]
cayenne WARN [Thread-3 09-10 17:45:47] QueryLogger: [batch bind: NULL,
'lastConnectDate', 56, 187720, '2003-09-10 17:45:47.437', 'Wed Sep 10
17:45:47 EDT 2003', 'Wed Sep 10 00:00:00 EDT 2003', 'User', 56]
cayenne WARN [Thread-3 09-10 17:45:47] QueryLogger: [batch bind: NULL,
'failedPasswords', 56, 187721, '2003-09-10 17:45:47.437', '0', '1', 'User',
56]
cayenne WARN [Thread-3 09-10 17:45:47] QueryLogger: [batch bind: NULL,
'failedPasswordResets', 56, 187722, '2003-09-10 17:45:47.437', '0', '0',
'User', 56]
[...]
cayenne WARN [Thread-16 09-10 17:47:17] QueryLogger: [batch bind: NULL,
'lastConnectDate', 56, 187732, '2003-09-10 17:47:16.531', 'Wed Sep 10
17:47:16 EDT 2003', 'Wed Sep 10 00:00:00 EDT 2003', 'User', 56]
cayenne WARN [Thread-16 09-10 17:47:17] QueryLogger: [batch bind: NULL,
'failedPasswordResets', 56, 187714, '2003-09-10 17:47:16.531', '0', '0',
'User', 56]
cayenne WARN [Thread-16 09-10 17:47:17] QueryLogger: [batch bind: NULL,
'failedPasswords', 56, 187715, '2003-09-10 17:47:16.531', '0', '0', 'User',
56]
Note that we've now passed 187731 by 1, then started over at 187714.
at which point we throw:
Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint
(EBPP.SYS_C001743) violated
which is LOG_ID in my LOG table.
If anyone has any ideas before I start debugging this line-by-line tomorrow
morning, I'd love to hear them :) My experience with "raw access" to
sequences is minimal.
-Mike
This archive was generated by hypermail 2.0.0 : Wed Sep 10 2003 - 17:56:01 EDT