Hi Everyone. I am trying to move a small web-application I am working to mySQL (from the memory) test database.
I am using JBoss Seam web-framework. My persistable entities are using annotations. I am using the latest mySQL connector library from the mySQL website.
I am very new to Hibernate, but I did some reading and could not quite find any answers to the exact problem I am getting. When i attempt to start my web-container (JBoss Application Server) I get the following exception:
Quote:
Caused by: org.hibernate.HibernateException: Missing column: id in project.user
at org.hibernate.mapping.Table.validateColumns(Table.java:277)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1116)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
Now, the natural first question is "do you have a column "id" in the user table?".. The answer is yes! :o).. This is what is really getting to me. I have even tried different datatypes (INTEGER, BIGINT) and have dropped and re-created the user table.
I am using annotations; from my User.class:
Code:
private long id = -1;
@Id
@GeneratedValue
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
Here is my persistence.xml:
Code:
<persistence-unit name="userDatabase" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/myDatasource</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.jdbc.batch_size" value="20"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
my *-ds.xml file:
Code:
<datasources>
<local-tx-datasource>
<jndi-name>myDatasource</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/project</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>***</user-name>
<password>*****</password>
</local-tx-datasource>
</datasources>
Does anyone have any ideas why it could be not seeing this column? Any help would be greatly appreciated!!