Friday, November 12, 2010

Activation creates duplicate row when primary key is populated through DB sequence (Fixed in 11.1.1.4)

We are testing if our Application Module is Activation-Safe according to:
Fusion Developer's Guide for Oracle ADF
40.10 Testing to Ensure Your Application Module is Activation-Safe
And we have many problems.
1 of them is that when we press createInsert instead of creating a new row we get the same row 2 times.

I reproduce it in a simple test case from HR schema with Countries and Locations Entities.
In Locations Entity create method I populate primary key from sequence

@Override
protected void create(AttributeList attributeList) {
super.create(attributeList);
SequenceImpl s = new SequenceImpl("LOCATIONS_SEQ",getDBTransaction());
setLocationId(s.getSequenceNumber());
}

As in
Fusion Developer's Guide for Oracle ADF
4.12.5 Assigning the Primary Key Value Using an Oracle Sequence

I check Activation-Safe by un-checking Enable Application Module Pooling in configuration.


I have a simple master Countries form and detail Locations table with CreateInsert button.
When I press CreateInsert for first time a new row is created with new sequence as locationId and I fill also other fields with values.



When I press CreateInsert again instead of getting a new rows I get 2 same rows as the first and both of them has the same new sequence as primary key.!!??


After that whatever I do on the page I get null pointer exception. (NullPointerException)
Is this a bug?

Test case:
http://adfbugs.googlecode.com/files/TestActivateSequence.zip

6 comments:

  1. Looks like a pretty serious bug to me.

    Once the AM is disconnected from the database connection - despite of the fact that your AM configuration is set otherwise, activation never restores the database connection to its previous state.

    ReplyDelete
  2. It's a nasty bug in 11.1.1.3.0. Just tested it with 11.1.1.2.0 and it works fine.

    ReplyDelete
  3. Further to my comments above, if you look at the passivation data produced by versions 11.1.1.3.0 and 11.1.1.2.0 you will see that the Entities are NOT passivated (there is no EO tag in the passivated data)!

    ReplyDelete
  4. Hi Me too get same issue as dbsequence generated duplicate values...

    Can you please advice me on how to resolve this issue.

    Thanks,
    Suresh

    ReplyDelete
    Replies
    1. Hello this issue concerned an old version of jdeveloper 11.1.1.3 you should upgrate to latest versions if you are still there.

      Delete