jacheson
jacheson

Reputation: 1333

Using Hibernate ORM without Spring

I'm writing a JavaFX Application which previously use Spring/QueryDSL for DI and persistence.

I'm hoping to move to using either Dagger or Guice (instead of spring) and Hibernate ORM.

I have noticed that Spring offers some nice functionality on top of hibernate, such as transaction management via @Transactional.

Are there other means of avoiding "boilerplate code" such as opening sessions, beginning transactions, committing transactions and closing sessions via some sort of hibernate configuration? Or are these features I'm really only going to get if I use Spring?

Upvotes: 0

Views: 2399

Answers (1)

Angular University
Angular University

Reputation: 43087

Guice has @Transactional support for JPA providers such as Hibernate using guice-persist, Dagger does not mention support for this.

If you are using Hibernate as your JPA provider, using Spring with @Transactional would probably be the most natural fit for building your backend. You would find a loss less documentation, examples, blog posts, books and online help in general using other alternatives than with Spring/Hibernate.

Upvotes: 1

Related Questions