-->
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.  [ 1 post ] 
Author Message
 Post subject: Batch delete JPQL vs HQL
PostPosted: Tue May 27, 2008 2:46 pm 
Newbie

Joined: Fri Feb 08, 2008 11:34 am
Posts: 1
Note that we use JPA with Hibernate as our JPA provider.

I have two tables
TeamMember
Task

A teammember has many tasks. The task table has a foreign key column to the teammember.memberid. My task entity, however, does not include this column as a field in the entity.

I am trying to do a batch delete with the following syntax:

DELETE FROM Task t WHERE t.teammember.memberid = 'mymemberid'

This is the generated syntax:
Hibernate: delete from Task, TeamMember teammember1_ where memberid=?

I get an SQLGrammerException (on oracle, postgres and mysql).

The hibernate documentation (Reference 13.4 DML-style operations)seems pretty clear that no joins (implicit or explicit) can be specified in a bulk HQL query.

I could not find the same restrictions in the JPQL specification which I thought was a subset of HQL. Is this a restriction with hibernate but not with JPQL or am I missing something in the JPQL specification?

Is there a better way to delete all of the children of an entity with only the parent tables identifier?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.