From dev-return-17538-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Thu Oct 07 15:23:54 2010 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 44242 invoked from network); 7 Oct 2010 15:23:53 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Oct 2010 15:23:53 -0000 Received: (qmail 75156 invoked by uid 500); 7 Oct 2010 15:23:53 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 75109 invoked by uid 500); 7 Oct 2010 15:23:53 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 75101 invoked by uid 99); 7 Oct 2010 15:23:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 15:23:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Oct 2010 15:23:52 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o97FNVbF000837 for ; Thu, 7 Oct 2010 15:23:31 GMT Message-ID: <32538151.26381286465011215.JavaMail.jira@thor> Date: Thu, 7 Oct 2010 11:23:31 -0400 (EDT) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1760) SchemaAction='refresh,deleteTableContents' incorrectly removes data from ALL DB tables. In-Reply-To: <6367158.165741280952915724.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12918944#action_12918944 ] Rick Curtis commented on OPENJPA-1760: -------------------------------------- Oli - I finally got around to reviewing the suggested code change and I don't think this is the correct direction to go. Yes the change does make the reported problem go away, but there is another big problem that wasn't mentioned. Per the docs for SchemaTool docs: * refresh: Equivalent to retain, then add. * retain: Keep all schema components in the given XML definition, but drop the rest from the database. This action never adds any schema components. * add: This is the default action if you do not specify one. It brings the schema up-to-date with the given XML document by adding tables, columns, indexes, etc. This action never drops any schema components. My interpretation of the docs says that retain should drop ALL tables that aren't known to OpenJPA. That isn't happening. The second problem, and in line with the one you reported is that the 'deleteTableContents' action is defined to only run against OpenJPA known tables. This is a problem with the SchemaTool.getDBSchemaGroup(boolean) method and it caches the value returned even though it is dependent on the value of the provided boolean. This appears to be a large problem that isn't as simple as flipping a single bit. This same problem exists if you were to execute 'add,deleteTableContents', 'createDB,deleteTableContents', etc.... Unfortunately I don't see this being a high enough priority issue to spend any more cycles on. Thanks for the patch and feel free to continue to dig into this issue if you want. Thanks, Rick > SchemaAction='refresh,deleteTableContents' incorrectly removes data from ALL DB tables. > --------------------------------------------------------------------------------------- > > Key: OPENJPA-1760 > URL: https://issues.apache.org/jira/browse/OPENJPA-1760 > Project: OpenJPA > Issue Type: Bug > Components: tooling > Affects Versions: 2.0.0, 2.1.0 > Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0 > Reporter: Oliver Bayer > Assignee: Rick Curtis > Priority: Minor > Fix For: 2.1.0 > > Attachments: OPENJPA-1760_testcase.patch > > > 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: > > 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.