Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Is @NaturalId supported in 3.6.10?
PostPosted: Sun May 27, 2012 12:54 am 
Beginner
Beginner

Joined: Wed Jan 21, 2009 8:41 pm
Posts: 45
In 3.6.10 is @NaturalId annotation and it's important on the use of updatetimestamps region supported?

Are you forced to use xml config files to use this feature in 3.6.10?


Top
 Profile  
 
 Post subject: Re: Is @NaturalId supported in 3.6.10?
PostPosted: Wed May 30, 2012 3:23 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 988
Quote:
it's important on the use of updatetimestamps region supported?


Only if you declare the NaturalId mutable the updatetimestamps region will be envolved
in determinating if a cached result set (2nd-level-query-cache) is still valid.
In case of a immutable NaturalId a cached result set is always considered valid.

Quote:
Are you forced to use xml config files to use this feature in 3.6.10?


No.


P.S.: NaturalId-support was fundamentally refactored and enhanced in hibernate 4.1,
so if you want really take benefit of the NaturalId feature, then it's worth to migrate to that version.


Top
 Profile  
 
 Post subject: Re: Is @NaturalId supported in 3.6.10?
PostPosted: Fri Jun 01, 2012 12:05 am 
Beginner
Beginner

Joined: Wed Jan 21, 2009 8:41 pm
Posts: 45
pb00067 wrote:
Quote:
it's important on the use of updatetimestamps region supported?


Only if you declare the NaturalId mutable the updatetimestamps region will be envolved
in determinating if a cached result set (2nd-level-query-cache) is still valid.
In case of a immutable NaturalId a cached result set is always considered valid.

Quote:
Are you forced to use xml config files to use this feature in 3.6.10?


No.


P.S.: NaturalId-support was fundamentally refactored and enhanced in hibernate 4.1,
so if you want really take benefit of the NaturalId feature, then it's worth to migrate to that version.


How when using JPA can you denote something is immutable because when you debug it does not make the determination that it's using an immutable natural id.

only if I use Criteria is it convinced that Natural Id applies.

I didn't find anywhere in the code where it picks up the annotation and uses it when the query is specified. IF you use JPQL is there anything more you have to do?

In criteria I'm using add(Restrictions.naturalId() ....

Am I allowed to put @NaturalId on a getter? That's what I have at the moment but it doesn't seem to work.


Top
 Profile  
 
 Post subject: Re: Is @NaturalId supported in 3.6.10?
PostPosted: Fri Jun 01, 2012 2:02 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 988
It is as you say: only the Criteria-API use the Natural-Id feature in Hibernate3, other APIS like HQL and JPA-QL do not.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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.