I forgot to mention that we're using JBoss 3.2.1 and thin driver for Oracle 9i. Also, I see in the database log that following statements are passed in:
1. SELECT PCM_RT_SEQ.nextval FROM DUAL
2. SELECT COUNT(*) FROM mytable WHERE id='21'
3. INSERT INTO mytable(id, field1) VALUES ('', '')
and line 3 throws exception:
java.sql.SQLException: ORA-01400: cannot insert NULL into ("mytable"."ID")
So, it seem that the problem is that entity obtains sequence generated primary key(step 1), checks for duplication(step 2) and does not setup primary key.