-->
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.  [ 2 posts ] 
Author Message
 Post subject: Parse problem with bulk delete in Hibernate 3.03
PostPosted: Thu Nov 17, 2005 5:16 am 
Newbie

Joined: Thu Nov 17, 2005 5:05 am
Posts: 2
[b]Hibernate version:3.03[/b]

[b]Mapping documents:
<class name="com.utstar.nms.req.persist.PjmFeatureStore"
table="PjmFeatureStore">
<id name="sn" column="SN" type="int">
<generator class="native"/>
</id>


<property name="projectID" column="ProjectID"
type="int"/>
<property name="tracedID" column="TracedID"
type="int"/>
<property name="version" column="Version"
type="int"/>
<property name="pjmFeatureID" column="PjmFeatureID"
type="int"/>

</class>
[/b]

[b]Code between sessionFactory.openSession() and session.close():
Transaction tx = session.beginTransaction();
Query q = session.createQuery("delete PjmFeatureStore where pjmFeatureID=?");
q.setParameter(0, new Integer(1));
ret = q.executeUpdate();
tx.commit();
[/b]

[b]Full stack trace of any exception that occurs:
Exception occurred during event dispatching:
org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from com.utstar.nms.req.persist.PjmFeatureStore where pjmFeatureID=?]
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:83)
at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:176)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:152)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
...
[/b]

[b]Name and version of the database you are using: MySQL3.x[/b]

Does hibernate 3.03 support bulk delete in this way, or should I delete the objects one by one just as in hibernate 2.x?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 5:31 am 
Newbie

Joined: Thu Nov 17, 2005 5:05 am
Posts: 2
I have found the solution:

replace the property "hibernate.query.factory_class"'s value:

org.hibernate.hql.classic.ClassicQueryTranslatorFactory
with
org.hibernate.hql.ast.ASTQueryTranslatorFactory

It's ok.


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