aspose file tools*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Double Insert Oracle 11g / JPA / Swing" Watch "Double Insert Oracle 11g / JPA / Swing" New topic
Author

Double Insert Oracle 11g / JPA / Swing

Jeff Matthews
Greenhorn

Joined: Jul 13, 2012
Posts: 2
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
Greenhorn

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Double Insert Oracle 11g / JPA / Swing
 
Similar Threads
eclipselink stored procedures with result returned from different tables
output parameter from stored procedure: Operand type clash: VARCHAR is incompatible with VOID Type
call a stored procedure using eclipselink Problem...
NamedStoredProcedureQuery gets no result
Calling Stored Procedure thru JPA