[forge-dev] @GeneratedValue Strategy

George Gastaldi gegastaldi at gmail.com
Fri May 4 10:19:24 EDT 2012


> Thinking of scaffold implementations, it might be best if a separate set
> of IDs was generated for each separate entity.

I don´t think I get it. Can you give a practical example ?

Regards,

George Gastaldi

2012/5/4 Ryan Bradley <rbradley at redhat.com>:
> Greetings all,
>
> Currently, the entity plugin annotates the ID primary key with
> @GeneratedValue.  This annotation uses the default generation strategy,
> GenerationType.AUTO, to generate the values for this key.  Using this
> strategy, the same set of values is used for all entity tables.  In
> other words, you cannot have two entities with the same value for ID, as
> it is incremented with each entity creation rather than with each
> creation of an entity of a specific type.
>
> Thinking of scaffold implementations, it might be best if a separate set
> of IDs was generated for each separate entity.  I believe that this can
> be accomplished by annotating the field with
> @GeneratedValue(strategy=GenerationType.IDENTITY).  I was thinking of
> modifying the ScaffoldPlugin to change the GenerationType on this
> annotation in the generateFromEntity method (from-entity command).
>
> Any objections to this change?
>
> Cheers,
> Ryan
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev



More information about the forge-dev mailing list