openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Dante Ursini (JIRA) <j...@apache.org>
Subject [jira] [Updated] (OPENJPA-2297) Unable to determine which sequences are owned by the database (Postgresl dictionnary)
Date Fri, 09 Nov 2012 10:38:12 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-2297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sébastien Dante Ursini updated OPENJPA-2297:
--------------------------------------------

    Description: 
Error : 
Unable to determine which sequences are owned by the database. OpenJPA will consider all sequences
suffixed with "_seq" as database managed.  
This may result in im proper creation or removal of sequences with this suffix. The original
PostgreSQL driver exception is being logged for your reference.
...
SELECT pg_get_serial_sequence(?, ?)
...

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 :

<b>
SELECT pg_get_serial_sequence(?, ?) 
</b>

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.


  was:
Error : 
Unable to determine which sequences are owned by the database. OpenJPA will consider all sequences
suffixed with "_seq" as database managed.  
This may result in im proper creation or removal of sequences with this suffix. The original
PostgreSQL driver exception is being logged for your reference.
...
SELECT pg_get_serial_sequence(?, ?)
...

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.


    
> Unable to determine which sequences are owned by the database (Postgresl dictionnary)
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-2297
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2297
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.1.1
>         Environment: OS : Windows Application : Apache Geronimo 3.0 Data
>            Reporter: Sébastien Dante Ursini
>
> Error : 
> Unable to determine which sequences are owned by the database. OpenJPA will consider
all sequences suffixed with "_seq" as database managed.  
> This may result in im proper creation or removal of sequences with this suffix. The original
PostgreSQL driver exception is being logged for your reference.
> ...
> SELECT pg_get_serial_sequence(?, ?)
> ...
> 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 :
> <b>
> SELECT pg_get_serial_sequence(?, ?) 
> </b>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message