Java backend development

Nowdays JPA is java standard and it is based on hibernate. For example EJB3 used hibernate moderation named JPQL.

Before starting develop backend business module which will direct work with database you sould for you understand following –

1. If your backend will run under full java 6 application server, will be nice use EJB 3.1 and CDI, because application servers fully support them and using native hibernate or Spring JDBC is not useful.

2. If you prefer Apache Tomcat, you can not use EJB3.1 and CDI /or it is needed a lot of configurations and changes../ so you will use Spring . Spring have new module named Spring Data JPA, which is latest and best alternatives for EJB3/CDI.

For all servers also you can use native hibernate or JDBC but it is too old style, now the best solution EJB3.1 with JPQL and CDI or Spring 3 with Spring Data JPA.

And two main difference between Spring solution and EJB3, what Spring still need a lot of configurations, EJB3 not need any special configs.

For dependency injection CDI @Inject annotation have not alternatives now, and with @Inject you can inject any EJB or Spring bean to any kind of classes. For example if you have SOAP web service with standard java api, and you want inject to it some spring service , it will be impossible, or you must find and do a lot of additional configuration. But with @Inject you can do all.

Also we have another nice solution for backend – it is using only JPA with one persistence unit.
It is good for minor projects, for example if you do not want use not EJB nor Spring, and also native hibernate annoying , you can make power backend with JPA.

Here is a one presentation for you –