JPA/Hibernate: Missing table error
<p>I am trying to build a simple application using Hibernate JPA with MySQL but I keep getting a "Missing table" error whenever I try to deploy it to Wildfly.</p>

<p>My persistent class looks like this:</p>

<pre><code>package com.example;

@Entity @Table
public class FooBar {
    //...
}
</code></pre>

<p>Here is my persistence.xml:</p>

<pre><code>&lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0"&gt;
    &lt;persistence-unit name="ExampleJPA"&gt;
        &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;

        &lt;class&gt;com.example.FooBar&lt;/class&gt;

        &lt;properties&gt;
            &lt;!-- Configuring JDBC properties --&gt;
            &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/mydatabase" /&gt;
            &lt;property name="javax.persistence.jdbc.user" value="(my user)" /&gt;
            &lt;property name="javax.persistence.jdbc.password" value="(my password)" /&gt;
            &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt;

            &lt;!-- Hibernate properties --&gt;
            &lt;property name="hibernate.show_sql" value="true" /&gt;
            &lt;property name="hibernate.format_sql" value="true" /&gt;
            &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
            &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt;

            &lt;!-- Configuring Connection Pool --&gt;
            &lt;property name="hibernate.c3p0.min_size" value="5" /&gt;
            &lt;property name="hibernate.c3p0.max_size" value="20" /&gt;
            &lt;property name="hibernate.c3p0.timeout" value="500" /&gt;
            &lt;property name="hibernate.c3p0.max_statements" value="50" /&gt;
            &lt;property name="hibernate.c3p0.idle_test_period" value="2000" /&gt;

        &lt;/properties&gt;
    &lt;/persistence-unit&gt;
&lt;/persistence&gt;
</code></pre>

<p>And this is the message I get when deploying to a Wildfly 8 server:</p>

<p><strong>org.jboss.msc.service.StartException in service jboss.persistenceunit.\"ExampleJPA.war#ExampleJPA\": org.hibernate.HibernateException: Missing table: FooBar
Caused by: org.hibernate.HibernateException: Missing table: FooBar</strong></p>

<p>I do have a table called FooBar in the database. I can access it directly with JDBC using the same url, user and password defined in the persistence.xml. What is wrong with my JPA setup?</p>