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.  [ 4 posts ] 
Author Message
 Post subject: HSQLDialect issue when creating sequence table?
PostPosted: Tue Sep 12, 2006 12:08 pm 
Newbie

Joined: Tue Sep 12, 2006 11:23 am
Posts: 2
Location: College Park Maryland USA
Hibernate version: 3.1

Hello,
I am using HSQLDB for unit testing and have a problem. When I run my junit test case I get the following error:

Code:
[junit] Hibernate: select next value for
[junit] REPOSITORY_QUESTION_SEQUENCE
[junit] from dual_
[junit] REPOSITORY_QUESTION_SEQUENCE
[junit] [mrlassist] WARN [main] JDBCExceptionReporter.logExceptions(71) | SQL Error: -22, SQLState: S0002
[junit] [mrlassist] ERROR [main] JDBCExceptionReporter.logExceptions(72) | Table not found in statement [select next value for
[junit] REPOSITORY_QUESTION_SEQUENCE
[junit] from dual_
[junit] REPOSITORY_QUESTION_SEQUENCE



in my hibernate mapping files I have:


Code:
<id name="id" type="integer" unsaved-value="null">
   <column name="ID" not-null="true" unique="true"
      index=" REPOSITORY_QUESTION_PK" precision="10" scale="0" />
   <generator class="seqhilo">
      <param name="max_lo">100</param>
      <param name="sequence">
         REPOSITORY_QUESTION_SEQUENCE
      </param>
   </generator>
</id>

As you can see, what is happening is that HSQLDialect is taking the sequence name from the mapping file and concatenating it to the string “dual_”, but the tabs or spaces that are in front of the sequence name are not being removed. If I change the sequence name in the mapping file to
Code:
<param name="sequence">REPOSITORY_QUESTION_SEQUENCE</param>
(No tabs or spaces in front of the name), then everything works fine.

Is this a known issue? Is there a way to get around this issue without modifying my mapping files?
I’d appreciate any help.

Code:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 1:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
fix the key generator so it trims the parameters.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 4:45 pm 
Newbie

Joined: Tue Sep 12, 2006 11:23 am
Posts: 2
Location: College Park Maryland USA
max,
thanks for your response, but I am using the seqhilo key generator class that comes with Hibernate. Shouldn’t the trimming of blank spaces or tabs be done by the HSQLDialect?
I think my problem is when the getSequenceNextValString is called and the sequenceName contains leading spaces or tabs.

Code:
public String getSequenceNextValString(String sequenceName) {
       return "select " + getSelectSequenceNextValString( sequenceName ) + " from dual_" + sequenceName;
}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 12, 2006 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i would say it would be more obvious to fix it in the keygenerator....submit a patch for it ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.