Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 82409 invoked from network); 12 Jul 2007 22:30:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jul 2007 22:30:59 -0000 Received: (qmail 68951 invoked by uid 500); 12 Jul 2007 22:31:01 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 68936 invoked by uid 500); 12 Jul 2007 22:31:00 -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 68924 invoked by uid 99); 12 Jul 2007 22:31:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 15:31:00 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [202.22.233.6] (HELO mail.mls.nc) (202.22.233.6) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jul 2007 15:30:56 -0700 Received: from [203.80.48.91] (helo=nwrk2.dyndns.org) by mail.mls.nc with esmtp (Exim 4.60) (envelope-from ) id 1I97B6-00078M-Ty for user@cayenne.apache.org; Fri, 13 Jul 2007 09:30:29 +1100 Received: by nwrk2.dyndns.org (Postfix, from userid 1000) id 20D9C10B7A7; Fri, 13 Jul 2007 09:30:26 +1100 (NCT) Subject: Modifying projects in Java From: =?ISO-8859-1?Q?Mika=EBl?= Cluseau Reply-To: =?ISO-8859-1?Q?Mika=EBl?= Cluseau To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Organization: ISI.NC Date: Fri, 13 Jul 2007 09:30:25 +1100 Message-Id: <1184279425.12698.19.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 X-Virus-Checked: Checked by ClamAV on apache.org Dear list, I'm trying to modify projects in Java code (mainly to migrate old schemas automatically) and I can't save project with DataNodes. Here is the simplest expression of my need : File projectFile =3D new File("src/cayenne.xml"); ApplicationProject project =3D new ApplicationProject(projectFile); ProjectConfiguration config =3D (ProjectConfiguration) project.getConfigura= tion(); project.save(); It works well as long as the projet doesn't have any DataNode. Here is the relevant part of the stack trace: Caused by: java.lang.ClassCastException: org.apache.cayenne.access.DataNode= $TransactionDataSource cannot be cast to org.apache.cayenne.project.Project= DataSource at org.apache.cayenne.project.DataNodeFile.save(DataNodeFile.java:64) I don't get how the modeler manages to get it working (it looks pretty straightforward so I must be missing something). I'm currently working by removing DataNodes from the project and adding them back, so it is not very... fun. Can someone please point me at least ways to solve the issue ? I had it "working" by setting every node's DataSourceFactory to ProjectDataSourceFactory *but* it destroys their data... Thanks ! -- Mika=EBl Cluseau