cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikaël Cluseau <mik...@isinc.dyndns.org>
Subject Modifying projects in Java
Date Thu, 12 Jul 2007 22:30:25 GMT
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 = new File("src/cayenne.xml");
ApplicationProject project = new ApplicationProject(projectFile);
ProjectConfiguration config = (ProjectConfiguration) project.getConfiguration();
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.ProjectDataSource
	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ël Cluseau

Mime
View raw message