Solved

Can I use Hibernate for partial database migrations?

Posted on 2011-03-06
5
528 Views
Last Modified: 2012-08-14
Hello,

a hibernate newbie with a question:

I have an oracle database that is used in a client-server application (using Delphi).
I plan to migrate to a Java EE / Spring architecture using Hibernate as a persistence framework.
For this I would reverse engineer the existing oracle database (probably using hibernate tools in eclipse, this is ok and not part of the questions here)

And I would like to continue running the legacy system against the database.
The plan is to migrate one usergroup after another to the new architecture, this to avoid having to migrate the whole application at once.

Questions:
* is this coexistence of one database running with the legacy CS application AND the new hibernate-based application possible? Do you see problems? Where? Any particular points to consider in Hibernate?
* what have other readers done to solve a similar problem?
* Do you see alternatives to Hibernate (in the java world, if possible using the Spring framework)?

Big questions, important questions, hence 500 points :)

Thanks a lot & regards,

Daniel
0
Comment
Question by:waeberd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 17

Expert Comment

by:Dejan Pažin
ID: 35053964

* is this coexistence of one database running with the legacy CS application AND the new hibernate-based application possible? Do you see problems? Where? Any particular points to consider in Hibernate?

One thing you have to watch out for is how the primary keys are acquired - to avoid any conflicts due to two systems running on the same table. Basicly you have to first find out what system is being used on the old application and what Hibernate will use and then think about possible conflicts.

* what have other readers done to solve a similar problem?

To avoid such problems we decided at the start of development that server and Hibernate are single point of entry to our database.

* Do you see alternatives to Hibernate (in the java world, if possible using the Spring framework)?

There are other persistence frameworks, but i dont think any of them match the power of Hibernate. Some of them might be simpler in some aspects, but considering the task you described, that is not what you need.

Here is a list of such frameworks:

http://java-source.net/open-source/persistence

0
 

Author Comment

by:waeberd
ID: 35054152
Thank you dejanpazin,

One thing you have to watch out for is how the primary keys are acquired
Primary keys are systematically acquired using oracle sequences, I plan to reuse the same sequences.

...we decided at the start of development that server and Hibernate are single point of entry to our database...
Does that mean you have exactly  two points of entry, one for the legacy server and one for the Hibernate-layer?

There are other persistence frameworks, but i dont think any of them match the power of Hibernate
Good, thank you! We have many tables and some performance-critical SQL-queries.

One other thing is:
I will use reverse engineering to build up the hibernate layer. This has consequences on the design. Somehow, the common database is the master for the persistence layer. In a perfect ORM world (you know: where 50 devs can start from scratch at once....  :-) ) the opposite is often the case: Objects are master over the database.

How does Hibernate "live" with this real-life constraint of reverse engineering?

Thanks, Daniel
0
 
LVL 17

Accepted Solution

by:
Dejan Pažin earned 500 total points
ID: 35054371


>> Does that mean you have exactly  two points of entry, one for the legacy server and one for the Hibernate-layer?

No, it means we never have legacy system simultaniously with the new one. We make the transition in one step and only have one system at a time.

>> We have many tables and some performance-critical SQL-queries.

You have to be very careful using Hibernate when it comes to performance. The programmers who work with Hibernate have to know exactly what happens in the sql layer, otherways you can run into havy performance issues. But since you already have the database that wont be such a big issue - you just have to rewrite the queries.

>> In a perfect ORM world (you know: where 50 devs can start from scratch at once....  :-) ) the opposite is often the case: Objects are master over the database.


Even in a perfect ORM world there are debates no which approach to use. Using the relations to objects gives you good control over performance issues. The other way around gives you better view of object hierarchy.

>> How does Hibernate "live" with this real-life constraint of reverse engineering?

It will live just fine, but you have to take good care of it - meaning dont leave anything to coincidence, check all objects, know what is going on in the sql layer, manually improve things where needed.


0
 

Author Comment

by:waeberd
ID: 35054696
No, it means we never have legacy system simultaniously with the new one. We make the transition in one step and only have one system at a time.

Not sure if we have the same architecture in mind:
In my "blueprint":

there will be exactly one database server
The old clients don't use hibernate but will continue to access the oracle database directly
The new application server will be build using hibernate.

So the "legacy" is rather the usage of the old clients. Already today the system is used concurrently, locking and primaryKey-IDs are handled on the database server.

You have to be very careful using Hibernate when it comes to performance. ... But since you already have the database that wont be such a big issue - you just have to rewrite the queries.

The key is that it is possible to rewrite the critical queries while not having to write all the boilerplate code. I read from your post that this is absolutely possible using Hibernate.
And still hard work of course. No silver bullet...

Thanks dejan, I feel confident now :-)

0
 

Author Closing Comment

by:waeberd
ID: 35069424
Thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help on decision table structure 7 57
junit example issue 2 53
oracle query 3 34
MS SQL Server Management Studio R2 4 59
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question