Thanks for the DB and JCC info. I remembered there being some issue with
getGeneratedKeys on a JCC driver level, but that was quite a while ago.
Your driver and DB level are current, so I quickly set aside that
possibility.
Using a trimmed down version of your code, I found that there is a bug in
OpenJPA's batching update constraint manager (the piece of code that drives
batched updates through the JDBC driver). The batching manager currently
does not retrieve non-key identity fields on an insert/update operation.
Until a fix is available, you can get around the problem by adding this
property to your persistence.xml:
<property name="openjpa.jdbc.UpdateManager" value="constraint"/>
This property enables the non-batching constraint update manager, which has
the proper code to retrieve the generated field.
Please file a JIRA for this issue[1] and we'll work on providing a fix. Or
let me know and I'd be happy to file one for you.
-Jeremy
[1] http://issues.apache.org/jira/browse/OPENJPA
On Tue, Jan 25, 2011 at 2:55 PM, robsinner <[email protected]> wrote:
>
> DB2 (from Control Center Help About)
> Product Identifier SQL09072
> Level Identifier 08030107
> Level DB2 v9.7.200.358
> Build Level s100514
> PTF IP23084
>
> JCC Driver is db2jcc4-9.7.100.177.jar, db2jcc_license_cu-9.7.100.177.jar
>
> Thank you for your help,
>
> R
> S
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/How-to-get-generated-keys-without-requerying-the-database-tp5957346p5960445.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>