File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
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
Author

Master child details update using JPA

Suhas Mohamedali
Greenhorn

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(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)

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: 1527
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]
 
Consider Paul's rocket mass heater.
 
subject: Master child details update using JPA