SpringMVC4 + Spring Data JPA + SpringSecurity configuration using JavaConfig

In this article we will see how to configure and integrate SpringMVC4, Spring Data JPA with Hibernate and SpringSecurity using JavaConfig. 1. First let’s configure all the necessary dependencies in pom.xml 4.0.0 com.sivalabs springmvc-datajpa-security-demo 1.0 war 1.7 4.11 1.7.5 1.0.13 4.0.0.RELEASE 1.4.1.RELEASE 3.2.0.RELEASE 4.2.6.Final 1.7.2 5.1.26 2.3.1 1.2.2 3.1 ${project.artifactId} org.apache.maven.plugins maven-compiler-plugin 3.1 ${java.version} ${java.version} […]

Read More

Spring3+JPA2+JavaEE6AppServer = Confusion Over Configuration

Spring is great, JavaEE6 is great and latest JavaEE6 Application servers are also great. This post is not a rant on Spring Vs JavaEE6, but my experience of porting a Spring3+JPA2(Hibernate) application on JBoss AS-7.1 App Server. My application requirement is very simple: Developing a couple of SOAP based webservices using Spring3.1 and JPA2(Hibernate) and […]

Read More

@GeneratedValue not setting up auto increment in mysql and h2 dialects

Hi,In earlier versions of Hibernate if we want to have an auto_increment primary key we can use the following: @Id @GeneratedValue(strategy=GenerationType.AUTO)@Column(name=”user_id”)private Integer userId; But in latest version of Hibernate(may be Hibernate4, whatever is used in JBoss AS7) this doesn’t work as expected. The generated table primary key is not auto_increment column. To resolve this configure <property […]

Read More

SpringMVC + Hibernate Error: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

While developing a web application using SpringMVC and Hibernate I got “No Hibernate Session bound to thread Exception” becuase of some configuration issue.Here I am going to explain how I resolved the issue. I used the SpringMVC/@Controller approach and configured the Web related Spring configuration in dispatcher-servlet.xml as follows: <context:annotation-config”/> <context:component-scan base-package=”com.sivalabs”/> I have configured […]

Read More

SpringMVC3 Hibernate CRUD Sample Application

To learn any web framework starting with a HelloWorld application is a good idea. Once we get familiarity with the framework configuration it would be better to do a CRUD(Create,Read,Update,Delete) application which covers various aspects of a web framework like Validations, Request URL Mappings, Request Parameter Binding,Pre-populating forms etc. Now I am going to explain […]

Read More