I do not believe that workaround will work for me. Let me explain why.
I am working on the HyperJAXB3 project which generates my annotated
pojos from xsd. My test case for HyperJAXB3 involves XML documents that
conform to a schema that requires id attribute of a XML complexType to
be a valid URN (e.g. urn:uuid:xxx ). The value for id attribute is in an
XML document and not in a pojo. HyperJAXB3 implementation needs some way
to configure HyperJAXB3 binding customization such that a underlying
persistence provider can be told to use the id attribute provided by the
XML document as primary key when persisting the XMl document.
Perhaps Aleksei may be able to describe the situation better?
Thanks very much for all your help.
Doug Clarke wrote:
> 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
>
>
--
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com