File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Double Insert Oracle 11g / JPA / Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Double Insert Oracle 11g / JPA / Swing" Watch "Double Insert Oracle 11g / JPA / Swing" New topic

Double Insert Oracle 11g / JPA / Swing

Jeff Matthews

Joined: Jul 13, 2012
Posts: 4
I created a JPA project that also has a Swing project for a GUI that utilizes the JPA code to insert a record in an Oracle table via a stored procedure. The table has a trigger on it that generates a new ID via sequence.nextval. The stored procedure has OUT parameter for the new ID. The problem is, that when the code executes, two entries are made into the table with the same data.

The call to getResultList() in the executing code below is to get the OUT parameter that contains the new ID value. The message box that pops up fires only once. When I execute this code from another project like in Main().... a "stand alone" project, ( in other words not using via a GUI) everything works as expected. Meaning no double insert.

It's only when I fire it off via this GUI that I get the double insert.

Stored Proc

GUI Code

Class Code
Jeff Matthews

Joined: Jul 13, 2012
Posts: 4
Problem solved. Changed code to....

Consider Paul's rocket mass heater.
subject: Double Insert Oracle 11g / JPA / Swing
Similar Threads
call a stored procedure using eclipselink Problem...
Calling Stored Procedure thru JPA
eclipselink stored procedures with result returned from different tables
output parameter from stored procedure: Operand type clash: VARCHAR is incompatible with VOID Type
NamedStoredProcedureQuery gets no result