[hibernate-dev] Adding support for Java 8's Optional to ORM

Steve Ebersole steve at hibernate.org
Tue Jul 29 10:28:23 EDT 2014


Making stuff like this optional in 4.x is difficult though because it needs
to tie into the metamodel resolution.  Today that process is very
closed-off and static.


On Mon, Jul 28, 2014 at 4:54 AM, Gunnar Morling <gunnar at hibernate.org>
wrote:

> 2014-07-28 11:48 GMT+02:00 Sanne Grinovero <sanne at hibernate.org>:
>
> > We'd also love to support some features (especially the new user types
> > such as Date/Time) in Hibernate Search.
> >
>
> Ah, right. I've heard requests about the 310 date/time types as well.
>
> >
> > I don't think we should require Java8 for all users though, so I'd
> > like this to be an independent module.. troublesome with Maven though,
> > so this wasn't done yet.
> >
>
> Yes, it should definitely be optional.
>
> I think it depends on the specific case how easy or hard this will be to
> achieve. If it's something rather isolated such as a specific user type
> it's easy, but in other cases it's more painful (e.g. marking annotation
> types as repeatable cannot really be done in a backwards-compatible manner,
> so it needs effectively two variants of such an annotation).
>
> --Sanne
> >
> > On 28 July 2014 07:36, Gunnar Morling <gunnar at hibernate.org> wrote:
> > > Hi,
> > >
> > > Java 8 introduced a new type Optional which may be used to represent
> > > objects which may be set or not set:
> > >
> > >     private Optional<String> name;
> > >
> > > Hibernate Validator will allow to validate properties of this type in
> the
> > > next release. Now someone brought up the question whether the same is
> > > planned for ORM, so one can use Optional in entity properties.
> > >
> > > Any thoughts?
> > >
> > > Thanks,
> > >
> > > --Gunnar
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list