This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 1511
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: http://aspose.com/file-tools
 
subject: Master child details update using JPA
 
Similar Threads
Strange oracle problem--plz HELP
ORA-01002: fetch out of sequence when trying to insert CLOB data into Oracle
error- help
SQLException Calling Stored Procedure
Inserting Blob throws Exception