Hi!
It seems when using HSQLDB, blanks (space, newline,etc) around sequence names cause a failure. The same code with Oracle works fine.
For details, see below.
Is this a hibernate bug ? hbm2ddl bug ? Hsql bug ? jdbc driver bug ?
Removing the blanks fixes the error, but since the formatter in our XML editor always formats the XML as seen below, this problem comes back again and again.
Hibernate version: 3.2.0cr2
Mapping documents:
Code:
<class name="pojos.Foo" table="FOO">
<id name="id" type="long" column="ID">
<generator class="sequence">
<param name="sequence">
seq_FOO_ID
</param>
</generator>
</id>
Code between sessionFactory.openSession() and session.close():Code:
Foo f;
...
session.save(f);
Full stack trace of any exception that occurs:It is an SQL error, the stack trace doesn't really say anything more useful, but will post it if requested.
Name and version of the database you are using: HSQL DB 1.8.0.1
The generated SQL (show_sql=true):Code:
select next value for
seq_OFFER_MEMBER_OFFERS_ID
from dual_
seq_OFFER_MEMBER_OFFERS_ID
Debug level Hibernate log excerpt:Code:
2031 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: -22, SQLState: S0002
2031 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Table not found in statement [select next value for
seq_OFFER_MEMBER_OFFERS_ID
from dual_
seq_OFFER_MEMBER_OFFERS_ID
]
Changing the mapping to this :
Code:
<class name="pojos.Foo" table="FOO">
<id name="id" type="long" column="ID">
<generator class="sequence">
<param name="sequence">seq_FOO_ID</param>
</generator>
</id>
removes the problem. But as mentioned above, if anyone edits the mapping file and introduces the blanks, it breaks again.
For example, this mapping also fails, due to extra spaces:
Code:
<class name="pojos.Foo" table="FOO">
<id name="id" type="long" column="ID">
<generator class="sequence">
<param name="sequence"> seq_FOO_ID </param>
</generator>
</id>
Regards,
David