openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ubiteck <>
Subject Re: Verified database matrix (was: PostgreSQL 9.1 [Error :current transaction is aborted])
Date Thu, 08 Nov 2012 09:56:09 GMT
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 :  
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:
Sent from the OpenJPA Users mailing list archive at
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message