About Me

Love JAVA related technologies. Recently researching on Enterprise Integration (SOA and Messaging), Mobility and Big Data. I have working in JAVA related technologies as Software Architect, Enterprise Architect and Software Developer/Engineer for over 11 years. Currently, I am working as Senior Consultant of VMWare Inc.

Sunday, March 17, 2013

Spring data JPA

Spring Hibernate + JPA has been a popular combination of Java DAO layer. Hibernate claims it eases developer from writing SQL statement but arguably Hibernate adds other complications like HSQL and other annotation and entity class design such as Per-table and Per hierarchy tree. Spring Data really alleviates some of the pains ...

 Remember, one of my "non-technical" manager said "I like JAVA but it seems Application written in JAVA creates many files". At the time, the company was in process of switching from Coldfusion to JAVA. The manager has a valid point here. Look at example like this , <Customerdao>, Customerdaoimpl

Spring Data really free you from writing CustomerDaoImpl and DAO is defined in "Repository". I really like the idea of Repository vs DAO even though they are not mutually exclusive. Do we really care as software developer/engineer where the data is being saved? To me I care less about where the data is being stored but rather I care much more about store the data now and have the data be available when I want to retrieve it. Data should not be restricted in Object format even we are dealing with JAVA. There may be times, I want to take a XML file and extract information from the XML file with XPATH or XSLT. With much being said. Let's have a simple example of using Spring Data JPA. I won't post the entity classes here but they are trivial. If you want them, feel free to ask. I'll email to you. My application context
Unit Test

No comments: