Hi sursini,
Excellent debug work!  I took a look at the code and you are right.  The
buildNames() method is using the underscore as the separator and causing
the issue.  Can you create a JIRA for this issue?  Thank you.

Just curious, what type of runtime environment are you using OpenJPA and
Postgres?  JSE?  App Server?  Which one?  Just a random survey...  :-)
Thanks!

Kevin

On Thu, Nov 8, 2012 at 3:56 AM, ubiteck <surs...@gmail.com> wrote:

> I found the issue. The problem is related to the use of the underscore in
> table name. Let's imagine you have an entity called *SubscriptionEvent
> *with
> an auto generated field called *id* (/GenerationType.IDENTITY/).
> You want OpenJPA to create a table named SUBSCRIPTION_EVENT by using the
> following annotation to please you DBA with is favorite naming convention :
>    @Table(name="SUBSCRIPTION_EVENT")
> The problem occurs when the class PostgresDictionary try to determine
> whether a sequence is owned by the database using the method is
> /isOwnedSequence/. This method use another method called *buildNames* to
> define what is the table name and the column name to provide the parameters
> to the sql statement :
> SELECT pg_get_serial_sequence(?, ?)
> The argument provided to *buildNames* according to the name provided in the
> annotation @Table and the identity field is : "subscription_event_id".
> BuildNames split this string using the underscore as separator interpreting
> this :
> *   Table name : *      subscription
> *  Column name :*       event_id
>
> instead of
> *   Table name :*        subscription_event
> *Column name :* id
> As a workaround you have to remove the underscore in you table or field
> name. But it is in my opinion a bug to rely on the underscore to split the
> table from the column name.
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/PostgreSQL-9-1-Error-current-transaction-is-aborted-tp7580209p7581664.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to