The moose likes EJB and other Java EE Technologies and the fly likes Master child details update using JPA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Master child details update using JPA" Watch "Master child details update using JPA" New topic

Master child details update using JPA

Suhas Mohamedali

Joined: Jun 05, 2012
Posts: 29
I have two tables

master_table : 'BenefitFileHdr ' and child_table: BenefitFileDtl

PK of master table is FK of child table.

One column start_date is getting updated from the GUI and needs to to be updated in DB.

Please check the code below.

when try to save the code i get following exception.

Caused by: java.sql.SQLException: ORA-02291: integrity constraint (SLMTEST.FK_BENEFIT_HDR_DTL) violated - parent key not found

at oracle.jdbc.dbaccess.DBError.throwSqlException(
at oracle.jdbc.ttc7.TTIoer.processError(
at oracle.jdbc.ttc7.Oall7.receive(
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(
at oracle.jdbc.driver.OracleStatement.executeNonQuery(
at oracle.jdbc.driver.OracleStatement.doExecuteOther(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(
at org.hibernate.hql.ast.exec.BasicExecutor.execute(

I tried to save the parent first. Still i got error mentioning children are there.

Mapping has been done as

Please suggest a solution for update
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1599
I googled and found this page. Check if this applies is in your case.

Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
I agree. Here's the link:
subject: Master child details update using JPA
It's not a secret anymore!