openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Bayer (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist
Date Tue, 20 Jul 2010 19:19:49 GMT


Oliver Bayer commented on OPENJPA-1698:


thanks a lot for your help!!! Changing the property as you said resolves the error.

One Note:
If someone changes the order of the schema actions into 'deleteTableContents,add' the error
appears again. I know that the order of the schema actions is important but to be more flexible
it would be great if you can add a check for "deleteTableContents" and put it at the end of
the list of the methods to call.

Not sure where I found this
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction=add,SchemaAction=deleteTableContents)"/>
syntax while digging into openjpa. But it shouldn't be allowed if it doesn't work or you should
put "deleteTableContents" statement always at last.


> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>                 Key: OPENJPA-1698
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.0.0
>         Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0
>            Reporter: Oliver Bayer
> Hi,
> I want to set up my project during development so that all table contents are deleted
with the following property in persistence.xml:
> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction=add,SchemaAction=deleteTableContents)"/>
> If I start up with an empty database I get the following error:
> org.apache.openjpa.persistence.PersistenceException: ERROR: Relation >>openjpa_sequence_table<<
doesn't exist.
> This error is raised because of the following sql statement: DELETE FROM OPENJPA_SEQUENCE_TABLE.
> My suggested solution would be to modify DBDictionary.getDeleteTableContentsSQL so that
it only deletes content from a table if the table exists.
> DBDictionary: Line 2183
> ---------------------------------
> change: deleteSQL.add("DELETE FROM " + toDBName(tables[i].getFullIdentifier()));
> to: deleteSQL.add("DELETE FROM " + toDBName(tables[i].getFullIdentifier()) + " IF EXISTS");
> What do you mean: Is this a valid bugfix? I'm looking forward to your responses.
> Greets Oli

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message