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