-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: HSQL failing when blanks in sequence name
PostPosted: Thu Sep 06, 2007 8:35 am 
Regular
Regular

Joined: Thu Oct 19, 2006 12:07 pm
Posts: 75
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 06, 2007 6:44 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Bad formatted XML is not a Hibernate problem, in my opinion. But you might create a patch to provide trimming of String params.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.