I have followed the instruction of the demo application in
http://www.onjava.com/pub/a/onjava/2004/01/14/hibernate.html?page=1 using HSQL
My properties file is:
Code:
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.url=[b]jdbc:hsqldb:D:\db\order[/b]
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
I can access my database and tables using both HSQL Database Manager and Data Studio, my hbm XML for this matter is
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="test.hibernate.Product"
table="products">
<id name="id" type="string"
unsaved-value="null">
<column name="id" sql-type="char(32)"
not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="name">
<column name="name" sql-type="char(255)"
not-null="true"/>
</property>
<property name="price">
<column name="price" sql-type="double"
not-null="true"/>
</property>
<property name="amount">
<column name="amount" sql-type="integer"
not-null="true"/>
</property>
</class>
</hibernate-mapping>
And when I run my demo application I get the following exception:
Code:
SEVERE: could not insert: [test.hibernate.Product#2c999c44fb821dc300fb821dc64c0001]
java.sql.SQLException: Table not found: PRODUCTS in statement [insert into products (name, price, amount, id) values (?, ?, ?, ?)]
at org.hsqldb.jdbcDriver.throwError(Unknown Source)
at org.hsqldb.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.prepareStatement(Unknown Source)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:109)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:460)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:442)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2382)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2335)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
at test.InsertProduct.main(InsertProduct.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
TIA Oren