logo       


hsqldb & hibernate: generator problem: msg#00003

Subject: hsqldb & hibernate: generator problem
Hi list,

I am quite new to hsql (though not to java) and am using hsql (1.7.3.1), 
hibernate (2.0) and xdoclet (1.2.2) in an web-app running on Tomcat 4.0.6. 
The db is defined as a jndi ressource within Tomcat and starts up quite 
nicely. Querying works fine, saving a new object through hibernate doesn't 
however. Following is part of the errors stack trace from my log:

WARN  17:10:04 (JDBCExceptionReporter.java.logExceptions) - SQL Error: 
-11, SQLState: 37000
ERROR  17:10:04 (JDBCExceptionReporter.java.logExceptions) - Unexpected 
token: FOR in statement [select next_hi from hibernate_unique_key for 
update]
DEBUG  17:10:04 (JDBCTransaction.java.rollback) - rollback
DEBUG  17:10:04 (SessionImpl.java.afterTransactionCompletion) - 
transaction completion
DEBUG  17:10:04 (JDBCTransaction.java.toggleAutoCommit) - re-enabling 
autocommit
ERROR  17:10:04 (DBconnector.java.setObject) - setObject  Fehler beim 
speichern!
net.sf.hibernate.exception.SQLGrammarException: Could not save object
at 
net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:59)
at 
net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at 
net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:792)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:747)

The problem seems to be the hibernate IdentifierProvider in combination 
with hsql. I have tried most of hibernate's identifier generators 
(sequence, identity, native, hilo...) allways with the same result. I 
obviously want to tell hibernate that hsqldb has to worry about unique 
keys but can't seem to make myself understood :( 
Here is part of the definition from one of my mapping files:

<snip> 
        ...
        <class name="de.offis.myproject.model.User" table="user" 
dynamic-update="false" dynamic-insert="false">
        <id name="id" column="id" type="long" unsaved-value="0" >
            <generator class="identity"></generator>
        </id>
        ...
</snip>

And here the resulting sql for this class:
create table user ( id integer generated by default as identity (start 
with 1), ... );

I wonder whether anyone has set this up successfully (I would hope so) and 
could share some insight on her/his configuration and tips & tricks.

TIA

Jan


Jan Behrens
OFFIS
FuE-Bereich Betriebliches Informations- und Wissensmanagement
Escherweg 2  -  26121 Oldenburg  -  Germany
Fon: +49 4 41 97 22 - 187  -  Fax:  +49 4 41 97 22-102
E-mail: jan.behrens@xxxxxxxx  -  URL: http://www.offis.de


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe