-->
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.  [ 7 posts ] 
Author Message
 Post subject: bulk update not working in H3.1beta2
PostPosted: Wed Aug 31, 2005 2:49 am 
Newbie

Joined: Fri Apr 15, 2005 5:01 am
Posts: 3
Hi everyone,

I have a problem with bulk update.
All the POJOs that we use have one superclass BasicObject, now we want to update just rows in the corresponding table BASIC_OBJECT. We use a table per subclass strategy.

I had a look in the Hibernate source and found out that in QueryTranslatorImpl.builAppropriateStatementExecutor() line 430
if (persister.isMultiTable())
is the bad boy, because if I change in the persister Implementation (JoinedSubclassEntityPersister) the return value from true to false
everything is working.
And if I understand the Comments in QueryTranslatorImpl line 431-433 correct maybe there will be a workaround?
Ok in line 434 I could change
return new MultiTableUpdateExecutor( walker );
to
return new BasicExecutor( walker, persister );
but I think this is not the best practice and have some other implications that I do not know.
So is this behavior correct or is there a bug in JoinedSubclassEntityPersister / MultiTableUpdateExecutor?

thanks in advance
Roland

Hibernate version:
hibernate-3.1beta2, hibernate-annotations-3.1beta4 latest from HEAD
Mapping documents:
Using annotations
Code between sessionFactory.openSession() and session.close():

HQL:
String hql = "update from BasicObject bo set bo.lockedBy = :lockedBy, bo.lockTime = :lockTime where bo.objectID = :objectID and ((bo.lockedBy = :lockedBy) or (bo.lockTime < :now) or (bo.lockTime is null))"
query = s.createQuery(hql);
query.setString("lockedBy", db.getCurrentUser().getUsername());
query.setTimestamp("now", now);
query.setLong("objectID", objectID);
rows = query.executeUpdate();

Full stack trace of any exception that occurs:
org.hibernate.HibernateException: no table name defined for insert-select
at org.hibernate.sql.InsertSelect.toStatementString(InsertSelect.java:56)
at org.hibernate.hql.ast.exec.AbstractStatementExecutor.generateIdInsertSelect(AbstractStatementExecutor.java:79)
at org.hibernate.hql.ast.exec.MultiTableUpdateExecutor.<init>(MultiTableUpdateExecutor.java:47)
at org.hibernate.hql.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:434)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:170)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:101)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:468)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1025)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1006)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at de.mtg.vorges.database.impl.DBServicesImpl.lock(DBServicesImpl.java:57)
at de.mtg.vorges.common.SystemHelper.lock(SystemHelper.java:150)
at de.mtg.vorges.client.dialog.component.CommonTreeCtrl.handleEdit(CommonTreeCtrl.java:208)
at de.mtg.vorges.client.dialog.component.CommonTreeDlg.actionPerformed(CommonTreeDlg.java:276)
at de.mtg.independent.util.RedirectAction.actionPerformed(RedirectAction.java:85)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Name and version of the database you are using:
MS-SQL 2005 Preview


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 10:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
actually it sounds more like an issue in either the dialect or the binding (metadata parsing) code.

the only way what you see should occur is when the binding code does not generate a temporary id-storage table name for the entity.

So it sounds like you are using the annotation-based Configuration; correct?

Also, which dialect do you use?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 11:06 am 
Newbie

Joined: Fri Apr 15, 2005 5:01 am
Posts: 3
steve wrote:
actually it sounds more like an issue in either the dialect or the binding (metadata parsing) code.

the only way what you see should occur is when the binding code does not generate a temporary id-storage table name for the entity.

So it sounds like you are using the annotation-based Configuration; correct?

Also, which dialect do you use?


Hello steve,

the mappings are done with Annotations, but the configuration is done through a hibernate.cfg.xml file, hope that answers your question.

The dialect is org.hibernate.dialect.SQLServerDialect.

Hope my first post makes it clear, that our Inheritance structure is rooted on this BasicObject so all other classes are derived from this one.

thx Roland


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 11:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
you use SQLServerDialect to connect to a MySQL database?

yes, you use joined-subclass, i understand.

it is the mappings I am talking about. I.e. you use AnnotationConfiguration as opposed to the normal Configuration...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 11:32 am 
Newbie

Joined: Fri Apr 15, 2005 5:01 am
Posts: 3
steve wrote:
you use SQLServerDialect to connect to a MySQL database?

yes, you use joined-subclass, i understand.

it is the mappings I am talking about. I.e. you use AnnotationConfiguration as opposed to the normal Configuration...


No, at the end of my first posting there is name and version of DB ->MS SQL 2005 Preview

Of course we use AnnotationConfiguration.


I forgot to say, with hibernate 3.0.5 and annotations3.0beta1 (ejb3.0 early draft) it worked perfect and we changed @InheritanceJoinColumn -> @PrimaryKeyJoinColumn to get the latest version of hibernate+annotations running.

Roland


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 22, 2005 12:40 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Did anything come of this? I'm using SQL Server 2000 and Hibernate 3.1 beta3, and when I try to delete from a joined-subclass, I get the same exception. It seems to work fine on PostgreSQL 8. I'm guessing it's some problem with the dialect, but I wouldn't have any idea what to look at.

Can someone give some insight into this? Is it something missing from the dialect?


Top
 Profile  
 
 Post subject: Problem with bulk update
PostPosted: Mon Feb 13, 2006 4:23 pm 
Newbie

Joined: Wed Oct 19, 2005 3:45 pm
Posts: 14
I´m having the same problem.
My structure is one superclass and a lot of subclasees extending from that one and when i try to update a field in the subclass table i get the exception:

Code:
16:22:45,140 INFO  [STDOUT] org.hibernate.HibernateException: no table name defined for insert-select
        at org.hibernate.sql.InsertSelect.toStatementString(InsertSelect.java:56)
        at org.hibernate.hql.ast.exec.AbstractStatementExecutor.generateIdInsertSelect(AbstractStatementExecutor.java:79)
        at org.hibernate.hql.ast.exec.MultiTableUpdateExecutor.<init>(MultiTableUpdateExecutor.java:47)
        at org.hibernate.hql.ast.QueryTranslatorImpl.buildAppropriateStatementExecutor(QueryTranslatorImpl.java:434)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:170)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:101)
        at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:473)
        at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1032)
        at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1013)
        at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
        at com.integration.ImportManagement.ImportManager.updateAditionalProperties(ImportManager.java:640)
        at com.integration.ImportManagement.ImportManager.processStaging(ImportManager.java:118)
        at com.integration.ModelElementManagement.ModelElementManagementServlet.doGet(ModelElementManagementServlet.java:90)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)


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