[hibernate-dev] Hibernate O/RM Java 8 API.
Steve Ebersole
steve at hibernate.org
Tue May 19 16:52:17 EDT 2015
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