-->
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.  [ 3 posts ] 
Author Message
 Post subject: [Shards] Deleting objects
PostPosted: Tue Oct 30, 2007 8:18 am 
Newbie

Joined: Sun Sep 16, 2007 9:45 am
Posts: 6
I am trying to delete rows from a sharded database based on certain criteria.
This is a sample code that I have been trying
Code:
String deleteQuery = "delete from table_name where id = ?" ;
Query query = ShardedDAO.getSession().createQuery(deleteQuery );
query.setInteger(0, 89);
query.executeUpdate()


The above code results in
Exception in thread "main" java.lang.UnsupportedOperationException
at org.hibernate.shards.session.ShardedSessionImpl.createSQLQuery(ShardedSessionImpl.java:1152)


So what would be the easiest way to delete entries from a shared database ? ( w/o loading and deleting object, preferably )

Thanks!
Rakesh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 2:01 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I guess implementing the feature would be the easiest path. Max and co can comment if there is any reason for not allowing that.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 4:29 pm 
Newbie

Joined: Sun Sep 16, 2007 9:45 am
Posts: 6
emmanuel wrote:
I guess implementing the feature would be the easiest path. Max and co can comment if there is any reason for not allowing that.


Currently, I am loading the objects and deleting them one by one.
Code:
List<Table> list= shardedSession.createCriteria(Table.class).add(
                    Restrictions.eq("id", id)).list();
            for(Table table: list) {
                shardedSession.delete(table);
            }


Implementing a proper delete ( w/o loading ) would be the best option ( It would be solved once the implementation for executeUpdate in ShardedQueryImpl is done.


Could you also let us know a rough timeframe when you are planning to release the next version ?


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