Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 14219 invoked from network); 7 Jan 2009 14:05:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2009 14:05:23 -0000 Received: (qmail 18526 invoked by uid 500); 7 Jan 2009 14:05:22 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 18512 invoked by uid 500); 7 Jan 2009 14:05:22 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 18501 invoked by uid 99); 7 Jan 2009 14:05:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2009 06:05:22 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chadksmith1@gmail.com designates 209.85.146.178 as permitted sender) Received: from [209.85.146.178] (HELO wa-out-1112.google.com) (209.85.146.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2009 14:05:12 +0000 Received: by wa-out-1112.google.com with SMTP id k22so4526994waf.20 for ; Wed, 07 Jan 2009 06:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:message-id :in-reply-to:subject:mime-version:content-type :content-transfer-encoding; bh=oIrE6iClDGLscUrAMorr84NQmC07SHWELY8jTNQuXtE=; b=HCGCSYZ8MuzdC+qrD2iVO6j3ARr4LyaUvlsCGdyoYz9ngkrY/VZ5iZgf/GOBBYE+t1 3kO9yP1ZfU4e6oXGW958BRkyERfkKMz+UnvioPLelCm6N9/IxUT5HEfcR18vjL3vC7fF waRd/uiQzicbwUj6F83LvBdD/gQGDob6qqIoQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:message-id:in-reply-to:subject:mime-version :content-type:content-transfer-encoding; b=tlXkjiEC2rZE+0hdRGDzu7/gFM4L7LS8UUcaqP+/mnADqf5CwCM8e/eVSaqrPfnL3/ Y2Fja37s3L5X5DuhilyWN2SrHJVaz3PsyqQLHwAutNN8CFKeGJHUeGbfTmRTaMlDFEZw 6rnizXDC7FBS/fkOcDvIiRw81383GlsPwE7Mg= Received: by 10.115.91.2 with SMTP id t2mr15251776wal.224.1231337091688; Wed, 07 Jan 2009 06:04:51 -0800 (PST) Received: from localhost ([168.178.77.29]) by mx.google.com with ESMTPS id z20sm37191890pod.26.2009.01.07.06.04.51 (version=SSLv3 cipher=RC4-MD5); Wed, 07 Jan 2009 06:04:51 -0800 (PST) Date: Wed, 7 Jan 2009 07:04:52 -0700 (MST) From: Chad Smith To: user@cayenne.apache.org Message-ID: <21291181.211231337090390.JavaMail.SYSTEM@cks-desktop> In-Reply-To: <27383243.191231336871359.JavaMail.SYSTEM@cks-desktop> Subject: A little help w/ session state please MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I have a web app that uses Cayenne 2.0.4 w/ Spring and it uses a servlet filter to manage the data context ... Request init code -------------------------------- HttpSession session = ((HttpServletRequest)servletRequest).getSession(true); DataContext dataContext = ServletUtil.getSessionContext(session); DataContext.bindThreadDataContext(dataContext); Request destroy code -------------------------------- DataContext dataContext = DataContext.getThreadDataContext(); if (dataContext.hasChanges()) { dataContext.rollbackChanges(); } DataContext.bindThreadDataContext(null); ... I also have a parent table and child table in which the child table has a circular reference to itself parent table: Forum forum.forum_id child table: forum_thread forum_thread.forum_id forum_thread.thread_id forum_thread.parent_thread_id (the circular reference) ... here is the cayenne mapping xml for the relationships ... ... here is the code I'm using to delete a thread ... public boolean deleteThread(int threadId) throws DataAccessException { // NOTE: transactions are auto commit unless otherwise specified! Thread thread = loadThread(threadId); // remove any parent association if (thread.getSubThreadToThread() != null) { Thread parentThread = thread.getSubThreadToThread(); parentThread.removeFromThreadToSubThread(thread); } // remove forum association Forum forum = thread.getThreadToForum(); forum.removeFromForumToThread(thread); super.delete(thread); return true; } ... so here is the problem: I setup the following data Forum record which has 3 top level thread records. Lets say thread 2 has several children and several grand children. When I delete one of thread 2's children it does the database deletes perfectly (cascade deletes of the correct grandchildren), however, the gui continues to show the grand children but the child record (that was deleted) is gone. Here is the SQL and the data context looks clean before and after processing .... CayenneDao >>> --------------- Cayenne Context: 2009-01-07 06:49:40 ---------------- - hasChanges = false | isTransactionEventsEnabled = false | isUsingSharedSnapshotCache = true | isValidatingObjectsOnCommit = true 2009-01-07 06:49:40,953 INFO (QueryLogger.java:423) - --- will run 1 query. 2009-01-07 06:49:40,953 INFO (QueryLogger.java:377) - --- transaction started. 2009-01-07 06:49:40,953 INFO (QueryLogger.java:300) - DELETE FROM gtools.forum_thread WHERE thread_id = ? 2009-01-07 06:49:40,953 INFO (QueryLogger.java:322) - [bind: 228] 2009-01-07 06:49:40,968 INFO (QueryLogger.java:368) - === updated 1 row. 2009-01-07 06:49:40,968 INFO (QueryLogger.java:322) - [bind: 227] 2009-01-07 06:49:40,968 INFO (QueryLogger.java:368) - === updated 1 row. 2009-01-07 06:49:40,968 INFO (QueryLogger.java:322) - [bind: 226] 2009-01-07 06:49:40,968 INFO (QueryLogger.java:368) - === updated 1 row. 2009-01-07 06:49:41,015 INFO (QueryLogger.java:384) - +++ transaction committed. CayenneDao >>> --------------- Cayenne Context: 2009-01-07 06:49:41 ---------------- - hasChanges = false | isTransactionEventsEnabled = false | isUsingSharedSnapshotCache = true | isValidatingObjectsOnCommit = true ... no matter where I go w/in the application the data (grand children) seems to stick in the cache but if I log off and back on they are now gone (no longer in the object cache). What am I doing wrong here? I know that is a lot to wade through but I would greatly appreciate any help on diagnosing the problem. Thanks in advance. Chad