-
Notifications
You must be signed in to change notification settings - Fork 62
The Enumerated Powers #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This behaves like the IntegerArrayType except that it serializes to/fro Enum values on save/load. See class comments for more info
Seems like this function gets called when we're using a CriteriaQuery. However, in that case, we've already done the converting to Integer prior to that query, so these should already be in ordinal form
|
Hi, Thank you very much for your contribution, I really appreciate it. Before we can merge your pull request you have to create some integration tests. Please check out this tests https://github.com/kaleidos/grails-postgresql-extensions/tree/master/test/integration/net/kaleidos/hibernate/array and create similar ones for your new functionality. Regards, Iván. |
…Type This function will transform either the Object or the List of Objects into some other value
We have to create another array so we guarantee there are no mixed types.
We switched to putting them in a new array, but we were only loading the new array when it wasn't already an integer. it'll already be an integer when it's used via the criteria operators
|
@lmivan I have added tests. Let me know if they're up to snuff. |
Not sure if this'll gain us much, but it's probably best to cache as best as possible at the db level.
|
Wooow, that was fast :-) Can you send me your twitter user (if you have one)? I want to include it in the docs and in the tweet when I publish the new version. Thank you again for your contribution. Regards, Iván. |
|
awesome! i'm @soundandfeury on twitter. |
Add support for an
IdentityEnumArrayTypethat behaves very similar to the IntegerArray, except that it serializes and deserializes Enums to their ordinal integer value when saving/fetching from the DB.I'm not too familiar with Hibernate or this code, so there are definitely some parts that are kind've pieced together. Ideally this would work with Strings in addition to the ordinal value, as well, but that's not included here. Let me know what you think. Happy to modify anything :)