AssignSequenceNumber does not work correctly

October 11 0
Advertisement
We use TopLink 9.0.4 with Oracle 9i, Oracle native sequences. When we assign an id to a freshly created object (created using uow.newInstance()) using uow.assignSequenceNumber(obj), we get a correct id from the sequence assigned to the id field. Fine!
But when the uow commits, TopLinks assigns a different id to this id field in the insert statement. (In fact, it is the id+2 if we do not create another object in between.)
So the id assigned by assignSequenceNumber is not the id we can find on the database.
Advertisement
Hi Doug!
Here is the configuration we are working with:
version: 10g (9.0.4)
build: 031126
snippet from sessions.xml:
     <project-xml>TestMappings.xml</project-xml>
     <session-type>
          <server-session/>
     </session-type>
     <login>
<platform-class>oracle.toplink.oraclespecific.Oracle9Platform</platform-class>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<connection-url>jdbc:oracle:thin:@gastdbsrv:1521:db02</connection-url>
<user-name>gschroeder</user-name>
<password>gschroeder</password>
<uses-native-sequencing>true</uses-native-sequencing>
<sequence-preallocation-size>50</sequence-preallocation-size>
<should-bind-all-parameters>false</should-bind-all-parameters>
<should-cache-all-statements>false</should-cache-all-statements>
<uses-byte-array-binding>true</uses-byte-array-binding>
<uses-string-binding>true</uses-string-binding>
<uses-streams-for-binding>true</uses-streams-for-binding>
<should-force-field-names-to-uppercase>false</should-force-field-names-to-uppercase>
<should-optimize-data-conversion>true</should-optimize-data-conversion>
<should-trim-strings>true</should-trim-strings>
</login>
Snippet from mapping.xml:
<descriptor>
<java-class>gast.bs.dh.generator.person.MitarbeiterListe</java-class>
<tables>
<table>MITARBEITERLISTE</table>
</tables>
<primary-key-fields>
<field>MITARBEITERLISTE.ID</field>
</primary-key-fields>
<descriptor-type-value>Normal</descriptor-type-value>
<sequence-number-field>MITARBEITERLISTE.ID</sequence-number-field>
<sequence-number-name>MITARBEITERLISTE_SEQ</sequence-number-name>
<identity-map-class>oracle.toplink.internal.identitymaps.SoftCacheWeakIdentityMap</identity-map-class>
<remote-identity-map-class>oracle.toplink.internal.identitymaps.SoftCacheWeakIdentityMap</remote-identity-map-class>
<identity-map-size>100</identity-map-size>
<remote-identity-map-size>100</remote-identity-map-size>
<should-always-refresh-cache>true</should-always-refresh-cache>
<should-always-refresh-cache-on-remote>false</should-always-refresh-cache-on-remote>
<should-only-refresh-cache-if-newer-version>false</should-only-refresh-cache-if-newer-version>
<should-disable-cache-hits>true</should-disable-cache-hits>
<should-disable-cache-hits-on-remote>false</should-disable-cache-hits-on-remote>
<alias>MitarbeiterListe</alias>
<copy-policy>
<descriptor-copy-policy>
<type>oracle.toplink.internal.descriptors.CopyPolicy</type>
</descriptor-copy-policy>
</copy-policy>
<locking-policy>
<descriptor-locking-policy>
<write-lock-field>MITARBEITERLISTE.VERSIONSNR</write-lock-field>
<is-stored-in-cache>false</is-stored-in-cache>
<type>oracle.toplink.descriptors.VersionLockingPolicy</type>
</descriptor-locking-policy>
</locking-policy>
<instantiation-policy>
<descriptor-instantiation-policy>
<type>oracle.toplink.internal.descriptors.InstantiationPolicy</type>
</descriptor-instantiation-policy>
</instantiation-policy>
<query-manager>
<descriptor-query-manager>
<existence-check>Check cache</existence-check>
</descriptor-query-manager>
</query-manager>
<event-manager>
<descriptor-event-manager empty-aggregate="true"/>
</event-manager>
<mappings>
<database-mapping>
<attribute-name>id</attribute-name>
<read-only>false</read-only>
<field-name>MITARBEITERLISTE.ID</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>mitarbeiterListe</attribute-name>
<read-only>false</read-only>
<reference-class>gast.bs.dh.generator.person.Mitarbeiter</reference-class>
<is-private-owned>false</is-private-owned>
<uses-batch-reading>false</uses-batch-reading>
<indirection-policy>
<mapping-indirection-policy>
<type>oracle.toplink.internal.indirection.BasicIndirectionPolicy</type>
</mapping-indirection-policy>
</indirection-policy>
<container-policy>
<mapping-container-policy>
<container-class>java.util.Vector</container-class>
<type>oracle.toplink.internal.queryframework.ListContainerPolicy</type>
</mapping-container-policy>
</container-policy>
<source-key-fields>
<field>MITARBEITERLISTE.ID</field>
</source-key-fields>
<target-foreign-key-fields>
<field>MITARBEITER.MITARBEITERLISTE</field>
</target-foreign-key-fields>
<type>oracle.toplink.mappings.OneToManyMapping</type>
</database-mapping>
<database-mapping>
<attribute-name>versionsNr</attribute-name>
<read-only>false</read-only>
<field-name>MITARBEITERLISTE.VERSIONSNR</field-name>
<type>oracle.toplink.mappings.DirectToFieldMapping</type>
</database-mapping>
</mappings>
<type>oracle.toplink.publicinterface.Descriptor</type>
</descriptor>
Maybe this helps in cornering the error.
Regards,
Gerald
AssignSequenceNumber does not work correctly

We use TopLink 9.0.4 with Oracle 9i, Oracle native sequences. When we assign an id to a freshly created object (created using uow.newInstance()) using uow.assignSequenceNumber(obj), we get a correct id from the sequence assigned to the id field. Fine

Sequence number different in DB than from assignSequenceNumber()

I am using TopLink 10.1.3 DP4 (I think - inside JDev build 3565). I am attempting to use a sequence in a schema that I DO NOT OWN - I cannot make modifications tot he database sequence because there are other applications in place running against it.

Filename in non-english are not saved correctly

hi I recently (last week) installed archlinux. I come from manjaro so I am to some extent familiar with archlinux. now I am trying to solve some issues that have poped up in arch that there were not in manjaro( mostly because manjaro was pre-configur

Strange scenario,Oracle can not display the data in mysql correctly

I use Heterogeneous Service+ODBC to achieve "oracle access mysql"(any other method?),and now i find Oracle can not display the data in mysql correctly: -------mysql------------ mysql> create table tst(id int,name varchar(10)); Query OK, 0 row

Can no longer enter data in the address bar {url Bar}, it correctly follows data from google search bar. It was a 1 month old installation so not a lot of complications

I was not adding anything to Firefox. I Refused tool bars embedded in several application installs on this new computer. Was working fine. Then had a problem with Google search, restored default values and re-tooled Firefox. At this point all worked

Time From field is not getting displayed in correct format in Activities

Hello Experts , We are facing one problem in UI , when we search for Activities in Web UI . In the field "Time From" we are not getting the time in correct format , ie is instead of  getting time as say 13::38 we are getting time as 13::3 , but

Help. Windows 7: The application was unable to start correctly (0xc0150002).

I just got a new computer. Windows 7. Toshiba. Intel 13-3110M Processor. 6GB DDR3 Memory. 1TB 5400rpm Hard Drive. Intel HD Graphics 4000. 2.40 GHz. 64-bit operating system. I installed CS5 Creative Suite on it (which worked perfectly fine on my two p

Auditioning wav loops at correct tempo

Hi Forum I have been a Protools user for several years, but because of all the usual annoyances with PT I have decided to join the Logic camp, just today in fact. However one feature I am immediately missing is the protools equivalent of "Calculate E

How to make mac address gmail contacts overwrite the ones on my HTC Android phone - I don't want to sync - that makes the phone scramble and overwrite my computer.  I want to remove or correctly overwrite the phone information as I have done with iPad.

Please help - I am beginning to hate google, my android and gmail.  I have just wasted about 5 hours in a futile attempt to try and get my current Mac contacts list on my computer updated to my phone. I'm not that computer literate but I have looked

How can we get Apple to correct this issue?

I have been a supporter and user of Apple since the IIe days.  I still have a G4 on my desktop that works just fine with the software that was useful for those times.  I have worked with a laptop Mac Pro since the fall of 2007 without any real major

Sorting not working correctly for date field in alv report

Hi All, My report displays many rows also containing date type fields of bldat,budat . When I sort the report selecting field of type bldat budat the sorting is not correct for the year. Ex: Invoice doc dat 01-25-2011 01-21-2011 02-02-2011 10-25-2010

Discoverer Report opened from Portal does not show correct data

Hi, When I try to open a Discoverer report from a portal that I created, it shows stale data but when I click on "Analyze", it shows all the data correctly. Does anyone know what the reason could be for this? Thank you, SantoshiI assume you used

10g exporting to CSV using client_text_io is not working correctly.

I have an odd issue which i could do with some help with. I run an function that exports to CSV based on an pre defined record group. This has been working fine for many months with various customers. Recently a new customer used it and they have 28k

How can I correct for 2 different color temperatures in one image?

Hi, In indoor architectural photography one may encounter mixed color temperatures in one image. If one could use gels and lamps to replace incoming natural daylight and force a uniform color temperature (for instance tungsten) then the problem would

My old email account was disabled and I can't remember my password - how can I reset my password or move $ to a new itunes/email account?  It seems I must have mis-typed my information because I can't answer the security questions correctly...

My old email account is disabled and I can't remember my itunes password - how can I reset my password or move $ to a new itunes/email account?  It seems I must have mis-typed my account information because I can't answer the security questions corre

9630 Keyboard/Buttons not working; hard resets and multiple reloads of OS did not correct

My BlackBerry 9630 Tour is a little more than a year old. Yesterday the keyboard, trackball, and all buttons stopped working while I was typing out an email. I could not power off the Blackberry without removing the battery for a hard reset. Unfortun

My iCloud account name was inputted incorrectly when my iPhone was set up. I made a new iCloud account but my phone still automatically loads the old and unusable iCloud account. How can I update my phone to load the new and correct account?

My iCloud account name was inputted incorrectly during initial phone set up. I created another iCloud account name but it is still the old and wrong iCloud account that automatically loads whenever I access the iCloud tab on my phone. How do I replac

I'm not able to create a iphoto calendar with the correct birthday entries.

Hello, I use the latest Iphoto version and OS X 10.9. I tried to create a calendar in iphoto that includes all birthday information of my family. Unfortunately I'm not able to do this. I tried two differnt ways to get the information into the calenda

My iPod touch is not playing the songs on the playlists in the correct order. Can anyone help?

My ipod touch is not playing the songs on the playlist in the correct order.You can redownload most iTunes purchases by: Downloading past purchases from the App Store, iBookstore, and iTunes Store         Read other 4 answers

Getting error while creating a new web app saying "The password supplied with the username domainname\username was not correct. Verify that it was entered correctly and try again"

Hi , I am trying to create a new web app using Central Administration in Sharepoint 2010 and getting an error "The password supplied with the username  was not correct. Verify that it was entered correctly and try again". I tried running this co