-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem in accessing table data under non-default schema
PostPosted: Thu Jun 30, 2005 5:08 am 
Newbie

Joined: Thu Jun 30, 2005 3:12 am
Posts: 1
Hibernate version: 3.0.5

Mapping documents:
Code:
<hibernate-mapping>
   <class entity-name="HibernateTest5" schema="ANOTHER_SCHEMA" table="HIBERNATE_TEST5">
[t]      <id column="ID" length="20" name="id" type="long">
         <generator class="increment"/>
      </id>
      <version column="MY_VERSION" name="myVersion" type="integer"/>
      <property column="COLUMN1" length="19" name="column1" not-null="false" type="long" unique="false"/>
      <property column="COLUMN_A" length="40" name="columnA" not-null="false" type="string" unique="false"/>
   </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Code:
- SQL Error: 942, SQLState: 42000
- ORA-00942: table or view does not exist

org.hibernate.exception.SQLGrammarException
could not fetch initial value
   at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
   at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
   at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:107)
   at org.hibernate.id.IncrementGenerator.generate(IncrementGenerator.java:45)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
   at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
   at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
   at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
   at testing.hibernate.SessionTest1.createObject(SessionTest1.java:177)
Caused by: java.sql.SQLException
ORA-00942: table or view does not exist

   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
   at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
   at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
   at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
   at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
   at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:894)
   at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
   at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:984)
   at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2885)
   ... 14 more


Name and version of the database you are using:
Oracle 9i (9.2.0)

The generated SQL (show_sql=true):
Not shown...



Hi all,

I have written some similar Hibernate mapping files for different Oracle user
schema, like the one above. I have tried to use Configuration object to build
SessionFactory for these mapping files, and the tables are created correctly
into different schema. But problem comes when I tried to insert some data into
these tables through Session object. Data can be inserted only when the tables
are located in the default schema, or exceptions as shown above for other schema.

I have tried several times on changing the configuration, and I can only come to
a strange "solution" to this problem. I found that for those cases using other
schema, if there is also an identifical table created in the default schema, the
Hibernate objects can be saved correctly without exceptions. Would anyone give
some suggestions on this? Thank you.

gordonchan


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

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.