From open-jpa-dev-return-1505-apmail-incubator-open-jpa-dev-archive=incubator.apache.org@incubator.apache.org Tue Jan 02 22:33:35 2007 Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 94280 invoked from network); 2 Jan 2007 22:33:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jan 2007 22:33:34 -0000 Received: (qmail 40924 invoked by uid 500); 2 Jan 2007 22:33:40 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 40901 invoked by uid 500); 2 Jan 2007 22:33:40 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 40888 invoked by uid 99); 2 Jan 2007 22:33:40 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jan 2007 14:33:40 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lists@nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] (HELO talk.nabble.com) (72.21.53.35) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jan 2007 14:33:30 -0800 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1H1sBy-00037Z-0J for open-jpa-dev@incubator.apache.org; Tue, 02 Jan 2007 14:33:10 -0800 Message-ID: <8132118.post@talk.nabble.com> Date: Tue, 2 Jan 2007 14:33:09 -0800 (PST) From: Shay Banon To: open-jpa-dev@incubator.apache.org Subject: RE: Perform automatic drop and create db schema In-Reply-To: <7D856CDFE035FF45A0420ACBD71BDD6302BAA8EB@repbex02.amer.bea.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: kimchy@gmail.com References: <8130220.post@talk.nabble.com> <6B556C6A-48CC-4BEA-9514-3ABD1F655C93@apache.org> <1545FDED-9B00-4912-A398-8FF7CA5FC029@SUN.com> <7D856CDFE035FF45A0420ACBD71BDD6302BAA8EB@repbex02.amer.bea.com> X-Virus-Checked: Checked by ClamAV on apache.org Automatically clean that data without dropping the tables makes even more sense. That would be a really cool feature. Patrick Linskey wrote: > > IMO, a more valuable option would be a way to delete all records in all > mapped tables, rather than doing unnecessary schema interrogation. > > Additionally, note that with JPA, deleting all records during setUp() is > as easy as 'em.createQuery("delete from Employee").executeUpdate();' > > -Patrick > > -- > Patrick Linskey > BEA Systems, Inc. > > _______________________________________________________________________ > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated > entities, that may be confidential, proprietary, copyrighted and/or > legally privileged, and is intended solely for the use of the individual > or entity named in this message. If you are not the intended recipient, > and have received this message in error, please immediately return this > by email and then delete it. > >> -----Original Message----- >> From: robert burrell donkin [mailto:robertburrelldonkin@gmail.com] >> Sent: Tuesday, January 02, 2007 1:39 PM >> To: open-jpa-dev@incubator.apache.org >> Subject: Re: Perform automatic drop and create db schema >> >> On 1/2/07, Craig L Russell wrote: >> > For What It's Worth: >> > >> > +1 on the drop-tables feature for OpenJPA. But I would caution >> > against using it on each test. >> > >> > Sadly, my experience is that drop-create-tables is 99.9% of the time >> > taken in a typical test. >> > >> > The JDO TCK runs hundreds of tests and we drop-create tables only on >> > demand. The drop-create step takes several minutes compared to a few >> > seconds to actually run the tests. >> >> yeh - dropping then recreating isn't very efficient but is effective >> >> i've found that it's hard to educate developers unfamiliar with >> automated testing. creating good integration tests is important but >> takes a long while. too often neglected due to time pressure. i >> suspect that tool developers could do more to help. >> >> for example, IMHO containers should ship with integrated code coverage >> tools. there are good enough open source ones but since they are not >> bundled with containers they are not used as widely as they should be >> in commercial development work. >> >> > After several years of doing this kind of work, I've concluded that >> > the best practical strategy (we tried beating up the >> database vendors >> > to make drop-create as fast as insert/delete rows, to no >> avail) is to >> > write your tests such that at the beginning of the test, you create >> > your test data and at the end of the test, you delete the test data, >> > leaving the database in an empty state. >> >> +1 >> >> but this is where a side door would be of most use. sophisticated >> object relational layers generally make it relatively slow and >> unnatural to just delete everything in a table. which is as it should >> be. it'd just be cool to able if the tool developers also created >> testing only side doors. >> >> i have an idea that this is all reasonably easily doable but isn't >> well known or packaged up into tools which are easy to learn. >> >> it would be very cool to be able to start a recording tool in setup to >> intercept and record every create, update, delete in the data access >> layer then in tearDown just ask the data access layer to undo >> everything that was done. >> >> it would also be very cool to have a complete dump and replace >> facility for black-box-in-container functional testing. in setup, just >> push a load of data as xml. the data access layer deletes data from >> all the tables specified and inserts the given data. >> >> easy, dynamic flushing of all object caches would also be useful. >> >> (sadly, i'm really interested in meta-data ATM, both email and source >> auditing so there's not much chance of hacking together something >> which demonstrates what i mean any time soon...) >> >> - robert >> > > -- View this message in context: http://www.nabble.com/Perform-automatic-drop-and-create-db-schema-tf2909915.html#a8132118 Sent from the open-jpa-dev mailing list archive at Nabble.com.