openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Bayer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1760) Should deleteTableContents always delete really ALL content?
Date Mon, 16 Aug 2010 21:58:16 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-1760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12899118#action_12899118
] 

Oliver Bayer commented on OPENJPA-1760:
---------------------------------------

Hi Rick,

once again sorry for not replying for a while. 

I've tried to write a test webapp so you can reproduce the error but I couldn't reproduce
it on my own :-). Today I found the error. First I used SchemaAction='add,delete....' but
for a while I changed to SchemaAction='refresh,delete....'. 

So I made a stupid error while creating this ticket in naming the wrong config parameter.
Sorry for all the confusion.

You're right: If I use SchemaAction='add,delete....' all is working correctly.
BUT if I use SchemaAction='refresh,delete...' openjpa is deleting all contents of ALL tables
in the database.

After comparing both functions (add, refresh) in source code I maybe found the bug.

SchemaTool - void refresh():
Line 378: 
SchemaGroup db = getDBSchemaGroup(true);
should be: 
SchemaGroup db = getDBSchemaGroup(FALSE);

The add function uses FALSE as parameter too. If I set a breakpoint and change it manually
to false openjpa is only deleting content of tables which are defined in persistence.xml so
it should work.

I hope you're now able to reproduce the bug and use my suggested bugfix if it doesn't have
any sideeffects which I can't overlook. Can you please check it?

Greets Oli

> Should deleteTableContents always delete really ALL content?
> ------------------------------------------------------------
>
>                 Key: OPENJPA-1760
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1760
>             Project: OpenJPA
>          Issue Type: Question
>    Affects Versions: 2.0.0
>         Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0 
>            Reporter: Oliver Bayer
>
> At my usecase not all tables are managed by openjpa so not all of them are listed with
the class-tag inside persistence.xml. I set up openjpa to delete the table contents for developping
with the following property:
> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='add,deleteTableContents')"/>
> But now all contents are deleted even the one of tables which aren't listed inside persistence.xml.

> Shouldn't openjpa only delete contents from tables which are configured plus the openjpa_sequence_table
rather than deleting all contents from the whole database? Is this a bug or is there a property
which I have to set to get the described behaviour?
> Greets Oli

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


Mime
View raw message