Re: Modifying projects in Java

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sat Jul 14 2007 - 15:13:51 EDT

  • Next message: Andrus Adamchik: "Re: problems with Oracle stored procedure"

    On Jul 13, 2007, at 1:30 AM, Mikaël Cluseau wrote:

    > 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).

    To work around a bad decision made a long time ago to use Cayenne
    runtime objects (DataDomain, DataNode) as CayenneModeler model beans,
    modeler often uses inner subclasses to suppress various runtime
    behavior aspects. Here is how i handles the problem above:

    class ModelerProjectLoadDelegate extends RuntimeLoadDelegate {
    ....
      protected DataNode createDataNode(String nodeName) {
             return new DataNode(nodeName) {

                 public DataSource getDataSource() {
                     return dataSource;
                 }
             };
         }
    ...
    }

    Andrus



    This archive was generated by hypermail 2.0.0 : Sat Jul 14 2007 - 15:14:20 EDT