You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Oliver Bayer (JIRA)" <ji...@apache.org> on 2010/06/12 18:40:13 UTC

[jira] Created: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

SchemaAction=deleteTableContents throws error if table doesn't exist
--------------------------------------------------------------------

                 Key: OPENJPA-1698
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
             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.


[jira] Updated: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-1698:
---------------------------------

       Priority: Minor  (was: Major)
    Component/s: tooling
                     (was: jdbc)

Updated component  and lowered the priority as there is a workaround for this issue.

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 2.0.0
>         Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0
>            Reporter: Oliver Bayer
>            Priority: Minor
>
> 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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12896643#action_12896643 ] 

Rick Curtis commented on OPENJPA-1698:
--------------------------------------

Oli -

Yes this is a bug... but since there is a work around it isn't a very high priority one. I think this would be a great start for someone in the OpenJPA community to dig into the code a little bit.... :-)

Also, I'll take a look at OPENJPA-1760 shortly here.

Thanks,
Rick

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 2.0.0
>         Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0
>            Reporter: Oliver Bayer
>            Priority: Minor
>
> 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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890053#action_12890053 ] 

Rick Curtis commented on OPENJPA-1698:
--------------------------------------

@Oli -

Try changing your property to : <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,deleteTableContents')"/> . 

I don't have time this afternoon to see what the difference is, but it makes my unit test work. This is how the OpenJPA unit tests clean up the db. Let me know if this works for you.

Thanks,
Rick

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888571#action_12888571 ] 

Rick Curtis commented on OPENJPA-1698:
--------------------------------------

I was looked at the postgres docs[1] and it appears that "IF EXISTS" isn't valid for the "DELETE" command.  I don't have postgres setup for unit tests yet so I haven't been able to play with this too much yet. Can you post the entire stack trace for the exception that you're hitting?

[1] http://www.postgresql.org/docs/current/static/sql-delete.html

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Oliver Bayer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888899#action_12888899 ] 

Oliver Bayer commented on OPENJPA-1698:
---------------------------------------

Hi Rick,

thanks for answering. You're right about the not working "IF EXISTS" in postgres. I didn't thought about it when I posted my suggested bugfix.
Here is the error log (I hope I removed all jsf follow-up errors from my jsf test app):

<openjpa-2.0.0-r422266:935683 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: ERROR: Relation »openjpa_sequence_table« doesn't exist
  Position: 13 {stmnt 8577594 DELETE FROM OPENJPA_SEQUENCE_TABLE} [code=0, state=42P01]
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:556)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:456)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:155)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159)
	at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:117)
	at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:199)
	at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:213)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:151)
	at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:57)
... 27 more

at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:241)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:70)
	at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:951)
	at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:136)
	at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1200)
	at org.apache.openjpa.jdbc.schema.SchemaTool.deleteTableContents(SchemaTool.java:431)
	at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:339)
	at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:504)
	... 45 more

The error message "ERROR: Relation »openjpa_sequence_table« doesn't exist" comes directly from postgres. I get the same one if I try to execute the delete statement (shown above) inside the postgres sql editor.

HTH Oli

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889742#action_12889742 ] 

Rick Curtis commented on OPENJPA-1698:
--------------------------------------

@Oli -

Since that isn't going to pan out, any other suggestions?

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Oliver Bayer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890017#action_12890017 ] 

Oliver Bayer commented on OPENJPA-1698:
---------------------------------------

Hi Rick,

for me it seems that this is an overall issue not just a postgres one.

I tried to execute the delete statement (DELETE FROM OPENJPA_SEQUENCE_TABLE) on a mysql db and got the same error:
#1146 - Table 'mytestdb.openjpa_sequence_table' doesn't exist

I'm relatively new to openjpa and don't know the the framework in detail so you have to check if one of the following suggestions are implementable :-):

1) Run the SchemaAction=deleteTableContents as the very last statement. This way the OPENJPA_SEQUENCE_TABLE would have been already created by e.g. the SchemaAction=add call and thus the delete statement will work.

2) DBDictionary.getDeleteTableContentsSQL: the tables parameter should only contain tables which exist already e.g. only add tables to the list if "SELECT * FROM xyz LIMIT 1" returns a resultset. If there is a "doesn't exist" error thrown ignore this table and check the next one.

3) During the execution of the delete statement check for "doesn't exist" errors but ignore them. The execution shouldn't stop but move to the next table and try the delete statement.

I hope you can use at least one of them to solve the issue.

Greets Oli

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Oliver Bayer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12890400#action_12890400 ] 

Oliver Bayer commented on OPENJPA-1698:
---------------------------------------

@Rick,

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.

Oli

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.


[jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist

Posted by "Oliver Bayer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12895399#action_12895399 ] 

Oliver Bayer commented on OPENJPA-1698:
---------------------------------------

Hi Rick,

what do you think about my suggestions above? 
Are you going to implement them or are they too strict / specific?

If you find some time can you please look at my related question (OPENJPA-1760)?

Thanks in advance.

Oli

> SchemaAction=deleteTableContents throws error if table doesn't exist
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-1698
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1698
>             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.