title: Joda Time and hibernate 4
body: <p>I am using hibernate 4 with joda time and spring data jpa. Spring data provides annotations </p>
  
  <pre><code>@CreadedOn
  @LastModifiedOn
  </code></pre>
  
  <p>i am trying to use these two annotations.Below is a snapshot of my pojo</p>
  
  <pre><code>@Entity
  @Table(name="restaurant")
  @Audited
  public class Restaurant {
  
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private long id;
  
  private String restaurantName;
  
  @CreatedDate
  @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
   // @Type(type = "org.jadira.usertype.dateandtime.threetenbp.PersistentDateTime")
  private DateTime createdOn;
  
  @LastModifiedDate
  @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
   // @Type(type = "org.jadira.usertype.dateandtime.threetenbp.PersistentDateTime")
  private DateTime modifiedOn;
  }
  </code></pre>
  
  <p>as per the instructions provided <a href="http://jadira.sourceforge.net/usertype-userguide.html" rel="noreferrer">user types jodatime</a>,i have annotated my properties with <code>@Type</code> .but still no luck.Everytime i use the <code>@Type</code> annotation and deploy it i get a error on my server</p>
  
  <blockquote>
    <p>SEVERE: Error listenerStart</p>
  </blockquote>
  
  <p>Full stack trace is below</p>
  
  <pre><code>    Jan 15, 2014 11:40:00 AM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive G:\apache-tomcat-7.0.47\webapps\base-spr
  ing-data-jpa.war
  Jan 15, 2014 11:40:00 AM org.apache.catalina.loader.WebappClassLoader validateJa
  rFile
  INFO: validateJarFile(G:\apache-tomcat-7.0.47\webapps\base-spring-data-jpa\WEB-I
  NF\lib\javax.servlet-api-3.1.0.jar) - jar not loaded. See Servlet Spec 2.3, sect
  ion 9.7.2. Offending class: javax/servlet/Servlet.class
  SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further detail
  s.
  Jan 15, 2014 11:40:05 AM org.hibernate.annotations.common.Version &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
  Jan 15, 2014 11:40:05 AM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {4.2.7.Final}
  Jan 15, 2014 11:40:05 AM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  Jan 15, 2014 11:40:05 AM org.hibernate.cfg.Environment buildBytecodeProvider
  INFO: HHH000021: Bytecode provider name : javassist
  Jan 15, 2014 11:40:05 AM org.hibernate.ejb.Ejb3Configuration configure
  INFO: HHH000204: Processing PersistenceUnitInfo [
          name: default
          ...]
  Jan 15, 2014 11:40:05 AM org.hibernate.service.jdbc.connections.internal.Connect
  ionProviderInitiator instantiateExplicitConnectionProvider
  INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.c
  onnection.InjectedDataSourceConnectionProvider
  Jan 15, 2014 11:40:06 AM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
  Jan 15, 2014 11:40:06 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error listenerStart
  Jan 15, 2014 11:40:06 AM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/base-spring-data-jpa] startup failed due to previous errors
  Jan 15, 2014 11:40:06 AM org.apache.catalina.loader.WebappClassLoader clearRefer
  encesJdbc
  SEVERE: The web application [/base-spring-data-jpa] registered the JDBC driver [
  com.mysql.jdbc.Driver] but failed to unregister it when the web application was
  stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistere
  d.
  Jan 15, 2014 11:40:06 AM org.apache.catalina.loader.WebappClassLoader clearRefer
  encesThreads
  SEVERE: The web application [/base-spring-data-jpa] appears to have started a th
  read named [Abandoned connection cleanup thread] but has failed to stop it. This
   is very likely to create a memory leak.
  Jan 15, 2014 11:40:06 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory G:\apache-tomcat-7.0.47\webapps\docs
  Jan 15, 2014 11:40:06 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory G:\apache-tomcat-7.0.47\webapps\exampl
  es
  Jan 15, 2014 11:40:06 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory G:\apache-tomcat-7.0.47\webapps\host-m
  anager
  Jan 15, 2014 11:40:07 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory G:\apache-tomcat-7.0.47\webapps\manage
  r
  Jan 15, 2014 11:40:07 AM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory G:\apache-tomcat-7.0.47\webapps\ROOT
  Jan 15, 2014 11:40:07 AM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-nio-8080"]
  Jan 15, 2014 11:40:07 AM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-apr-8009"]
  Jan 15, 2014 11:40:07 AM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 6648 ms
  </code></pre>
  
  <p>Since yesterday i am trying to get these two work but unable to do so.Can anyone please tell me how to solve this problem.Below is my pom Dependencies and repository</p>
  
  <pre><code> &lt;dependencies&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;3.8.1&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
     &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
          &lt;version&gt;3.2.5.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;javax.validation&lt;/groupId&gt;
      &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
      &lt;version&gt;1.1.0.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
      &lt;version&gt;5.0.1.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
      &lt;version&gt;4.2.7.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
      &lt;version&gt;4.2.7.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
      &lt;version&gt;5.1.27&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.data&lt;/groupId&gt;
      &lt;artifactId&gt;spring-data-jpa&lt;/artifactId&gt;
      &lt;version&gt;1.5.0.BUILD-SNAPSHOT&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;version&gt;3.1.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;jstl&lt;/groupId&gt;
      &lt;artifactId&gt;jstl&lt;/artifactId&gt;
      &lt;version&gt;1.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
      &lt;version&gt;${spring.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-aspects&lt;/artifactId&gt;
      &lt;version&gt;3.2.5.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-envers&lt;/artifactId&gt;
      &lt;version&gt;4.2.7.Final&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;joda-time&lt;/groupId&gt;
      &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
      &lt;version&gt;2.3&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>
        </p>
  
  <pre><code>    &lt;repository&gt;
          &lt;id&gt;spring-libs-snapshot&lt;/id&gt;
          &lt;url&gt;http://repo.spring.io/libs-snapshot&lt;/url&gt;
      &lt;/repository&gt;
  
  &lt;/repositories&gt;
  </code></pre>