Farrukh,
As mentioned this can be done in a constructor. Alternatively you can use @PrePersist callback as well as some of TopLink's internal Sequence configuration.
Do you require the attribute to be held in a UUID attribute on your entity or is a String adequate?
If you wish to hold a UUID attribute you will need to configure TopLink to use a custom converter for the value.
Doug
Farrukh S. Najmi wrote:
> Dear colleagues,
>
> In my application that uses Java Persistence (and does not use EJBs), I
> would like to specify a custom id generator similar to
> org.hibernate.id.UUIDHexGenerator. It is not clear from reading the spec
> how this can be accomplished. Thanks for any pointers you can provide.
>
>
To be clearer....
What I would like to do is to specify a GeneratedValue annotion on an
@id field in my entity class such that
a strategy can be specified that uses a custom id generator class (e.g.
a UUID generator class). What is the
best way to accomplish this? Thanks.
--
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com