Ronald
Ronald

Reputation: 2917

Mixing jdbc with hibernate?

Background: I am working on a web application, which uses oracle jdbc and access database with java code and also sql queries which will be executed by our engine.

Now I am thinking about "replacing" jdbc over the time with hibernate t have -let's say - hibernate advantages.

My question is, can this be done step by step?

Can I start to create new tables with hibernate and work with hibernate without having risk with the existing database structure? can hibernate works in parallel with jdbc?

Upvotes: 1

Views: 701

Answers (2)

Raj
Raj

Reputation: 727

Yes, JDBC and hibernate both can be used in parallel.

However, it depends on use cases. As per your question you just want to "replace" JDBC with Hibernate.

So, yes in this case you can start with :

  1. creating new tables
  2. creating hibernate mapping files
  3. creating DAO layer
  4. implementing hibernate code.

Upvotes: 1

Danny
Danny

Reputation: 286

The answer is positive.

You can have both jdbc and hibernate data-sources in the same project, no problem.

Just be careful not to mix up those two data-sources, that's all.

Upvotes: 3

Related Questions