title: Caused by: ERROR 42X05: Table/View 'STUDENTS' does not exist DB on mac
body: <p>I have been facing a problem since the last 3 weeks. The issue can be seen on a mac. I have instructed Hibernate to create the tables for me, but when executing the application it throws the following Exception:</p>
  
  <pre><code>Caused by: ERROR 42X05: Table/View 'STUDENTS' does not exist.
  </code></pre>
  
  <p>I am using Java 6, Spring 3, Hibernate 3 &amp; Java DB. I am using Java DB as a in memory database. Below is the code:</p>
  
  <pre><code>package com.transactions.config;
  
  import java.util.Properties;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.jdbc.datasource.DriverManagerDataSource;
  import org.springframework.orm.hibernate3.HibernateTemplate;
  import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
  import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean;
  import com.transactions.dao.StudentDAO;
  import com.transactions.dao.hibernate.StudentHibernateDAO;
  import com.transactions.entities.Student;
  
  @Configuration
  public class TransactionConfiguration {
  
     @Bean
     public DriverManagerDataSource dataSourceBean() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
        // dataSource.setUrl("jdbc:hsqldb:mem:testdb;shutdown=false");
        dataSource.setUrl("jdbc:derby:memory:student;create=true");
        dataSource.setUsername("");
        dataSource.setPassword("");
        return dataSource;
    }
  
    @Bean
    public AnnotationSessionFactoryBean sfBean() {
        AnnotationSessionFactoryBean sfBean = new AnnotationSessionFactoryBean();
        Properties properties = new Properties();
        sfBean.setDataSource(dataSourceBean());
        properties.setProperty(new String("hibernate.dialect"), new String("org.hibernate.dialect.DerbyDialect"));
        properties.setProperty(new String("hibernate.show_sql"), new String("true"));
        properties.setProperty(new String("hibernate.hmb2ddl.auto"), new String("create"));
        properties.setProperty(new String("hibernate.format_sql"), new String("true"));
        sfBean.setAnnotatedClasses(Student.class);
        sfBean.setHibernateProperties(properties);
        return sfBean;
    }
  
    @Bean
    public HibernateTemplate hibernateTemplate() {
        HibernateTemplate hibernateTemplate = new HibernateTemplate();
        hibernateTemplate.setSessionFactory(sfBean().getObject());
        return hibernateTemplate;
    }
  
    @Bean
    public StudentDAO studentDAO() {
        StudentDAO studentDAO = new StudentHibernateDAO(hibernateTemplate());
        return studentDAO;
    }
    }
  
  
  package com.transactions.dao.hibernate;
  
  import java.util.List;
  import org.springframework.orm.hibernate3.HibernateTemplate;
  import com.transactions.dao.GenericDAO;
  
  public class GenericHibernateDAO&lt;T&gt; implements GenericDAO&lt;T&gt; {
  
    private HibernateTemplate hibernateTemplate;
  
    public GenericHibernateDAO(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }
  
    public List&lt;T&gt; findAll() {
        List&lt;T&gt; t = (List&lt;T&gt;) hibernateTemplate.find("FROM Student");
        return t;
    }
  
    public T findByName(String name) {
        return null;
    }
  }
  
  
  package com.transactions.entities;
  
  import java.io.Serializable;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name = "students")
  public class Student implements Serializable {
  
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private int studentId;
    @Column
    private String name;
  
    public Student() {
  
    }
  
    public int getStudentId() {
        return studentId;
    }
  
    public void setStudentId(int studentId) {
        this.studentId = studentId;
    }
  
    public String getName() {
        return name;
    }
  
    public void setName(String name) {
        this.name = name;
    }
  }
  
  
  &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.transactions&lt;/groupId&gt;
  &lt;artifactId&gt;transactions&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;transactions&lt;/name&gt;
  
  &lt;properties&gt;
    &lt;org.springframework.version&gt;3.2.11.RELEASE&lt;/org.springframework.version&gt; &lt;!-- 4.1.0.RELEASE --&gt;
    &lt;org.slf4j.version&gt;1.7.0&lt;/org.slf4j.version&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
    &lt;pluginManagement&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-complier-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.6&lt;/source&gt;
                  &lt;target&gt;1.6&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
    &lt;/pluginManagement&gt;
  &lt;/build&gt;
  
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
      &lt;version&gt;${org.springframework.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;${org.springframework.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;${org.springframework.version}&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-context-support&lt;/artifactId&gt;
      &lt;version&gt;${org.springframework.version}&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;${org.springframework.version}&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;${org.springframework.version}&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;${org.springframework.version}&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;3.6.10.Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
      &lt;version&gt;3.5.6-Final&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
      &lt;version&gt;3.6.10.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;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
      &lt;version&gt;${org.slf4j.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;version&gt;${org.slf4j.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
      &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
      &lt;version&gt;${org.slf4j.version}&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;version&gt;1.2.14&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;!-- &lt;dependency&gt;
      &lt;groupId&gt;org.hsqldb&lt;/groupId&gt;
      &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
      &lt;version&gt;2.3.2&lt;/version&gt;
  &lt;/dependency&gt; --&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
      &lt;artifactId&gt;derby&lt;/artifactId&gt;
      &lt;version&gt;10.11.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.javassist&lt;/groupId&gt;
      &lt;artifactId&gt;javassist&lt;/artifactId&gt;
      &lt;version&gt;3.18.2-GA&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.9&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Below is my test class:</p>
  
  <pre><code>package com.transactions.dao.hibernate;
  
  import static org.junit.Assert.*;
  import java.util.List;
  import org.junit.After;
  import org.junit.Before;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  import org.springframework.test.context.support.AnnotationConfigContextLoader;
  import com.transactions.config.TransactionConfiguration;
  import com.transactions.dao.StudentDAO;
  import com.transactions.entities.Student;
  
  @RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {TransactionConfiguration.class})
  public class GenericHibernateDAOTest {
  
    @Autowired
    private StudentDAO studentDAO;
  
    @Before
    public void setUp() throws Exception {
  
    }
  
    @After
    public void tearDown() throws Exception {
  
    }
  
    @Test
    public void testFindAll() {
        List&lt;Student&gt; students = studentDAO.findAll();
    }
  }
  </code></pre>
  
  <p>I have also used HSQLDB for the in memory database but again a similar Exception was raised. I am sure Hibernate, HSQLDB &amp; Java DB should all work on a mac.</p>
  
  <p>Where am I going wrong?</p>