[hibernate-dev] Making it pluggable how GenerationType.AUTO is mapped

Steve Ebersole steve at hibernate.org
Mon Dec 1 12:25:25 EST 2014


Maybe.  I'll have to look a little closer.  Is this something you are
looking at for use with ORM 5.0?

On Fri, Nov 28, 2014 at 5:08 AM, Gunnar Morling <gunnar at hibernate.org>
wrote:

> Hi Steve, all,
>
> For OGM it would be beneficial if there was an extension point in ORM which
> allows us to customize how GenerationType.AUTO is mapped. AFAICS, that's
> currently semi-hard coded in ORM. Depending on whether
> "new_generator_mappings" is set, either SEQUENCE (true) or "native" (false)
> will be used.
>
> Now for the MongoDB grid dialect we'd ideally do the following: If the id
> of an entity is declared as
>
>      org.bson.typesObjectId
>
> or
>
>      @Type(type = "objectid") String
>
> then map AUTO to IDENTITY (ObjectId is a MongoDB-specific type which
> resembles an identity column). Otherwise map it to TABLE (or SEQUENCE,
> which transparently falls back to TABLE).
>
> I.e. this decision would not be a global one, but depend on the specific id
> type.
>
> Would this be feasible to do? or is it mandated by JPA somehow that AUTO is
> always mapped in the same way? I cannot judge on the amount of changes
> required in ORM as atm. AUTO always is mapped in the same way, it doesn't
> depend on the specific entity and its id type.
>
> Any thoughts?
>
> Thanks,
>
> --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