Maven - Standard Directory Layout

src/main/javaApplication/Library sources
src/main/resourcesApplication/Library resources
src/main/filtersResource filter files
src/main/assemblyAssembly descriptors
src/main/configConfiguration files
src/main/scriptsApplication/Library scripts
src/main/webappWeb application sources
src/test/javaTest sources
src/test/resourcesTest resources
src/test/filtersTest resource filter files
LICENSE.txtProject's license
NOTICE.txtNotices and attributions required by libraries that the project depends on
README.txtProject's readme

More in Maven

Web Article - Spring 3 and JPA with Hibernate

This article shows how to set up Spring with JPA, using Hibernate as a persistence provider.

The JPA Spring Configuration with Java

public class PersistenceJPAConfig{
   public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
      LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
      em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" });
      JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
      return em;
   public DataSource dataSource(){
      DriverManagerDataSource dataSource = new DriverManagerDataSource();
      dataSource.setUsername( "tutorialuser" );
      dataSource.setPassword( "tutorialmy5ql" );
      return dataSource;
   public PlatformTransactionManager transactionManager(EntityManagerFactory emf){
      JpaTransactionManager transactionManager = new JpaTransactionManager();
      return transactionManager;
   public PersistenceExceptionTranslationPostProcessor exceptionTranslation(){
      return new PersistenceExceptionTranslationPostProcessor();
   Properties additionalProperties() {
      return new Properties() {
         {  // Hibernate Specific: 
            setProperty("", "create-drop");
            setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
The JPA Spring Configuration with XML


This Spring JPA Tutorial can be found in the github project – this is an Eclipse based project, so it should be easy to import and run as it is.
Source and full article in

13º Meeting PT.JUG

Jean-Louis Monteiro

Apache TomEE 
Jean-Louis Monteiro
More info in

Web Article - Fast, Effective, Double-Checked Locking in Android and Java Apps

public class Foo {
    private volatile Map< String, String > data;

    public Foo() { }

    public void setData(String key, String value) {
        if (data == null) {
            synchronized (this) {
                if (data == null)
                    data = new ConcurrentHashMap < String, String >();

        data.put(key, value);

"There are two important things here. The first is adding the volatile modifier to the data field. This will instruct the compiler and eventually the Dalvik VM to ensure reads and writes are performed in a happened-before order (see here for more details). In other words, writes to the field always happen before reads (without this keyword, the compiler or JIT optimizer may decide to reverse them). Next, we add another null check for data outside the synchronized block. This will ensure once data has been allocated, we never synchronize again. However, if data is indeed null, we synchronize and then double-check if data is null just to make sure another thread hasn’t assigned a value between the two checks. If we lost the race, we’ll just continue normally and exit the synchronized block."

Source: Dzone

Spring Framework 4 - A Guided Tour

Spring Framework 4 builds the foundation for the next major generation of the Java application framework. The talk gives a practical overview about fundamental infrastructure improvements such as Java 8 support and the integration with the latest Java EE APIs. It also covers major enhancements all across the framework such as advanced support for Groovy, hypermedia aspects for REST web services as well as WebSockets support. Filmed at JAX London 2013.

More information in

Powered by Blogger