Skip to Main Content

Java Development Tools

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!

master detail detail with db sequence

kcjimJul 30 2007 — edited Jul 31 2007
using adf/bc with jsf. i have tables with a parent, child, grandchild relationship with one another. their relationship is defined by intelligent (composite foreign) keys. so, i created the appropriate view link objects between each of these tables, which have a composition association. in my application, i have a need to create a new record for each of these tables simultaneously, so that the user can enter in values for records of each of these tables. in order to do this, for now i've just dropped the create(insert) method of each view object onto the jsp as a button. so, when the page renders, i'm able to click the create button of each view object in the appropriate order, starting with the parent table. the important thing to mention here is that the primary key of the parent table is defined as a DBSequence type and its value is generated by a sequence when the insert occurs. when i click the create button for the child and grandchild records, i see the appropriate temporary negative value gets 'transferred' from the parent record on down to it's child, which is what i would expect. for example, the primary key column of the parent is hris_id, and gets assigned the temporary negative value of -2, which is the value i see for this column in both the child and grandchild records after doing the create/insert. but, when i do the commit, i get the error telling me that there's an integrity constraint, that the grandchild record doesn't have a parent. i'm pretty sure this has something to do with the fact that i'm using a dbsequence in conjunction with intelligent keys on the insert and somehow the appropriate synchronization of child/grandchild records is not being handled automatically by the framework. The reason i say this is that i've set up this scenario in which i use surrogate keys on each of the tables and define the primary keys of each of these entities as dbsequence type and things work great on the commit. I've also set this up where the tables again utilize intelligent keys but the parent entity does not define its parent key as a dbsequence type, but is instead just a Number type in which the user must enter the value. Again, this scenario works fine. Can anyone tell me what i must do to be able to create a record for each of these entities in succession when the tables are related via intelligent keys and the primary key of the parent, which ends up being a foreign key in the child/grandchild tables, is defined as a dbsequence type?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2007
Added on Jul 30 2007
2 comments
697 views