Skip to Main Content

Java SE (Java Platform, Standard Edition)

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to save data in Master-Detail tables with seq PKs in Java?

GadoMay 23 2017 — edited May 23 2017

Hello Experts,

I'm building a Sales Order application.

And now i'm stuck in how to save the sales Order.

I know how to insert records in a single database table ... but now i want to save in both tables.

I want to insert a record in the master SalesOrder table and the items in the detail SalesOrderItems at the same time.

The Primary keys in both tables are assigned using a database sequence so i don't know how to handle the relation between them

There is no way to know the SalesOrder (Master)'s PK to assign as a FK in the SalesOrderItems (Detail) table at the time i'm saving the data.

Is this possible?

Thank you for your time

Gado

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2017
Added on May 23 2017
1 comment
865 views