[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?
|