-->
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: Extending Persister to modify queries
PostPosted: Fri Mar 11, 2005 11:26 pm 
Newbie

Joined: Sat Feb 26, 2005 10:10 pm
Posts: 8
Hibernate version: 3.0rc1

Mapping documents:


Hi,

I am trying to make an "update" query into two statements to customize Hibernate to deal with historical data. An update query to me would look like:

insert into Object(startVersion, endVersion, name, objId) values (?, ?, ?, ?)
update Object SET endVersion=? where endVersion=-1


It seems like <sql-insert>my query</sql-insert> can only take a single statement. When I consider customizing the BasicEntityPersister class, this piece of code allows only one statement to be added the batch as an update statement.

Code:
BasicEntityPersister:1900

if ( useBatch ) {
  session.getBatcher().addToBatch( 1 );
return true;
}


I am trying not to have to customize the persister too much.

After reading the forum, I gathered that I can use a stored procedure that takes parameters to achieve this.

Is stored procedure the suggested path to take?

Thanks!

Theen-Theen


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.