I would like a lightweight way to have Hibernate automatically convert Ceylon types like {{ceylon.language.String}} and {{ceylon.language.Integer}} to {{java.lang.String}} and {{java.lang.Long}} when the Ceylon type is passed to
- {{EntityManager.find()}} and friends, or to - {{Query.setParameter()}}.
I was thinking that this could be something as simple as an implicit contract to call a {{stringValue()}} or {{longValue()}} method instead of throwing stuff like:
{ { quote} java.lang.IllegalArgumentException: Provided id of the wrong type for class jaxrs.example.entity.Employee. Expected: class java.lang.Long, got class ceylon.language.Integer {quote } }.
But I'm open to other suggestions. What I don't want to have to do is go annotating everything explicitly with JPA's `@Convert`. And I want it to work when I don't have complete control over Hibernate, for example, when Hibernate is instantiated by Spring or by Java EE. |
|