Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6976151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:27:35+00:00 2026-05-27T17:27:35+00:00

Oracle 11g silently rolls back a transaction upon commit if the transaction has a

  • 0

Oracle 11g silently rolls back a transaction upon commit if the transaction has a deferred constraint violation. One way to actually get an error is to set the constraint to immediate before calling commit. This works fine using Oracle SQL Developer, but doing this in a JPA (EclipseLink) native query results in the application locking up. Is there any alternative way to be notified if a deferred constraint was violated? Or perhaps I’m not using JPA correctly?

Table definition:

create table foo
(
foo_id integer not null,
order_id integer not null,
constraint foo_pk primary key (foo_id),
constraint foo_ak unique (order_id) deferrable
);

SQL to generate violation and see error displayed on console:

set constraint foo_ak deferred;
insert into foo values (1, 1);
insert into foo values (2, 1);
set constraint foo_ak immediate; -- Will rollback and display error

JPA attempting to reorder a collection of foo entities in Stateless Session Bean:

public void edit(List<Foo> foos) {
    Query deferred = em.createNativeQuery("set constraint foo_ak deferred");
    Query immediate = em.createNativeQuery("set constraint foo_ak immediate");

    deferred.executeUpdate(); // This works

    for(Foo f: foos) {
        em.merge(f); // This works too
    }

    immediate.executeUpdate(); // Hang with no output!
    // Note: if I comment out above line the transaction may 
    // be silently rolled back on deferred constraint violation
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:27:36+00:00Added an answer on May 27, 2026 at 5:27 pm

    Problem can be in statement caching and in application server transaction strategy.

    Try to:

    • enforce entity manager to send data to database by calling em.flush() after for {} execution

    and/or

    • Change @TransactionManagement attribute to bean managed and manage transaction in your method
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We've recently updated to Oracle 11g and our DBA has suggested using result caching
Is there a way to restore an Oracle 11g instance from raw data files
ORACLE 11g - COLDFUSION 9 - REF CURSOR - WITH at least one in
Currently our db Oracle 11g R2 enterprise db, has only 1 node and none
Is there a way to mandate table/column comments in Oracle 11g. Some Database parameters
Oracle 11g version of ODP.Net introduces the provider model objects (session state provider, identity
I am using Oracle 11g client, with ODP.NET. I am trying to add conditional
Using .Net and Oracle 11g - I've been returning dataTables from a procedure inside
Does anyone know why in Oracle 11g when you do a Count(1) with more
is there any problem to install different oracle 11g versions. I mean if I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.