-->
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: [OT: Newbie] HSQLDB Table not found
PostPosted: Tue Jul 05, 2005 5:04 pm 
Newbie

Joined: Tue Jul 05, 2005 4:42 pm
Posts: 2
Location: Zurich, Switzerland
Hallo zusammen,

Ich arbeite mich derzeit in Hibernate (V.2.1) ein. Als Datenbank verwende ich HSQLDB 1.7.3 unter Debian Sarge. Via hbm2ddl und Ant erstelle ich in der Datenbank Tabellen, u.a. auch die Tabelle User (siehe User Mapping).

Wenn ich nun die main Methode einer Klasse (siehe Testklasse) ausführe, erhalte ich die folgende Exception "table not found" (siehe Fehlermeldung).

Kennt jemand von Euch dieses Problem? Unter folgendem Link (http://support.liferay.com/browse/LEP-228) scheint es Probleme mit relativen Pfadangaben unter Linux mit HSQLDB zu geben. Eine absolute Pfadangabe hat jedoch auch nicht geholfen und erscheint mir im Zusammenhang mit einem Ant Skript (dass auf diversen Rechnern funktionieren soll) unsinnig.

[hibernate.properties]
hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:data/myTest
hibernate.connection.username=sa
hibernate.connection.password=

[Test Klasse]
public static void main(String[] args) throws HibernateException
{
Configuration cfg = new Configuration();
cfg.addClass(Event.class).addClass(Memo.class)
.addClass(User.class).addClass(UserProfile.class);

SessionFactory fact = cfg.buildSessionFactory();
Session session = fact.openSession();
Transaction tx = session.beginTransaction();
User u = new User("saw303", "dfadf", "dfasddf", "pwd", new Date(), true, null, null);
session.save(u);
tx.commit();
session.close();
fact.close();
}


[User Mapping]
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="ch.zuerich3.hibernate.User" table="User">
<meta attribute="class-description">
Repräsentiert einen einfachen Anwender der Applikation
</meta>
<meta attribute="implement-equals">true</meta>
<id name="id" column="USERID" type="integer">
<meta attribute="scope-set">protected</meta>
<meta attribute="use-in-equals">true</meta>
<generator class="increment"/>
</id>
<one-to-one name="profile" class="ch.zuerich3.hibernate.UserProfile"/>

<property name="nickName" column="NICKNAME" unique="true" type="string" not-null="true" length="25">
<meta attribute="field-description">Übername des Anwenders</meta>
<meta attribute="use-in-equals">true</meta>
</property>
<property name="firstName" column="FIRSTNAME" type="string" not-null="true" length="30">
<meta attribute="use-in-tostring">true</meta>
</property>
<property name="lastName" column="LASTNAME" type="string" not-null="true" length="40">
<meta attribute="use-in-tostring">true</meta>
</property>
<property name="password" column="PASSWORD" type="string" not-null="true" length="20">
<meta attribute="field-description">
Passwort des Anwender MD5 verschlüsselt.
</meta>
</property>
<property name="lastLogin" column="LASTLOGIN" type="timestamp" not-null="true">
<meta attribute="use-in-tostring">true</meta>
</property>
<property name="activationStatus" column="ACTIVE" type="boolean" not-null="true">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="field-description">Ist der Anwender aktiv?</meta>
</property>
<set inverse="true" name="messages">
<key column="MEMOID" />
<one-to-many class="ch.zuerich3.hibernate.Memo" />
</set>
<set name="events" table="Event_User" inverse="true">
<key column="USERID" />
<many-to-many class="ch.zuerich3.hibernate.Event"
column="EVENTID" />
</set>
</class>
</hibernate-mapping>

[Fehlermeldung]
WARN JDBCExceptionReporter: SQL Error: -22, SQLState: S0002 [22:59:36.255] net.sf.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:57)
ERROR JDBCExceptionReporter: Table not found: User in statement [select max(USERID) from "User"] [22:59:36.260] net.sf.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:58)
Exception in thread "main" net.sf.hibernate.exception.SQLGrammarException: Could not save object
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:69)
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)
at ch.zuerich3.hibernate.test.AddUser.main(AddUser.java:37)
Caused by: java.sql.SQLException: Table not found: User in statement [select max(USERID) from "User"]
at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at net.sf.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:65)
at net.sf.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:42)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:774)
... 2 more


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 05, 2005 5:18 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Vermeide in-process HSQL DB. Viel einfacher gehts mit einer standalone HSQL DB und einer TCP connection dahin. Wenns ganz einfach sein soll lade Dir http://caveatemptor.hibernate.org (die alpha) runter und schau Dir die Konfiguration an.


Top
 Profile  
 
 Post subject: HSQLDB 1.8 und neuen Systemtabellennamen
PostPosted: Mon Jul 11, 2005 12:03 pm 
Beginner
Beginner

Joined: Tue Mar 15, 2005 2:36 am
Posts: 32
Location: Bonn, Germany
HSQLDB 1.8 hat neuen Systemtabellennamen.

Nur, damit es nicht untergeht und die Überschrift passt zu diesem Bug - es soll keiner sagen, das Problem wäre nicht bekannt. :p

http://opensource.atlassian.com/projects/hibernate/browse/HHH-608

Grüße,
Christian


Top
 Profile  
 
 Post subject: Problem gelöst
PostPosted: Tue Aug 09, 2005 6:08 am 
Newbie

Joined: Tue Jul 05, 2005 4:42 pm
Posts: 2
Location: Zurich, Switzerland
Das Problem lag woanders. Der Tabellenname im Mapping File entsprach nicht genau der DB (Gross/Kleinschreibung unter Linux *fg*).

Der Tipp HSQLDB als TCP Server zu starten habe ich umgesetzt. Ist wirklich weniger Fehleranfällig, als mit einer In-Process Instanz von HSQLDB.


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.