[hibernate-dev] Hibernate O/RM Java 8 API.

Jakub Narloch jmnarloch at gmail.com
Wed Jun 17 11:37:13 EDT 2015


Hi Steve,

Sorry for disapearing for a bit, but I would like to get back to this
thread.
I guess there might be some miscommunication from my side about what I
would like to introduce into my extension and what I would like to
contribute to Hibernate ORM directly.

So to sum up I've continued working on my little project:
https://github.com/jmnarloch/hstreams - and made the first public release.
So if anyone wish to use Hibernate with Java 8 he is free to go.
I've basically added everything that we had talk about: that is Optional
query results, operating on Streams of query results, typed queries.
I had noticed that Hibernate 5 will additionally add support for JDK 8
dates API, so I'm planning to reuse that.

What more the extension can be already used with Hibernate 4.3.x and unless
you decide to move to Java 8 I can release another version that will be
compatible with Hibernate 5 .

Now I'm aware that this would be short living sub project till the moment
the Hibernate will migrate to Java 8, but untill that I can work on it.
Also If you decide to migrate finally to latest Java version, I would be
happy to prepare some pull requests based on the ideas I had already
implemented in this side project.

Regards,
Jakub Narlohc

2015-05-19 22:52 GMT+02:00 Steve Ebersole <steve at hibernate.org>:

> On Tue, May 19, 2015 at 12:51 PM, Jakub Narloch <jmnarloch at gmail.com>
> wrote:
>
>>
>>
>> 2015-05-19 18:16 GMT+02:00 Steve Ebersole <steve at hibernate.org>:
>>>
>>> > - Enable registration of LocaleDate, LocalTime as query params.
>>>
>>> You can do that now:
>>> * org.hibernate.Query#setParameter(java.lang.String, java.lang.Object)
>>> * org.hibernate.Query#setParameter(java.lang.String, java.lang.Object,
>>> org.hibernate.type.Type)
>>>
>>> I assume you mean adding method signatures accepting those specific
>>> types?
>>>
>> Yes, I meant a convinient methods similar to those setDate and setTime,
>> something like setLocalDate, setLocalTime
>>
>
> But that would in fact introduce a Java 8 dependency on hibernate-core if
> we did this directly.  We could maybe use some form of "unwrap" notion
> where hibernate-java8 could auto-register some delegate for "additional
> param setting".  We could use the same concept in relation to
> hibernate-spatial as well for setting geolatte specific parameters.
>
>
>>
>>> >
>>> > - Custom type handlers for LocalDate, LocalTime
>>> >
>>> > - Custom type handlers for Optional<?>
>>>
>> Sorry for ambiguity. I was refering to "custom user types" from the
>> reference, this is at least my understanding how Hibernate maps the Object
>> to SQL in general.
>> To sum up what I would like to be able to do "mapping" of an entity as
>> fallows:
>>
>> class Employee {
>>
>>   Optional<Employee> manager;
>>
>>   LocalDate createDate;
>>   LocalDate updateDate;
>> }
>>
>
> As far as the Java 8 date/time stuff... see the hibernate-java8 module...
> that is its whole goal...  Optional support has a little more to it, some
> of which is alluded to in this discussion
>
>
>
>>
>> So some extra org.hibernate.type.Type definitions will be needed similar
>> to those that you had defined in hibernate-java8.
>>
>
> Um, why would we need extra*s*?  We need one... for Optional.
>


More information about the hibernate-dev mailing list