Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SequenceGenerator not working, TableGenerator is.

572079Apr 21 2008 — edited Apr 28 2008
I'm able to generate keys using a sequence-table. The annotations of the PK field are:

@Id
@GeneratedValue(generator="relation.relationnr", strategy=GenerationType.TABLE)
@TableGenerator( name="relation.relationnr", pkColumnValue="relationnr", table="sequence", pkColumnName="seq_name", valueColumnName="seq_count", initialValue=1, allocationSize=1)
@Column(name="relationnr")


But I'm not able to get the same behavior using sequences:

@Id
@SequenceGenerator( name="relation.relationnr", sequenceName="relationnr", allocationSize=1)
@GeneratedValue(generator="relation.relationnr", strategy=GenerationType.SEQUENCE)
@Column(name="relationnr")


With the second approach Toplink simply does not assing a value to the related field:

SQL errorcode: -391
SQL state: 23000
local message: Cannot insert a null into column (relation.relationnr).
java.sql.SQLException: Cannot insert a null into column (relation.relationnr).


The sequence exists:

select relationnr.nextval from _number where n = 1;

nextval

100246


Using another name for the sequence, or have the Toplink generate one, does not help.

Why isn't the sequence working?

Comments

Mike-Matthews-Oracle

This simply means the real-time screening jobs are not running.

There are steps in the guide for running these.

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 26 2008
Added on Apr 21 2008
20 comments
5,378 views