title: Spring 4 and Hibernate 4 - GenericJDBCException: could not prepare statement
body: <p>New to Spring and Hibernate, trying to apply to a simple project what I'm learning from a video course. I'm trying to run a simple client class to test out my setup, and it's not working. Here is my <strong>pom.xml</strong> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.kylewalker&lt;/groupId&gt;
    &lt;artifactId&gt;wellness&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;packaging&gt;war&lt;/packaging&gt;
    &lt;name&gt;wellness&lt;/name&gt;
    &lt;description&gt;A business magagement tool for a wellness organization offering services such as massage, nutrition counseling, etc.&lt;/description&gt;
  
  &lt;dependencies&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;org.eclipse.persistence.jpa&lt;/artifactId&gt;
      &lt;version&gt;2.5.0&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;junit&lt;/groupId&gt;
      &lt;artifactId&gt;junit&lt;/artifactId&gt;
      &lt;version&gt;4.11&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;hsqldb&lt;/groupId&gt;
      &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
      &lt;version&gt;1.8.0.10&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;
      &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;
      &lt;version&gt;1.4&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;4.0.3.RELEASE&lt;/version&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;4.0.3.RELEASE&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;4.0.3.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
      &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
      &lt;version&gt;4.0.3.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-test&lt;/artifactId&gt;
      &lt;version&gt;4.0.3.RELEASE&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.3.4.Final&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-jpa-2.0-api&lt;/artifactId&gt;
      &lt;version&gt;1.0.1.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.30&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat6-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.1&lt;/version&gt;
      &lt;/plugin&gt;
  
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
        &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.1&lt;/version&gt;
      &lt;/plugin&gt;
  
      &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.5.1&lt;/version&gt;
          &lt;configuration&gt;
              &lt;source&gt;1.7&gt;&lt;/source&gt;
              &lt;target&gt;1.7&lt;/target&gt;
          &lt;/configuration&gt;
      &lt;/plugin&gt;
  
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-war-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.2&lt;/version&gt;
        &lt;configuration&gt;
          &lt;failOnMissingWebXml&gt;false&lt;/failOnMissingWebXml&gt;
        &lt;/configuration&gt;
      &lt;/plugin&gt;
  
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.12.4&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;integration-test&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;integration-test&lt;/goal&gt;
                  &lt;goal&gt;verify&lt;/goal&gt;
              &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
  
      &lt;plugin&gt;
          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
          &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
          &lt;version&gt;1.2.1&lt;/version&gt;
          &lt;executions&gt;
              &lt;execution&gt;
                  &lt;goals&gt;
                      &lt;goal&gt;java&lt;/goal&gt;
                  &lt;/goals&gt;
              &lt;/execution&gt;
          &lt;/executions&gt;
          &lt;configuration&gt;
              &lt;mainClass&gt;com.kylewalker.wellness.Main&lt;/mainClass&gt;
          &lt;/configuration&gt;&lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Here is my <strong>hibernate-application.xml</strong> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:aop="http://www.springframework.org/schema/aop"
  xmlns:tx="http://www.springframework.org/schema/tx"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
      &lt;property name="driverClassName" value="org.hsqldb.jdbcDriver"/&gt;
      &lt;property name="url" value="jdbc:hsqldb:file:database.dat;shutdown=true"/&gt;
      &lt;property name="username" value="sa"/&gt;
      &lt;property name="password" value=""/&gt;
  &lt;/bean&gt;
  
  &lt;!-- Transaction Manager for the project --&gt;
  &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager" autowire="byType"/&gt;
  
  &lt;!-- Templates --&gt;
  &lt;bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate" autowire="byType"/&gt;
  
  &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
      &lt;property name="packagesToScan"&gt;
          &lt;list&gt;
              &lt;value&gt;com.kylewalker.wellness.domain&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;tx:annotation-driven/&gt;
  
  &lt;context:component-scan base-package="com.kylewalker.wellness"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is my <strong>Customer</strong> class:</p>
  
  <pre><code>package com.kylewalker.wellness.domain;
  
  import java.util.Date;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  
  @Entity
  public class Customer {
  
  @Id @GeneratedValue(strategy=GenerationType.AUTO)
  private Long customerId;
  
  private String firstName;
  private String middleName;
  private String lastName;
  private Date dateOfBirth;
  private String address;
  private String phone;
  private String email;
  
  // no-arg Constructor
  public Customer() {}
  
  // Constructor
  public Customer(String firstName, String lastName, String email) {
      this.firstName = firstName;
      this.lastName = lastName;
      this.email = email;
  }
  
  public String getFirstName() {
      return firstName;
  }
  public void setFirstName(String firstName) {
      this.firstName = firstName;
  }
  public String getMiddleName() {
      return middleName;
  }
  public void setMiddleName(String middleName) {
      this.middleName = middleName;
  }
  public String getLastName() {
      return lastName;
  }
  public void setLastName(String lastName) {
      this.lastName = lastName;
  }
  public Date getDateOfBirth() {
      return dateOfBirth;
  }
  public void setDateOfBirth(Date dateOfBirth) {
      this.dateOfBirth = dateOfBirth;
  }
  public String getAddress() {
      return address;
  } 
  public void setAddress(String address) {
      this.address = address;
  } 
  public String getPhone() {
      return phone;
  }
  public void setPhone(String phone) {
      this.phone = phone;
  }
  public String getEmail() {
      return email;
  }
  public void setEmail(String email) {
      this.email = email;
  }
  public Long getCustomerId() {
      return customerId;
  }
  
  @Override
  public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = prime * result
              + ((customerId == null) ? 0 : customerId.hashCode());
      result = prime * result
              + ((firstName == null) ? 0 : firstName.hashCode());
      result = prime * result
              + ((lastName == null) ? 0 : lastName.hashCode());
      return result;
  }
  
  @Override
  public boolean equals(Object obj) {
      if (this == obj)
          return true;
      if (obj == null)
          return false;
      if (getClass() != obj.getClass())
          return false;
      Customer other = (Customer) obj;
      if (customerId == null) {
          if (other.customerId != null)
              return false;
      } else if (!customerId.equals(other.customerId))
          return false;
      if (firstName == null) {
          if (other.firstName != null)
              return false;
      } else if (!firstName.equals(other.firstName))
          return false;
      if (lastName == null) {
          if (other.lastName != null)
              return false;
      } else if (!lastName.equals(other.lastName))
          return false;
      return true;
  }
  
  @Override
  public String toString() {
      return "Customer [customerId=" + customerId + ", firstName="
              + firstName + ", lastName=" + lastName + ", dateOfBirth="
              + dateOfBirth + ", address=" + address + ", phone=" + phone
              + ", email=" + email + "]";
  } 
  }
  </code></pre>
  
  <p>Here is the implementation of the <strong>CustomerService</strong> class:</p>
  
  <pre><code>package com.kylewalker.wellness.services;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.kylewalker.wellness.domain.Customer;
  import com.kylewalker.wellness.dataaccess.CustomerDao;
  import com.kylewalker.wellness.dataaccess.RecordNotFoundException;
  
  @Transactional
  @Service
  public class CustomerServiceImpl implements CustomerService {
  
  private CustomerDao dao;
  
  @Autowired
  public CustomerServiceImpl(CustomerDao dao) {
      this.dao = dao;
  }
  
  public void newCustomer(Customer newCustomer) {
      dao.create(newCustomer);
  }
  
  public void updateCustomer(Customer changedCustomer)
          throws CustomerNotFoundException {
      // TODO Auto-generated method stub
  
  }
  
  public void deleteCustomer(Customer oldCustomer)
          throws CustomerNotFoundException {
      try {
          dao.delete(oldCustomer);
      } catch (RecordNotFoundException e) {
          throw new CustomerNotFoundException();
      }
  }
  
  public Customer findCustomerById(String customerId)
          throws CustomerNotFoundException {
      // TODO Auto-generated method stub
      return null;
  }
  
  public List&lt;Customer&gt; findCustomersByName(String lastName, String firstName)
          throws CustomerNotFoundException {
      try {
          return dao.getByName(lastName, firstName);
      } catch (RecordNotFoundException e) {
          throw new CustomerNotFoundException();
      }
  }
  
  public List&lt;Customer&gt; getAllCustomers() {
      return dao.getAllCustomers();
  }
  
  }
  </code></pre>
  
  <p>Here is the implementation of the <strong>CustomerDao</strong>:</p>
  
  <pre><code>package com.kylewalker.wellness.dataaccess;
  
  import java.util.List;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.orm.hibernate4.HibernateTemplate;
  import org.springframework.stereotype.Repository;
  import org.springframework.transaction.annotation.Transactional;
  
  import com.kylewalker.wellness.domain.Customer;
  
  @Repository
  @Transactional
  public class CustomerDaoHibernateImpl implements CustomerDao {
  
  @Autowired
  private HibernateTemplate template;
  
  public void create(Customer customer) {
      template.save(customer);
  }
  
  public Customer getById(String customerId) throws RecordNotFoundException {
      List&lt;Customer&gt; results = (List&lt;Customer&gt;)template.find("from Customer where customerId=?", customerId);
      if (results.isEmpty()) 
          throw new RecordNotFoundException();
      return results.get(0);
  }
  
  public List&lt;Customer&gt; getByName(String lastName, String firstName)
          throws RecordNotFoundException {
      return (List&lt;Customer&gt;) template.findByNamedParam("from Customer where lastName=? and firstName=?", lastName, firstName);
  }
  
  public void update(Customer customerToUpdate)
          throws RecordNotFoundException {
      // TODO Auto-generated method stub
  
  }
  
  public void delete(Customer oldCustomer) throws RecordNotFoundException {
      Customer foundCustomer = template.get(Customer.class, oldCustomer.getCustomerId());
      template.delete(foundCustomer);
  }
  
  public List&lt;Customer&gt; getAllCustomers() {
      return (List&lt;Customer&gt;)template.find("from Customer");
  }
  
  }
  </code></pre>
  
  <p>Here is the <strong>Client.java</strong> main class I'm running to test it all. (I was trying to do a JUnit test originally but kept having problems, so I figured I'd try testing it this way):</p>
  
  <pre><code>package com.kylewalker.wellness.client;
  
  import java.util.List;
  
  import org.springframework.context.support.ClassPathXmlApplicationContext;
  
  import com.kylewalker.wellness.domain.Customer;
  import com.kylewalker.wellness.services.CustomerService;
  
  public class Client {
  
  public static void main(String[] args) {
      ClassPathXmlApplicationContext container = new ClassPathXmlApplicationContext("hibernate-application.xml");
      try {
          CustomerService customer = container.getBean(CustomerService.class);
          Customer c1 = new Customer("Joe", "Smith", "jsmith@gmail.com");
          System.out.println(c1);
          System.out.println("The customer last name is " + c1.getLastName());
          customer.newCustomer(c1);
  
          List&lt;Customer&gt; allCustomers = customer.getAllCustomers();
  
          for (Customer c : allCustomers) {
              System.out.println(c);
          }
      } finally {
          container.close();
      }
  }
  }
  </code></pre>
  
  <p>And finally here is the error trace I'm getting when I run the <strong>Client</strong> class :</p>
  
  <pre><code>Apr 18, 2014 5:20:44 PM     org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@cf9b31d: startup date [Fri Apr 18 17:20:44 MDT 2014]; root of context hierarchy
  Apr 18, 2014 5:20:44 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [hibernate-application.xml]
  Apr 18, 2014 5:20:45 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
  Apr 18, 2014 5:20:45 PM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {4.3.4.Final}
  Apr 18, 2014 5:20:45 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  Apr 18, 2014 5:20:45 PM org.hibernate.cfg.Environment buildBytecodeProvider
  INFO: HHH000021: Bytecode provider name : javassist
  Apr 18, 2014 5:20:45 PM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
  Apr 18, 2014 5:20:45 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
  INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
  Apr 18, 2014 5:20:45 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
  INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
  Apr 18, 2014 5:20:45 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory &lt;init&gt;
  INFO: HHH000397: Using ASTQueryTranslatorFactory
  Apr 18, 2014 5:20:46 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
  INFO: HHH000227: Running hbm2ddl schema export
  Hibernate: drop table Customer if exists
  Hibernate: create table Customer (customerId bigint generated by default as identity (start with 1), address varchar(255), dateOfBirth timestamp, email varchar(255), firstName varchar(255), lastName varchar(255), middleName varchar(255), phone varchar(255), primary key (customerId))
  Apr 18, 2014 5:20:46 PM org.hibernate.tool.hbm2ddl.SchemaExport execute
  INFO: HHH000230: Schema export complete
  Customer [customerId=null, firstName=Joe, lastName=Smith, dateOfBirth=null, address=null, phone=null, email=jsmith@gmail.com]
  The customer last name is Smith
  Hibernate: insert into Customer (customerId, address, dateOfBirth, email, firstName, lastName, middleName, phone) values (null, ?, ?, ?, ?, ?, ?, ?)
  Apr 18, 2014 5:20:46 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: -20, SQLState: IM001
  Apr 18, 2014 5:20:46 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: This function is not supported
  Apr 18, 2014 5:20:46 PM org.springframework.context.support.ClassPathXmlApplicationContext doClose
  INFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext@cf9b31d: startup date [Fri Apr 18 17:20:44 MDT 2014]; root of context hierarchy
  Exception in thread "main" org.springframework.orm.hibernate4.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [insert into Customer (customerId, address, dateOfBirth, email, firstName, lastName, middleName, phone) values (null, ?, ?, ?, ?, ?, ?, ?)]; SQL state [IM001]; error code [-20]; could not prepare statement; nested exception is org.hibernate.exception.GenericJDBCException: could not prepare statement
      at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:168)
      at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:343)
      at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308)
      at org.springframework.orm.hibernate4.HibernateTemplate.save(HibernateTemplate.java:617)
      at com.kylewalker.wellness.dataaccess.CustomerDaoHibernateImpl.create(CustomerDaoHibernateImpl.java:20)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy16.create(Unknown Source)
      at com.kylewalker.wellness.services.CustomerServiceImpl.newCustomer(CustomerServiceImpl.java:25)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      at com.sun.proxy.$Proxy18.newCustomer(Unknown Source)
      at com.kylewalker.wellness.client.Client.main(Client.java:19)
  Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement
      at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54)
      at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:122)
      at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:55)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3032)
      at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3558)
      at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:97)
      at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:488)
      at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:193)
      at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:177)
      at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:212)
      at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:324)
      at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
      at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194)
      at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:209)
      at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:194)
      at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
      at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
      at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:715)
      at org.hibernate.internal.SessionImpl.save(SessionImpl.java:707)
      at org.hibernate.internal.SessionImpl.save(SessionImpl.java:702)
      at org.springframework.orm.hibernate4.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:621)
      at org.springframework.orm.hibernate4.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:617)
      at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340)
      ... 31 more
  Caused by: java.sql.SQLException: This function is not supported
      at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      at org.hsqldb.jdbc.Util.notSupported(Unknown Source)
      at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
      at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:508)
      at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:400)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$2.doPrepare(StatementPreparerImpl.java:124)
      at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186)
      ... 55 more
  </code></pre>
  
  <p>I ran it again with logging turned on (This is the next morning, in response to a viewer's request):</p>
  
  <pre><code>Apr 19, 2014 6:58:39 AM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
  INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@22a866a9: startup date [Sat Apr 19 06:58:39 MDT 2014]; root of context hierarchy
  Apr 19, 2014 6:58:40 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
  INFO: Loading XML bean definitions from class path resource [hibernate-application.xml]
  Apr 19, 2014 6:58:43 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
  Apr 19, 2014 6:58:43 AM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {4.3.4.Final}
  Apr 19, 2014 6:58:43 AM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  Apr 19, 2014 6:58:43 AM org.hibernate.cfg.Environment buildBytecodeProvider
  INFO: HHH000021: Bytecode provider name : javassist
  Apr 19, 2014 6:58:43 AM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
  Apr 19, 2014 6:58:43 AM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
  INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
  Apr 19, 2014 6:58:44 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
  INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
  Apr 19, 2014 6:58:44 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory &lt;init&gt;
  INFO: HHH000397: Using ASTQueryTranslatorFactory
  Apr 19, 2014 6:58:44 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
  INFO: HHH000227: Running hbm2ddl schema export
  Hibernate: drop table Customer if exists
  Hibernate: create table Customer (customerId bigint generated by default as identity (start with 1), address varchar(255), dateOfBirth timestamp, email varchar(255), firstName varchar(255), lastName varchar(255), middleName varchar(255), phone varchar(255), primary key (customerId))
  Apr 19, 2014 6:58:44 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
  INFO: HHH000230: Schema export complete
  Customer [customerId=null, firstName=Joe, lastName=Smith, dateOfBirth=null, address=null, phone=null, email=jsmith@gmail.com]
  The customer last name is Smith
  Hibernate: insert into Customer (customerId, address, dateOfBirth, email, firstName, lastName, middleName, phone) values (null, ?, ?, ?, ?, ?, ?, ?)
  Apr 19, 2014 6:58:45 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  WARN: SQL Error: -20, SQLState: IM001
  Apr 19, 2014 6:58:45 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
  ERROR: This function is not supported
  Apr 19, 2014 6:58:45 AM org.springframework.context.support.ClassPathXmlApplicationContext doClose
  INFO: Closing org.springframework.context.support.ClassPathXmlApplicationContext@22a866a9: startup date [Sat Apr 19 06:58:39 MDT 2014]; root of context hierarchy
  </code></pre>
  
  <p>And here is the script generated:</p>
  
  <pre><code>CREATE SCHEMA PUBLIC AUTHORIZATION DBA
  CREATE MEMORY TABLE CUSTOMER(CUSTOMERID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,ADDRESS VARCHAR(255),DATEOFBIRTH TIMESTAMP,EMAIL VARCHAR(255),FIRSTNAME VARCHAR(255),LASTNAME VARCHAR(255),MIDDLENAME VARCHAR(255),PHONE VARCHAR(255))
  ALTER TABLE CUSTOMER ALTER COLUMN CUSTOMERID RESTART WITH 1
  CREATE USER SA PASSWORD ""
  GRANT DBA TO SA
  SET WRITE_DELAY 10
  </code></pre>