-->
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: DML-style operations on collections?
PostPosted: Mon Jun 15, 2009 3:42 pm 
Beginner
Beginner

Joined: Fri Sep 26, 2008 2:39 am
Posts: 20
Hi,

My problem is that dml-style operations (as described here: http://docs.jboss.org/hibernate/stable/ ... irect.html) only work if the from-clause names an entity.

I would like to manipulate the contents of the collections for an entity.

My entity is a class DemoPerson which has an collection named tags - this collection is mapped into the database-table demo_person_tags.
( NFO: Mapping collection: org.osbl.search.demodata.model.DemoPerson.tags -> demo_person_tags )

From this table i would (for example) like to remove lines.

Is this possible using DML-style HQL or do I have to use native sql queries to manipulate this data?

I tried some more and I will have to use native SQL - which brings me to a quick follow-up question:

createSQLQuery("FROM ??? DELETE WHERE id = 69").executeUpdate();

What is the correct way to get demo_person_tags to where the questionmarks are in the native sql query?
(I could just write it in there, but then the code would have to change if the mapping changes - that's not cool :) ).

Thank you in advance and for your time.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.