Hi, I'm using JPA with an Oracle10g backend. I'm implementing a many-tomany relation ship using a join table: tbl_job_type <-> tbl_join_job_type_tags <-> tbl_tags
I'm not sure how to include the information regarding sequence generator in my annotation. I.e. when I add a tag to a job_type my persist call fails because the record to be persisted on tbl_join_job_type_tags was not initialized with an id.
Here is my definition on the job_types side: @Table(name = "XEDOC_ADMIN.TBL_JOB_TYPES") public class JobType implements java.io.Serializable {
@SuppressWarnings("unused") @Column(name="OBJ_VERSION") private int version;
private Integer id; .... snip ... private UserDomain userOwner; private UserDomain userModifier; private SortedSet<Tag> tags;
.... snip ...
@ManyToMany() @JoinTable(name = "TBL_JOIN_JOB_TYPE_TAGS", joinColumns = { @JoinColumn(name="JOB_TYPE_ID") }, inverseJoinColumns = { @JoinColumn(name="TAG_ID") }) @Sort(type = SortType.COMPARATOR, comparator = TagComparator.class) public SortedSet<Tag> getTags() { return tags; }
The error: java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("XEDOC_ADMIN"."TBL_JOIN_JOB_TYPE_TAGS"."ID")
How can I tell JPA to use the a sequence generator to obtain a unique ID for records to be created?
TIA
Jacques
|