-->
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: how can I tell hibernate not to do JDBC Batch Update?
PostPosted: Mon May 17, 2004 4:44 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
hi all,
I have a setter method of a property like;

setEquipments (List equipments) {
if ( equipments instanceof net.sf.hibernate.collection.Bag)
this.equipments= new ArrayList(equipments);
else this.equipments= equipments;
}

I need to convert to the "bag" to a arrayList because I serialize the data via XStream that cant deserialize the file where list classes are net.sf.hibernate.collection.Bag.( they need to be ArrayList)

I cant use list instead of bag in mapping file because the I have no column to set as an index column for the list . ( No integer column)

When I run a query, hibernate calls the JDBC batch update and gives exception : cannot update ("DB1","AIRCRAFT","AIRCRAFT_ID") to null
(Aircraft is the class that holds list of equipments and Aircraft_id is the many to one column)

I know that such an error is very normal, there must be.

I have an solution that to keep another list independent of database and call its setter.

setEquipments (List equipments) {
this.equipments = equipments
if ( equipments instanceof net.sf.hibernate.collection.Bag)
setArrayListEquipments(new ArrayList(equipments)

}

setArrayListEquipments(List eq) {
this.arrayListEquipments = eq
}

but I wonder whether I can handle all in one setter like the one at the top of the table?!?

_________________
-developer


Top
 Profile  
 
 Post subject: Re: how can I tell hibernate not to do JDBC Batch Update?
PostPosted: Mon May 17, 2004 8:32 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
borak wrote:
how can I tell hibernate not to do JDBC Batch Update?


use:
hibernate.jdbc.batch_size=0

3.5. Optional configuration properties
hibernate.jdbc.batch_size -- A non-zero value enables use of JDBC2 batch updates by Hibernate. eg. recommended values between 5 and 30

--
Leonid


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 17, 2004 9:16 am 
Senior
Senior

Joined: Sun Mar 14, 2004 10:16 am
Posts: 129
Location: Ankara
thanks but need to do that,
I relaized that writing inverse="true" to bag mapping handles this update error.

_________________
-developer


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.