Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Problem definining custom PropertyAccessor using annotation
PostPosted: Mon Nov 29, 2010 9:11 am 
Newbie

Joined: Fri Sep 23, 2005 5:34 pm
Posts: 3
Hi
We are migrating from Hibernate 3.2.0.GA to 3.6.0.Final.

We use annotations to define mapping of persistence objects and encountered a problem with our use of @AccessType. Regular fields are accessed using Hibernate's default accessor, but collection fields we want to access using our own implementation of PropertyAccessor. Here is a snapshot of how we use annotations to define such a field:
Code:
   @OneToMany(mappedBy="ownerObject",
   targetEntity=targetEntityClassName.class)
   @org.hibernate.annotations.AccessType("myPropertyAccessorImpl")
   protected Set getCollectionField()
   {
      ...
   }

When debugging our application using Hibernate 3.6.0 we don't stop at our property accessor. Doing some debug on Hibernate code we've noticed that during Configuration.buildSessionFactory() (line 1826) we get to AnnotationBinder.processElementAnnotations() (line 1753), which calls collectionBinder.setAccessType( inferredData.getDefaultAccess() );
Now, PropertyInferredData.getDefaultAccess() gets the correct value from the annotation object but then calls AccessType.getAccessStrategy(accessTypeAnnotation.value()) (line 75), which translates it to the default accessor.

Are we doing something wrong? Is there another way of defining a custom property accessor using annotations?


Top
 Profile  
 
 Post subject: Re: Problem definining custom PropertyAccessor using annotation
PostPosted: Fri May 04, 2012 1:06 pm 
Newbie

Joined: Wed May 02, 2012 5:35 am
Posts: 3
I'm having the same issue. Did you find a solution to this problem?

Regards


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