SimpleORM – working with multiple db connections


In a recent project I had to handle with two simultaneous DB connections using SimpleORM. As you probably know SimpleORM, according with the official web site, is “a full featured Java object relational mapping system that avoids exotic technologies such as byte code generation [more]”. After spending some time in searching more info about how to implement the mechanism with SimpleORM I’ve decided to create my own mechanism.

Context:   I have a temporary table (called X_TBL) from a temporary DB  (called X_DB_TEMP)  and the same table into another DB (called X_DB).

Scenario:  Synchronize and process the records from the two tables, meaning: load records from temporary, process them and insert them into the second DB. Because I had to process a large number of records I’ve decided to split the records in small parts and process them separately.

Below you will find the most significant parts of code:

And the main class

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

  • Ciprian Radu says:

    You mistyped implements ;)

    Surely you must agree that you don’t do any parallel work. The work of thread 2 is serialized after the work of the first thread. With join() you merely wait for the second thread to finish its job and then you carry on.

    September 14, 2009 at 9:10 am
  • Laurentiu Ciovica says:

    Hi Ciprian,

    Thank you for your remark regarding the mistyped “implements” word.
    I do not think i mentioned in the post about parallel work :).
    I do not think I can do parallel processing with SimpleORM, probably from version 3.x+.
    Perhaps you are confused by the statement “simultaneous DB connections”. Surely you must agree that at a given time there are two simultaneous open connections to two different databases.
    If you have another approach please fell free to add a new post or a comment to this post.

    Thank you!
    All the best,
    Laurentiu C.

    September 14, 2009 at 10:36 am

Comments are closed.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.