persistence@glassfish.java.net

Re: Changing the id of a managed entity

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Fri, 07 Aug 2009 11:15:08 -0700

You can delete the entity and reinsert with new ID.

Farrukh Najmi wrote:
>
> Hi Craig,
>
> That would be very difficult in my server to do. Any other way I could
> do this via JPA? Thanks for the suggestions.
>
> Craig L Russell wrote:
>> Hi Farrukh,
>>
>> The best way I know of is to "simply" write a JDBC program to make
>> the change without involving JPA in the code. The tricky part is to
>> notify caches. JPA implementations should be able to handle this kind
>> of change transparently to application code.
>>
>
>