Friday 15 July 2011

Hibernate's AttributeAccessor and PropertyAccessor combo not working -



Hibernate's AttributeAccessor and PropertyAccessor combo not working -

i working on scala project , using hibernate persistence. entity mappings, utilize standard scala getter/setter pairs don't have write normal java getter/setter pairs.

using accesstype.field works. , know can utilize @beanproperty generating bean methods. however, still know why configuration not working.

i using hibernate 4.3.6.final. trying create utilize of @attributeaccessor annotation not yielding results. is, hibernate defaulting own internal propertyaccessor implementations. custom propertyaccessor not getting called. have been looking around hours , seems hibernate doesn't have back upwards feature anymore. seems weird since attributeaccessor seems pretty recent add-on hibernate. also, there this piece of documentation steve ebersole tells me going right way.

i have tried out several combinations of @org.hibernate.annotations.accesstype, org.hibernate.annotations.attributeaccessor , @javax.persistence.access. ex.

@attributeaccessor("persistence.property.scalapropertyaccessor") @org.hibernate.annotations.accesstype("persistence.property.scalapropertyaccessor") class user { // ... }

also, there open issue at: https://hibernate.atlassian.net/browse/hcann-48

i not sure status on this. have idea?

well, guess should set reply here in case poor lost soul me stumbles here.

that issue still open , has been open since apr-2012. not putting hopes on getting resolved anytime soon. , yes, have been considering submit patch can resolve issue. haven't gotten around yet. have looked around source-code of hibernate , looks entire code-base in kind of flux. comments seem indicate refactoring of lot of things upcoming hibernate 5.

however, shouldn't stop brave souls, right? well, managed write piece of code allows me utilize hibernate scala scala's own getter-setters, , allows using option types without hitch.

i cannot explain whole thing here, since involves hacking hibernate source code , doing load-time aspectj magic create work wanted to.

even though might self promotion, here link blog post wrote solution, , here toy play framework project demonstrates example.

hibernate

No comments:

Post a Comment