-->
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.  [ 4 posts ] 
Author Message
 Post subject: getReference causes a select statement
PostPosted: Tue Mar 02, 2010 8:07 am 
Newbie

Joined: Thu Oct 15, 2009 8:48 am
Posts: 3
Hello everyone,

Is there a way to prevent a select statement being fired whenever I want my entity to be just updated? The following code causes a select statement which I would like to avoid:

Code:
manager.getReference(Execution.class, 1); //doesn't cause a select
manager.setEndDateTime(Calendar.newInstance()); //causes a select in table Execution


I'm using hibernate version 3.1.1 through JPA in glassfish 2.1.1

Thanks


Top
 Profile  
 
 Post subject: Re: getReference causes a select statement
PostPosted: Tue Mar 02, 2010 11:02 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
As I know you cannot avoid this select statement if you want to work with stateful persistent context.
I you just want update entities without reading them first then you can use bulk updates feature on a stateless session.


Top
 Profile  
 
 Post subject: Re: getReference causes a select statement
PostPosted: Tue Mar 02, 2010 11:27 am 
Newbie

Joined: Thu Oct 15, 2009 8:48 am
Posts: 3
pb00067 wrote:
As I know you cannot avoid this select statement if you want to work with stateful persistent context.
I you just want update entities without reading them first then you can use bulk updates feature on a stateless session.


That's unfortunate. Anyway, the bulk update operations fulfilled my needs. The only problem I had was due to my inheritance classes in this case. Many update statements were generated with invalid column names. To get it working, I had to break my classes inheritance.

Do you think it is actually possible to have some kind of feature that allows us to update entities without fetching data from databse in the future?

Thank you!


Top
 Profile  
 
 Post subject: Re: getReference causes a select statement
PostPosted: Tue Mar 02, 2010 2:50 pm 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Quote:
Do you think it is actually possible to have some kind of feature that allows us to update entities without fetching data from database in the future?

I'm not a member of the hibernate team so I don't know it something will we offered in future.
Given that is is already possible with bulk updates, I fear that it is nothing planned in this direction.


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