google-code-export / hibernate-audit

Automatically exported from code.google.com/p/hibernate-audit
2 stars 1 forks source link

IllegalArgumentException while initializing an enum variable #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. save an entity which has a customized enum variable
2. retrieve the entity with hibernate-audit query methods
3.

What is the expected output? What do you see instead?
an IllegalArgumentException is raised during the initialization of the saved 
auditType which has an enum variable..see the attached file for details.

What version of the product are you using? On what operating system?
hibernate-audit 1.0.32 - Windows XP

Please provide any additional information below.
As far as i could understand the initialization process from your 
code(AuditSessionFactoryObserver.class), there is a no check case for the type 
EnumType or rather CustomType in the method initializeAuditType starting @line 
194, so that you just save it as primitive_type if it doesnt match your 
expected types(which occurs for my enum type). so therefore the 
PropertyValueConverter cannot convert the value to the given type in the method 
valueOf when it is requested later.
Could you please have a look into it? TIA

Original issue reported on code.google.com by StefanKa...@googlemail.com on 29 Sep 2011 at 1:52

Attachments:

GoogleCodeExporter commented 9 years ago
I have added support for Enums but in general when you do have object that 
can't be converted from or to string and are not either entities or components 
then you need to provide your custom PropertyValueConverter implementation - 
you can do that even now without a new release but I will add the support for 
Enums because it seems to be common case

P.S. Hibernete Audit won't use Hibernate CustomType because those are how to 
map non entity/component to one or multiple columns and in Hibernate audit we 
do know that we should map that to only one String column

the fix will be in 1.0.33 release

Original comment by kchobant...@gmail.com on 29 Sep 2011 at 5:28