-->
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: Generated properties-lastModified property is not generated
PostPosted: Mon May 19, 2008 7:16 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
I have followed the code given in Chapter 4, Section Generated and default property values, to get generated value for lastModified property.
But it is not working with Oracle 9i.

Do you have a working example? Please check my posting here.

http://forum.hibernate.org/viewtopic.php?t=986972

Also can you explain me, how a refresh (executing a SELECT statement after INSERT of entity) gets generated value for the property 'lastModified'. What should the DDL of this entity look like. Who actually inserts the updated value into this property - hibernate code or Database.

If it database, does hibernate adds a default value to the property in DDL.

I have a feeling that hibernate code is not property tested in all areas. I found that there is a fix for generated property for components, in latest version 3.2.6 ga.

http://opensource.atlassian.com/project ... e/HHH-1471

But still this fix is also not working.


Top
 Profile  
 
 Post subject: Re: Generated properties-lastModified property is not genera
PostPosted: Wed May 28, 2008 2:27 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
sjhyam wrote:
I have followed the code given in Chapter 4, Section Generated and default property values, to get generated value for lastModified property.
But it is not working with Oracle 9i.

Hi, I think you are misinterpreting what is said in the doc (as I first did): it is not Hibernate that is generating those values but some database trigger! Hibernate is only respecting what the database does and will reload from db after insert/update to get the db generated value.

Carlo


Top
 Profile  
 
 Post subject: Re: Generated properties-lastModified property is not genera
PostPosted: Tue Jun 17, 2008 6:38 pm 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
carlolf wrote:
Hi, I think you are misinterpreting what is said in the doc (as I first did): it is not Hibernate that is generating those values but some database trigger! Hibernate is only respecting what the database does and will reload from db after insert/update to get the db generated value.

Carlo


Carol, how to create that some database trigger from hibernate mappings.

Thanks
Shyam
[/u]


Top
 Profile  
 
 Post subject: Re: Generated properties-lastModified property is not genera
PostPosted: Wed Jun 18, 2008 2:43 am 
Pro
Pro

Joined: Tue Jun 12, 2007 4:13 am
Posts: 209
Location: Berlin, Germany
sjhyam wrote:
Carol, how to create that some database trigger from hibernate mappings.


Sorry, as far as I know this is not possible. You have to do it directly on your database - have a look into your database docs.

With the Hibernate annotations you are only telling Hibernate that there will be database generated values (at INSERT or at UPDATE time), that Hibernate must read to have consistent Java objects!

_________________
Carlo
-----------------------------------------------------------
please don't forget to rate if this post helped you


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.