openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Sequence Generator on a non ID field
Date Wed, 23 Feb 2011 15:17:54 GMT
Hi David,

Could you post the stack for the exception you're getting?

GeneratedValues should be obtained by your non-jta-data-source (or
openjpa.ConnectionFactory2) - and that shouldn't require a transaction.

-mike

On Wed, Feb 23, 2011 at 8:30 AM, David Beer <david.m.beer@googlemail.com>wrote:

> Hi all
>
> I am trying to get a value for a field set when commited to the db, to
> be auto generated. This field is not an ID for the table. I seem to get
> the error message "InvalidStateException: Can only perform operation
> while a transaction is active."
>
> My class looks like the following:
>
> @GeneratedValue(strategy = GenerationType.TABLE, generator = "UserGen")
> @TableGenerator(name = "UserGen", table = "USER_GEN", pkColumnName =
> "PK", valueColumnName = "USERID")
> private Long userID;
>
> Any Thoughts.
>
> Thanks
>
> David
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message