File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Does DataFieldMaxValueIncrementer achieve portability? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Does DataFieldMaxValueIncrementer achieve portability?" Watch "Does DataFieldMaxValueIncrementer achieve portability?" New topic
Author

Does DataFieldMaxValueIncrementer achieve portability?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi.
We are using Spring JDBC support classes to access the database.
Currently, we are using PostgreSQL as the development and testing database but the production system could be MySQL.
ID columns are sequences (auto increment for MySQL in the future plan).
I found this utility class:
DataFieldMaxValueIncrementer
with implementation for different RDBMS (PostgreSQL, MySQL, DB2 ...)
Can I depend on it to achieve portability between PostgreSQL sequences and MySQL auto-increment columns?
Thanks.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Yes, that's the idea - you abstract away the source of the unique IDs for your persistent objects, thereby making the potential migration from PostgreSQL to MySQL a matter of setting up the new database schema and reconfiguring your application with a different incrementer implementation.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

For PostgreSQL database, I use:

But for MySQL database, there is no sequence to name.
What to do?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You pass in the name of the table you use to simulate a sequence, then, like the javadocs suggest.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does DataFieldMaxValueIncrementer achieve portability?