-->
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.  [ 1 post ] 
Author Message
 Post subject: PropertyAccessor API missing entity name?
PostPosted: Thu Feb 16, 2012 11:05 am 
Newbie

Joined: Thu Feb 16, 2012 10:53 am
Posts: 1
I'm trying to use a custom PropertyAccessor and have a problem. The API assumes that I can provide a Getter/Setter given just the class and property name. For a reflection based accessor, this makes perfect sense. However, Hibernate lets you map entities with an entity-name, and you can even have multiple entities with the same class that have different properties.

This is what I'm doing - creating entities that share an implementing class, but have custom properties added so that each entity can be different. Each such entity has a unique entity-name specified.

For this to work properly with a custom PropertyAccessor, the API ought to be something like:
Code:
public interface PropertyAccessor {
   public Getter getGetter(Class theClass, String entityName, String propertyName) throws PropertyNotFoundException;
   public Setter getSetter(Class theClass, String entityName, String propertyName) throws PropertyNotFoundException;
}

instead of the current
Code:
public interface PropertyAccessor {
   public Getter getGetter(Class theClass, String propertyName) throws PropertyNotFoundException;
   public Setter getSetter(Class theClass, String propertyName) throws PropertyNotFoundException;
}

I can probably provide myself with a work-around by patching my local PropertyAccessorFactory, so that I can specify a custom class and a custom value to be passed in to my PropertyAccessor constructor, but changing the PropertyAccessor API would be a better way to do this (from my perspective).

Is such a change possible?

Thanks,
Paul


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.