-->
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: Refining a HSQL query
PostPosted: Thu Oct 27, 2005 8:54 am 
Newbie

Joined: Thu Oct 27, 2005 8:50 am
Posts: 1
Sorry for posting here but I don't see any Hibernate Forum
My HSQL at the moment looks like:

Code:

     List matches = new ArrayList();
     
      Criteria crt = session.createCriteria(BatchAccount.class);

         String uaHQL =
             "select B  "+
             "from BatchAccount B  "+
             "where  " +
             "     B.mlaNumber in( select BA.mlaNumber " +
             "                            from BatchAccount BA "+
             "                            where BA.batchID = :batch_ID ) ";
         matches.addAll(session.createQuery(uaHQL)
                                .setParameter("batch_ID", aBatchID )
                                  .list());


      for( int i=0; i<matches.size(); i++ )
      {
         BatchAccount batchAccount = (BatchAccount)matches.get(i);
         mLog.debug( batchAccount );
         batchAccount.setTransactionType( 3 );
         session.save( batchAccount );         
      }




I'm reading back objects of Type BatchAccount.
The code works fine but I was wondered is there an easier way to modify a field/attribute in a given list of matching records without having to read back the entire object when I'm only concerned with modifying a single attribute and then persisting the object again.?>

cheers ...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 27, 2005 12:02 pm 
Beginner
Beginner

Joined: Thu Jan 22, 2004 8:22 pm
Posts: 48
The following chapter in teh manual might be of some assistance.

http://www.hibernate.org/hib_docs/v3/reference/en/html/batch.html#batch-update


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.