[hibernate-dev] Programmatic entity mapping API

Alessio Stalla alessiostalla at gmail.com
Tue Oct 24 06:30:13 EDT 2017


That would be great for framework developers as well.

Il 24 ott 2017 12:01, "Gunnar Morling" <gunnar at hibernate.org> ha scritto:

> Anyone with thoughts on this? To elaborate, here's what I have in mind:
>
>     EntityMapping mapping = session.addEntityMapping();
>     mapping.entity( Person.class )
>         .table( "PERSONS" )
>         .property( "personId" )
>             .id()
>                 .strategy( Strategy.IDENTITY )
>         .property( "phoneNumbers" )
>             .oneToMany()
>                 .mappedBy( "person" )
>         .property( "favouriteColor" )
>             .converter( ColorConverter.class );
>
> I'm curious whether others think that'd be useful or not.
>
> Vlad, perhaps you have any insights from the field?
>
> Cheers,
>
> --Gunnar
>
>
>
>
> 2017-10-13 21:21 GMT+02:00 Gunnar Morling <gunnar at hibernate.org>:
>
> > Hi all,
> >
> > This has crossed my mind for a few times: should we provide a
> programmatic
> > API in Hibernate ORM for mapping entities, as an alternative mapping
> > definition source to annotations and XML? I.e. something similar to the
> > programmatic mapping APIs we have in Hibernate Validator and Search.
> >
> > It'd probably be a fair bit of work (though giving lots of fun with API
> > design), but I can see how it could be appealing to folks preferring
> > API-style ways of configuring their stack, which seems more and more en
> > vogue these days. Using lambda expressions would be attractive especially
> > when it comes to plugging in custom behaviours, e.g. for value
> generators.
> >
> > Any thoughts?
> >
> > --Gunnar
> >
> >
> _______________________________________________
> 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