Hi,
With the following I am only able to run successfully with db admin account, but NOT dbo account in sybase. I search and search, nothing yet. I can do insert using plain jdbc code with dbo account. So I figure there is something hibernate does that caused the exception. Is the way that hibernate prepare queries in tempdb?
this is the error I get only when I insert or update:
com.sybase.jdbc2.jdbc.SybSQLException: An attempt was made to startup a multi-database update in database 'dev' after starting up the master transaction in a temporary database. This could render the database 'dev' unrecoverable and this update is therefore not allowed.
Hibernate version:3.1
Mapping documents:(hibernate.cfg.xml,CmTemplates.hbm.xml)
<?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 name="ClientMarks">
<property name="hibernate.connection.driver_class">com.sybase.jdbc2.jdbc.SybDriver</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.connection.url">jdbc:sybase:Tds:</property>
<property name="hibernate.connection.username"></property>
<property name="hibernate.default_catalog">dev</property>
<property name="hibernate.default_schema"></property>
<property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
<property name="connection.pool_size">5</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
<property name="hibernate.connection.release_mode">on_close</property>
<property name="hibernate.connection.autocommit">true</property>
<property name="hibernate.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>
<mapping resource="com/swissre/cm/beans/CmTemplates.hbm.xml" />
</session-factory>
</hibernate-configuration>
*************************CmTemplates.hbm.xml************
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Sep 8, 2006 4:47:17 PM by Hibernate Tools 3.2.0.beta7 -->
<hibernate-mapping>
<class name="com.swissre.cm.beans.CmTemplates" table="CM_templates">
<id name="name" type="string">
<column name="name" length="64" />
<generator class="assigned" />
</id>
<property name="content" type="string">
<column name="content" not-null="true" />
</property>
<property name="tokens" type="string">
<column name="tokens" length="256" not-null="true" />
</property>
</class>
</hibernate-mapping>
*************************
Code between sessionFactory.openSession() and session.close():
public void attachDirty(CmTemplates instance) {
log.debug("attaching dirty CmTemplates instance");
try {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
session.saveOrUpdate(instance);
//session.getTransaction().commit();
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
sessionFactory.getCurrentSession().getTransaction().rollback();
throw re;
}
finally{ getSessionFactory().close(); }
}
protected SessionFactory getSessionFactory() {
try {
return new Configuration().configure().buildSessionFactory();
} catch (Exception e) {
log.error("Could not locate SessionFactory in JNDI", e);
throw new IllegalStateException(
"Could not locate SessionFactory in JNDI");
}
}
Full stack trace of any exception that occurs:
attachDirty(CmClientMarksTsHome.java:92) - attach failed
org.hibernate.exception.GenericJDBCException: could not insert: [com.swissre.cm.beans.CmDetails]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2078)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at com.swissre.cm.beans.CmClientMarksTsHome.attachDirty(CmClientMarksTsHome.java:90)
at com.swissre.cm.beans.CmDetails.saveClientMarks(CmDetails.java:258)
at com.swissre.cm.PDFTest.main(PDFTest.java:59)
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: An attempt was made to startup a multi-database update in database 'dev' after starting up the master transaction in a temporary database. This could render the database 'dev' unrecoverable and this update is therefore not allowed.
at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2429)
at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1865)
at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:201)
at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:182)
at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1479)
at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1462)
at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:88)
at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2062)
... 13 more
org.hibernate.exception.GenericJDBCException: could not insert: [com.swissre.cm.beans.CmClientMarksTs]
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|