0

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?

2
  • I'm no expert at this, but hibernate also provides annotations to avoid a lot of boilerplate code. Refer: docs.jboss.org/hibernate/annotations/3.5/reference/en/… Commented Apr 13, 2014 at 19:52
  • EJB 3 has also the same functionality :) Such a features can only be provided by frameworks that offer AOP. As I see Guice (I am not an expert of this one) also offers AOP so you can always write a simple version of it by your own :) Commented Apr 13, 2014 at 20:04

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.