-->
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.  [ 9 posts ] 
Author Message
 Post subject: Hibernate / Derby - SQL Exception: Table 'HIBERNATE_UNIQUE_K
PostPosted: Thu Dec 22, 2005 3:50 pm 
Newbie

Joined: Thu Dec 22, 2005 3:39 pm
Posts: 1
Location: Bellingham, WA
I am having troubles getting derby and hibernate to work together. I keep getting an exception saying that the Table 'HIBERNATE_UNIQUE_KEY' does not exist. Is this table supposed to created (ie do I need to manually create it or)? Any ideas on what I am doing wrong?

Hibernate version: hibernate-3.1

Mapping documents:
hibernate.cfg.xml
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
  <session-factory>
    <!-- Database connection settings -->
    <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
    <property name="connection.url">jdbc:derby:/EVENT;create=true</property>
    <property name="connection.username"></property>
    <property name="connection.password"></property>
   
    <!-- JDBC connection pool -->
    <property name="connection.pool_size">1</property>
   
    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.DerbyDialect</property>
   
    <!-- Enable Hibernate's automatic session context management -->
    <property name="current_session_context_class">thread</property>
   
    <!-- Disable the second-level cache -->
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
   
    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>
      
    <!-- Drop and re-create the database schema on startup -->
    <property name="hbm2dll.auto">create</property>
   
    <mapping resource="events/Event.hbm.xml" />
  </session-factory>
</hibernate-configuration>


Event.hbm.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
    <class
        name="events.Event"
        table="EVENT"
    >

        <id
            name="id"
            column="EVENT_ID"
            type="java.lang.Long"
        >
            <generator class="native">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-Event.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="date"
            type="timestamp"
            column="EVENT_DATE"
        />

        <property
            name="title"
            type="java.lang.String"
            column="title"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-Event.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
Code:
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();

        Event theEvent = new Event();
        theEvent.setTitle(title);
        theEvent.setDate(theDate);

        session.save(theEvent);
        session.getTransaction().commit();


Full stack trace of any exception that occurs:
Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:94)
at org.hibernate.id.TableGenerator.generate(TableGenerator.java:94)
at org.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:61)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:544)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:533)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:529)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:292)
at $Proxy0.save(Unknown Source)
at events.EventManager.createAndStoreEvent(EventManager.java:40)
at events.EventManager.main(EventManager.java:17)
Caused by: SQL Exception: Table 'HIBERNATE_UNIQUE_KEY' does not exist.
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.hibernate.id.TableGenerator.doWorkInCurrentTransaction(TableGenerator.java:131)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:64)
... 19 more

Name and version of the database you are using: Derby 10.1.2.1

The generated SQL (show_sql=true):
Here is the log info that I see before the exception is thrown:
11:36:20,460 INFO Environment:479 - Hibernate 3.1
11:36:20,460 INFO Environment:509 - hibernate.properties not found
11:36:20,476 INFO Environment:525 - using CGLIB reflection optimizer
11:36:20,476 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
11:36:20,554 INFO Configuration:1286 - configuring from resource: /hibernate.cfg.xml
11:36:20,554 INFO Configuration:1263 - Configuration resource: /hibernate.cfg.xml
11:36:20,695 INFO Configuration:468 - Reading mappings from resource: events/Event.hbm.xml
11:36:20,820 INFO HbmBinder:265 - Mapping class: events.Event -> EVENT
11:36:20,851 INFO Configuration:1397 - Configured SessionFactory: null
11:36:20,851 INFO Configuration:1022 - processing extends queue
11:36:20,851 INFO Configuration:1026 - processing collection mappings
11:36:20,851 INFO Configuration:1035 - processing association property references
11:36:20,851 INFO Configuration:1057 - processing foreign key constraints
11:36:20,929 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
11:36:20,929 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 1
11:36:20,929 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
11:36:21,210 INFO DriverManagerConnectionProvider:80 - using driver: org.apache.derby.jdbc.EmbeddedDriver at URL: jdbc:derby:/EVENT;create=true
11:36:21,210 INFO DriverManagerConnectionProvider:86 - connection properties: {user=, password=****}
11:36:21,742 INFO SettingsFactory:77 - RDBMS: Apache Derby, version: 10.1.2.1
11:36:21,742 INFO SettingsFactory:78 - JDBC driver: Apache Derby Embedded JDBC Driver, version: 10.1.2.1
11:36:21,773 INFO Dialect:103 - Using dialect: org.hibernate.dialect.DerbyDialect
11:36:21,788 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
11:36:21,788 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
11:36:21,788 INFO SettingsFactory:125 - Automatic flush during beforeCompletion(): disabled
11:36:21,788 INFO SettingsFactory:129 - Automatic session close at end of transaction: disabled
11:36:21,788 INFO SettingsFactory:144 - Scrollable result sets: enabled
11:36:21,788 INFO SettingsFactory:152 - JDBC3 getGeneratedKeys(): disabled
11:36:21,788 INFO SettingsFactory:160 - Connection release mode: auto
11:36:21,788 INFO SettingsFactory:187 - Default batch fetch size: 1
11:36:21,788 INFO SettingsFactory:191 - Generate SQL with comments: disabled
11:36:21,788 INFO SettingsFactory:195 - Order SQL updates by primary key: disabled
11:36:21,788 INFO SettingsFactory:338 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
11:36:21,804 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
11:36:21,804 INFO SettingsFactory:203 - Query language substitutions: {}
11:36:21,804 INFO SettingsFactory:209 - Second-level cache: enabled
11:36:21,804 INFO SettingsFactory:213 - Query cache: disabled
11:36:21,804 INFO SettingsFactory:325 - Cache provider: org.hibernate.cache.NoCacheProvider
11:36:21,804 INFO SettingsFactory:228 - Optimize cache for minimal puts: disabled
11:36:21,804 INFO SettingsFactory:237 - Structured second-level cache entries: disabled
11:36:21,804 INFO SettingsFactory:257 - Echoing all SQL to stdout
11:36:21,804 INFO SettingsFactory:264 - Statistics: disabled
11:36:21,804 INFO SettingsFactory:268 - Deleted entity synthetic identifier rollback: disabled
11:36:21,804 INFO SettingsFactory:283 - Default entity-mode: pojo
11:36:21,851 INFO SessionFactoryImpl:153 - building session factory
11:36:22,210 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
11:36:22,226 INFO SessionFactoryImpl:353 - Checking 0 named HQL queries
11:36:22,226 INFO SessionFactoryImpl:373 - Checking 0 named SQL queries
11:36:22,679 WARN JDBCExceptionReporter:71 - SQL Error: 20000, SQLState: 42X05
11:36:22,679 ERROR JDBCExceptionReporter:72 - Table 'HIBERNATE_UNIQUE_KEY' does not exist.
11:36:22,679 WARN JDBCExceptionReporter:48 - SQL Warning: 10000, SQLState: 01J01
11:36:22,679 WARN JDBCExceptionReporter:49 - Database '/EVENT' not created, connection made to existing database instead.

EventManager Code:
Code:
package events;
import org.hibernate.Session;

import java.util.Date;
import java.util.List;

import util.HibernateUtil;

public class EventManager {

    public static void main(String[] args) {
        EventManager mgr = new EventManager();
       
        args = new String[] {"store"};

        if (args[0].equals("store")) {
            mgr.createAndStoreEvent("My Event", new Date());
        }
        else if (args[0].equals("list")) {
            List events = mgr.listEvents();
            for (int i = 0; i < events.size(); i++) {
                Event theEvent = (Event) events.get(i);
                System.out.println("Event: " + theEvent.getTitle() +
                                   " Time: " + theEvent.getDate());
            }
        }

        HibernateUtil.getSessionFactory().close();
    }

    private void createAndStoreEvent(String title, Date theDate) {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();

        Event theEvent = new Event();
        theEvent.setTitle(title);
        theEvent.setDate(theDate);

        session.save(theEvent);
        session.getTransaction().commit();
    }
   
    private List listEvents() {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();

        List result = session.createQuery("from Event").list();
        session.getTransaction().commit();

        return result;
    }

}


Event code:
Code:
package events;

import java.util.Date;

/**
*
* @hibernate.class table="EVENT"
*/
public class Event {
   private Long id;
   
   private String title;
   private Date date;
   
   public Event() {}
   
   /**
    *
    * @hibernate.id column="EVENT_ID" generator-class="native"
    */
   public Long getId() {
      return id;
   }
   
   private void setId(Long id) {
      this.id = id;
   }
   
   /**
    *
    * @hibernate.property column="EVENT_DATE" type="timestamp"
    */
   public Date getDate() {
      return date;
   }
   
   public void setDate(Date date) {
      this.date = date;
   }
   
   /**
    *
    * @hibernate.property
    */
   public String getTitle() {
      return title;
   }
   
   public void setTitle(String title) {
      this.title = title;
   }
}

_________________
Thanks,

Tim.


Top
 Profile  
 
 Post subject: Derby - Table does not exist problem (bis)
PostPosted: Fri Apr 14, 2006 10:29 am 
Newbie

Joined: Fri Apr 14, 2006 10:16 am
Posts: 4
Location: Belgium
I'm having the same problem.

My config:
Hibernate 313
DB: Apache Derby, version: 10.1.2.1
Relevant settings of hibernate.cfg.xml:
<property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
<property name="current_session_context_class">thread</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="hbm2dll.auto">create</property>
<property name="cache.provider">org.hibernate.cache.NoCacheProvider</property>

Behavior:
The factory gets well configured. From there a session can be acquired without a problem. But then things go wrong.
With a clean DB (apart from default system tables), upon trying to persist (using saveOrUpdate) the first entity, I always get these errors: (copied a little earlier, from the start of the session)

2006-04-14 15:49:47,215 DEBUG [org.hibernate.impl.SessionImpl] - opened session at timestamp: 4690012516179968
2006-04-14 15:49:47,714 DEBUG [org.hibernate.context.ThreadLocalSessionContext] - allowing proxied method [toString] to proceed to real session
2006-04-14 15:49:47,714 INFO [eu.wickedware.zandbak.hibernate.persistenceDelegate.HibernatePersistenceDelegator] - Passed session config: session is null? SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
2006-04-14 15:49:47,714 INFO [eu.wickedware.zandbak.hibernate.persistenceDelegate.HibernatePersistenceDelegator] - Passed session config: session is null? SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
2006-04-14 15:49:47,715 DEBUG [org.hibernate.context.ThreadLocalSessionContext] - allowing method [beginTransaction] in non-transacted context
2006-04-14 15:49:47,715 DEBUG [org.hibernate.context.ThreadLocalSessionContext] - allowing proxied method [beginTransaction] to proceed to real session
2006-04-14 15:49:47,715 DEBUG [org.hibernate.transaction.JDBCTransaction] - begin
2006-04-14 15:49:47,715 DEBUG [org.hibernate.jdbc.ConnectionManager] - opening JDBC connection
2006-04-14 15:49:47,715 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] - total checked-out connections: 0
2006-04-14 15:49:47,716 DEBUG [org.hibernate.connection.DriverManagerConnectionProvider] - using pooled JDBC connection, pool size: 0
2006-04-14 15:49:47,716 DEBUG [org.hibernate.transaction.JDBCTransaction] - current autocommit status: false
2006-04-14 15:49:47,716 DEBUG [org.hibernate.jdbc.JDBCContext] - after transaction begin
2006-04-14 15:49:47,716 DEBUG [org.hibernate.context.ThreadLocalSessionContext] - allowing proxied method [saveOrUpdate] to proceed to real session
2006-04-14 15:49:47,808 DEBUG [org.hibernate.engine.IdentifierValue] - id unsaved-value strategy UNDEFINED
2006-04-14 15:49:47,811 DEBUG [org.hibernate.persister.entity.AbstractEntityPersister] - Getting current persistent state for: [eu.wickedware.zandbak.hibernate.model.Company#philips2]
2006-04-14 15:49:47,812 DEBUG [org.hibernate.jdbc.AbstractBatcher] - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-04-14 15:49:47,812 DEBUG [org.hibernate.SQL] - select company_.NAME from COMPANY company_ where company_.NAME=?
Hibernate: select company_.NAME from COMPANY company_ where company_.NAME=?
2006-04-14 15:49:47,813 DEBUG [org.hibernate.jdbc.AbstractBatcher] - preparing statement
2006-04-14 15:49:49,919 DEBUG [org.hibernate.util.JDBCExceptionReporter] - could not retrieve snapshot: [eu.wickedware.zandbak.hibernate.model.Company#philips2] [select company_.NAME from COMPANY company_ where company_.NAME=?]
ERROR 42X05: Table 'COMPANY' does not exist.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.ReadCursorNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.CursorNode.bind(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
at org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:99)
at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:979)
at org.hibernate.engine.StatefulPersistenceContext.getDatabaseSnapshot(StatefulPersistenceContext.java:232)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:189)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:460)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:502)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:494)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:490)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
at $Proxy0.saveOrUpdate(Unknown Source)
at eu.wickedware.zandbak.hibernate.persistenceDelegate.HibernatePersistenceDelegator.persisteOneObjectInDB(HibernatePersistenceDelegator.java:111)
at eu.wickedware.zandbak.hibernate.client.DomainModelMesser.initialDBFillMethod(DomainModelMesser.java:97)
at eu.wickedware.zandbak.hibernate.client.DomainModelMesser.main(DomainModelMesser.java:125)


Any idea on what I do wrong:ho wto avoid this problem?
(hope it's not a bug)
I saw in another derby related Topic that with Hibernate v. 313 some Derby related issues would be rectified. Is it still a bit too soon?
& If so, is the prob solved if I create the schema myself or are there other issues?
Bye & thanks in advance for ideas,
Mino


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 14, 2006 8:29 pm 
Regular
Regular

Joined: Wed Jul 07, 2004 2:00 pm
Posts: 64
The Hibernate documentation for the native-type generator indicates that it tries identity, sequence, or hilo approach, depending on which your database supports. I assume that Derby falls back to the hilo approach. The documentation states that you should have a table called hibernate_unique_key with a column called next_hi. This column should, of course, be a number. I suspect that you need to insert a row with an initial value.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 15, 2006 12:49 pm 
Newbie

Joined: Fri Apr 14, 2006 10:16 am
Posts: 4
Location: Belgium
No, I'm using application identity. (From the doc Hibernate I get: Omitting the generator tag inside "id", implies a fallback to "assigned" which means the app itself is to give objects an ID before saving it. This is exactly what I want.)
(no hi/lo)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 15, 2006 12:58 pm 
Regular
Regular

Joined: Wed Jul 07, 2004 2:00 pm
Posts: 64
In your mapping document, you have generator=native. If you want assigned identifier, you should have generator=assigned.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 15, 2006 1:01 pm 
Regular
Regular

Joined: Wed Jul 07, 2004 2:00 pm
Posts: 64
Sorry, I mixed up the two problems. Mino, your trace indicates that the Company table does not exist - doesn't look like the same issue at all.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 15, 2006 1:11 pm 
Newbie

Joined: Fri Apr 14, 2006 10:16 am
Posts: 4
Location: Belgium
Indeed, that's where our config (of the 2 situations posted above) differ.

The first posted has stipulated "native"; where I have nothing stipulated.
E.G. company has this mapping:

<class name="Company" table="COMPANY" optimistic-lock="version">
<id name="name" column="NAME"></id>
<set name="departments" table="COMPANY_DEPARTMENTS_JOIN">
<key column="COMPANY_ID"></key>
<one-to-many class="Department" />
</set>
</class>

I do think though, the probems are at least (if not the same) related as we both suffer from "tabel does not exist" issues at the same moment with the same DB/ DB version/Hibernate version/... .
I feel the whole ID config setup issue is looking too far, the problem occurs even before IDs would matter, when the table itself is not even found. (gut feeling)
(Then again, who am I ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 15, 2006 4:32 pm 
Regular
Regular

Joined: Wed Jul 07, 2004 2:00 pm
Posts: 64
But Hibernate is saying that it can't find the Company table, not anything to do with the id generation. Do you mean that you can connect to the database using some other tool (or just JDBC in your app) and do a select on company without getting an error?


Top
 Profile  
 
 Post subject: Re:
PostPosted: Sat Apr 15, 2006 4:42 pm 
Newbie

Joined: Fri Apr 14, 2006 10:16 am
Posts: 4
Location: Belgium
No,
I'm wondering why, despite
<property name="hbm2dll.auto">create</property>
Hibernate is unable to create the schema.
From the logs I get: It can connect to the DB, it correctly parses the mapping file, etc... .
Yet fails and crashes from the moment it tries to actually load the schema towards the DB. (and as you can see I specified the correct DerbyDialect too)
Perhaps Derby is not yet "popular" enough for quality/robust code. In the manual of v.3.1.3 there are no refs to Derby either. (aparently Derby is not yet a supported DB, the derbyDialect isn't even mentioned in the list of dialects! :-)
Too bad, it's a fine DB with nice features.


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