Skip to content
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

Fixing enum array mapping issues #62

Closed
wants to merge 3 commits into from
Closed

Conversation

mochalov
Copy link

@mochalov mochalov commented Apr 6, 2015

Fixed exception:

Argument is not an array
java.lang.IllegalArgumentException: Argument is not an array
    at net.kaleidos.hibernate.usertype.ArrayType.nullSafeGet(ArrayType.java:109)
    at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:127)

Fixed enum to integer mapping issue: ArrayType.nullSafeGet expected getId() method on enum, but ArrayType.nullSafeSet used ordinal() result while saving

Caused by: java.lang.NoSuchMethodException: test.criteria.array.Like$Juice.getId()
    at java.lang.Class.getMethod(Class.java:1670)
    at net.kaleidos.hibernate.usertype.BidiEnumMap.<init>(BidiEnumMap.java:32)
    at net.kaleidos.hibernate.usertype.ArrayType.idToEnum(ArrayType.java:154)

Not plugin will try to use a result of getId() method as an identifier or will use ordinal() if such method is missing.

The main reason why fixed issues have not been reproduced when running integration tests is that domain saving and retrieving should be in different sessions. Only in that case Hibernate will invoke nullSafeGet on the corresponding user type and will not use current session's cache.

@coveralls
Copy link

Coverage Status

Coverage increased (+5.55%) to 79.49% when pulling 22ab89b on mochalov:master into 1b90d71 on kaleidos:master.

@ilopmar
Copy link
Collaborator

ilopmar commented Apr 6, 2015

Thank you very much for the PR. We'll try to review it as soon as possible, merge it and generate a new version.

@coveralls
Copy link

Coverage Status

Coverage increased (+5.55%) to 79.49% when pulling eadb957 on mochalov:master into 1b90d71 on kaleidos:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+5.55%) to 79.49% when pulling eadb957 on mochalov:master into 1b90d71 on kaleidos:master.

ilopmar added a commit that referenced this pull request Jun 2, 2015
@ilopmar
Copy link
Collaborator

ilopmar commented Jun 2, 2015

Merged!

Thank you very much :-)

@ilopmar ilopmar closed this Jun 2, 2015
@ilopmar
Copy link
Collaborator

ilopmar commented Jun 2, 2015

Included in version 4.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants