• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Migrating Toplink/ADF application to MySQL

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have a J2EE application based on Toplink (10.1.3.5) / ADF / Oracle db. We tried to migrate it to MySql. We slightly changed data structure (IDs, some data types) and succesfully migrated data from Oracle to MySql. We even started the application, but we are stuck at some strange toplink error:

[TOPLINK-7197] (Oracle TopLink - 10g Release 3 (10.1.3.5.0) (Build 090715)): oracle.toplink.exceptions.ValidationException
Exception Description: Exception calculating changes. Primary Key can not be set to null.

We searched in code and found out the source of the problem - method hasChanges() in UnitOfWork object.
The problem started when we succesfully inserted new record to database (via form) and tried to return from form to list of records.

Does anybody have any experience with migrating Toplink/ADF application to MySql ? Please share your experience.

Thanks.
 
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What form of sequencing are you using? Did you switch to IDENTITY sequencing with MySQL? This has very different semantics, as you do not get the Id assigned until after the insert, so it is not available after the persist call.

This may be triggering your application to be incorrectly changing the Id of an object.

Try switching to TABLE sequencing, as this allows the pre-allocation of the Id, so would be more similar to Oracle. In general I would never recommend IDENTITY sequencing, as it is much less efficient as it cannot pre-allocate values.
 
Jiri Nejedly
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On Oracle we used sequence - "Use Native Sequencing" option in Toplink descriptor.
When switching to MySQL platform, the "Use Native Sequencing" became unavailable.
We set the first choice - Use Deafult Sequence Table (?)
Every table used has id ... NOT NULL AUTO_INCREMENT

There's no such choice as 'Identity sequencing' in TL descriptor.

J.N.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have specified TABLE sequencing and are using an AUTO_INCREMENT column that is probably the problem.

Remove the AUTO_INCREMENT.

IDENTITY is the JPA terminology, in TopLink API this is native sequencing. I don't think 10.1.3 supported identity sequencing on MySQL, so you would need to use table sequencing or upgrade to EclipseLink (TopLink 11g).
 
reply
    Bookmark Topic Watch Topic
  • New Topic