-->
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: Problems with transient fields
PostPosted: Sat Feb 23, 2008 5:47 am 
Newbie

Joined: Thu Jun 14, 2007 6:02 pm
Posts: 2
Hello,
I am using Hibernate 3.3 with annotation support. In my entity class, I marked a field as transient using
Code:
private transient Double storeDistance
.
I expected this field to be non persistent and its values not to be updated in the database. But when i executed the application and called a NamedNativeQuery it updated the table with the mentioned transient variable. I could see the update statements using the show_sql property.
But i could not understand why the Hibernate had to update the table when I executed a named query for selection of rows.

I tried my application with @Transient and here although a column was created for the transient variable but the values were not updated.
But my requirement was not met as @Transient did not update the variable at the application level also. So when the getter method was called it returned a blank value.
Any help here would be great. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 24, 2008 7:56 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Using annotation @Transient is to tell hibernate that the field is not going to be mapped on database; It will not create the column either, you may still have a column on database because it is not going to remove old columns automatically: you could try deleting the whole schema and generating a new one, or delete the column manually and verify hibernate is not going to regenerate it again.
The java keyword "transient" has nothing to do with hibernate, and you really should not use it for mapping purposes unless you serialize entities as BLOBs.

What are you trying to do? Did I answer you questions?

regards,
Sanne


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.