0

I am currently working on order management system.There is a rest application in java already being used for other flows. And the application currently uses JDBC to connect to the database.

For order management I was wondering if I could use hibernate. Will it cause any problems w.r.t connection threads?

newbee
  • 31
  • 6
  • If you do use Hibernate on the same tables as JDBC, make sure you have the correct settings for Hibernate's cache, otherwise you might run into strange problems. Transaction setting would also need to be thought through.. When it comes to connection I don't any problems, at least not if you use a connection pool (just make sure you put in a few extra connections). – Tobb Jul 08 '15 at 06:24
  • Read http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/orm/jpa/JpaTransactionManager.html or http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/orm/hibernate4/HibernateTransactionManager.html. It explains that yes, it's possible. If using JdbcTemplate, it's straightforward. – JB Nizet Jul 08 '15 at 06:35

1 Answers1

0

Yes, you can. If properly configured, connection management is not an issue at all (a connection is not aware whether it's being used by Hibernate or by something else).

Regarding the other aspects, this question could be useful; it nicely summarizes the benefits and pitfalls of using Hibernate in a legacy environment.

Community
  • 1
  • 1
Dragan Bozanovic
  • 23,102
  • 5
  • 43
  • 110