Saturday, January 28, 2012

Spring MVC 3.1, jqGrid, and Spring Data JPA Integration Guide (Part 4)

Review

In the previous section, we have focused on the presentation layer and discussed jqGrid. In this section, we will focus on the configuration files, in particular XML files.


Configuration

Database properties

Remember we'll use MySQL as our application's database. However, it's also possible to use a different database provider. Therefore, to make switching database simpler, we've externalized our database configuration within a properties file.


Application Context

Below is a typical application context file for enabling Spring MVC support.


Spring Data

In conjuction with the spring.properties file, we have to declare the actual datasource. Notice we're using JPA and Spring Data JPA support.


Next

In the next section, we will build and run the application using Maven, and show how to import the project in Eclipse. Click here to proceed.
StumpleUpon DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google I'm reading: Spring MVC 3.1, jqGrid, and Spring Data JPA Integration Guide (Part 4) ~ Twitter FaceBook

Subscribe by reader Subscribe by email Share

4 comments:

  1. Hello Krams,

    i see this warning when i try to deploy the war in the application server. How to get rid of this?


    <[Enhance] An exception was thrown while attempting to perform class file transformation on "com.test.domain.User":
    org.apache.openjpa.util.GeneralException: org.xml.sax.SAXException: zip:C:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/WittApp/i4ptas/war/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/orm.xml [Location: Line: 2, C: 252]: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
    at org.apache.openjpa.persistence.PersistenceMetaDataFactory.parseXML(PersistenceMetaDataFactory.java:264)
    at org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:199)
    at org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:474)
    at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:294)
    at org.apache.openjpa.enhance.PCEnhancer.(PCEnhancer.java:248)
    Truncated. see log file for complete stacktrace
    Caused By: java.io.IOException: org.xml.sax.SAXException: zip:C:/Oracle/Middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/WittApp/i4ptas/war/WEB-INF/lib/_wl_cls_gen.jar!/META-INF/orm.xml [Location: Line: 2, C: 252]: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.

    ReplyDelete
  2. @Anonymous, what application server are you using to deploy the application? I have tested this project with Tomcat and Jetty. The issue could be related with your application server.

    ReplyDelete
  3. Hi krams,

    we are not able to run this project , we have the following issue and unable to access from browser also.

    our error is at http://pastebin.com/qekgdYPV

    ReplyDelete
  4. I am running on Websphere 8........... getting below error
    No matching bean of type [com.github.markserrano.jsonquery.jpa.samples.repository.IEmployeeRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

    ReplyDelete