Skip to content

Conversation

@mattfeury
Copy link
Contributor

Add support for an IdentityEnumArrayType that 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 :)

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
@ilopmar
Copy link
Collaborator

ilopmar commented Aug 24, 2013

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.

@mattfeury
Copy link
Contributor Author

@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.
@ilopmar
Copy link
Collaborator

ilopmar commented Aug 25, 2013

Wooow, that was fast :-)
I have to review the changes in my laptop (I'm on the tablet now) but they are good. I hope I can merge your pull request tonight and release a new version of the plugin.

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.

@ghost ghost assigned ilopmar Aug 25, 2013
@mattfeury
Copy link
Contributor Author

awesome! i'm @soundandfeury on twitter.
thanks for this. it's really gonna help my project

@ilopmar ilopmar merged commit 41df11d into gpc:master Aug 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants