-
1. Re: Property access
adamw Oct 10, 2008 6:01 AM (in response to aslak)Hello,
no, there's no reason other that I simply didn't add it yet :)
If you know what should be added and where, please write, that way it will be much easier :). Preferrably, in a new JIRA issue :)
Thanks,
Adam -
2. Re: Property access
aslak Oct 10, 2008 6:32 AM (in response to aslak)Of course.. :)
https://jira.jboss.org/jira/browse/ENVERS-56
I will supply a patch soon..
-aslak- -
-
4. Re: Property access
sannegrinovero Oct 13, 2008 5:22 AM (in response to aslak)This fix is very welcome, but FYI I have added a warning comment on the JIRA about the proposed patch.
-
5. Re: Property access
aslak Oct 13, 2008 6:33 AM (in response to aslak)Thanks for your comment, sannegrinovero !
I tried the easy way out.. :o)
I'll supply a new patch that set the proper accessor based on AccessType.
I guess this should be passed down from the EntityConfiguration to the different IdMapper/PropertyMappers ?
(Where ever ReflectionTools.get/set is used more or less.. it could be placed on the ReflectionTools pr call as well, but it should be handled one time as a 'main' configuration)
-aslak- -
6. Re: Property access
sannegrinovero Oct 13, 2008 7:56 AM (in response to aslak)cool, but please ask for Adam's decision, I just told you how it is done in Hibernate Annotations.
I see he didn't use the Annotations module to scan the entities, maybe he has got some good reasons. -
7. Re: Property access
adamw Oct 13, 2008 9:21 AM (in response to aslak)Hello,
@aslak: Yes, I think that a property (in a Id/Property mapper) should know how it is accessed. I guess the best way is to collect this data in AnnotationMetadataReader, and then pass it to the mappers, which would invoke ReflectionTools with an additional "direct or property" parameter. In fact, it would be best to restructure the PersistentClassVersioningData class and create, for example, "PropertyData" class, which would store all the information, now spread in various maps.
Also, maybe it would be a good idea to encapsulate the property name+access method in one class. This "Property" class would then have getName(), getValue(Object o), setValue(Object o, Object val) methods. But that's something to consider :).
@sannegrinovero: how I could have used the annotations module? That is, which module (class) are you specifically talking about? :)
Adam -
8. Re: Property access
sannegrinovero Oct 13, 2008 10:12 AM (in response to aslak)Hi Adam,
I am speaking about the Hibernate Annotations project: http://www.hibernate.org/hib_docs/annotations/reference/en/html_single/
I don't know exactly how you could have used it, but in Hibernate Search we are currently not supporting configuration by xml, only by annotations, and Emmanuel once told me that it would be actually easy to implement as the Annotations module is quite flexbile and could read them exactly as they were declared in an xml.
What I know is that Search is not using reflection at all, it is importingimport org.hibernate.annotations.common.reflection.ReflectionManager; import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
(in SearchFactoryImpl)
You should ask on the dev list for details, Emmanuel is on vacations for some days but others (Hardy?) should know as well: even on Search I didn't use this classes much. -
9. Re: Property access
adamw Oct 13, 2008 10:58 AM (in response to aslak)Hello,
sure I know the project :)
From what I remember, when I started writing Envers, I read quite a lot of Hibernate code, to see what I can reuse. However, I think that either - there isn't, or I didn't find any way to plug into the parsing of Hibernate Annotation's annotation-reading module. You are right that it's written so that it's easy to add support for new annotations, but then I would have to modify Hibernate Annotations :). It's the same as auto-registering the event listeners - it is hard-coded. But asking on the dev lists may be a good idea :). Or when we get a chance to meet (on Devoxx?).
I'm using the XClass/ReflectionManager classess as well, to read annotations from (persistent) classes. But I don't think they might be useful in properties getting/setting.
Adam -
10. Re: Property access
sannegrinovero Oct 13, 2008 12:37 PM (in response to aslak)I think you're right... maybe it will be possible someday to support "pluggable annotation classes to scan for".
Ah so you're going to speak at Devoxx! cool.. I wrote it on my agenda, I hope to see you there.