Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate CR2, Hibernate EntityManager CR1
Code between sessionFactory.openSession() and session.close():
Code:
Query query = em.createQuery("update Member m set m.roleId = ?1 where m.roleId = ?2");
query.setParameter(1, null);
query.setParameter(2, roleId);
query.executeUpdate();
Full stack trace of any exception that occurs:Code:
VARNING: SQL Error: 208, SQLState: 42S02
2006-aug-31 08:37:39 org.hibernate.util.JDBCExceptionReporter logExceptions
ALLVARLIG: Invalid object name '#iep.mbr_member'.
2006-aug-31 08:37:39 org.hibernate.hql.ast.exec.AbstractStatementExecutor$2 doWork
VARNING: unable to drop temporary id table after use
java.sql.SQLException: Cannot drop the table '#iep.mbr_member', because it does not exist in the system catalog.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:664)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1120)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1073)
at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:225)
at org.hibernate.hql.ast.exec.AbstractStatementExecutor$2.doWork(AbstractStatementExecutor.java:149)
at org.hibernate.hql.ast.exec.AbstractStatementExecutor.dropTemporaryTableIfNecessary(AbstractStatementExecutor.java:170)
at org.hibernate.hql.ast.exec.MultiTableUpdateExecutor.execute(MultiTableUpdateExecutor.java:170)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:391)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1134)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:43)
at biz.ist.atlas.domain.role.jpa.JpaRoleDAO.removeReferencesFromMembers(JpaRoleDAO.java:65)
Name and version of the database you are using:SQL Server 2000
The generated SQL (show_sql=true):Code:
Hibernate: insert into #iep.mbr_member select member0_.id_ as id_ from iep.mbr_member member0_ where fk_rol_role=?
I really guess this is an Hibernate Issue rather than a JPA issue.
We're using a custom NamingStrategy that prepend tablenames with the tableowner (iep). So Member in our case is declared with a table name mbr_member which becomes iep.mbr_member. We've using this for a year now without problems. However when I execute a batch update like the one above I got this exception stating it can't drop the table because it doesn't belongs in the system catalog. I get even more confused when I try to execute the query insert into#mbr_member... in the SQL Query manager and it call the obejct invalid, seems to me that there is more happening behind the scenes than actually gets logged.
Code: