RE: How do you create a custom DB Adapter?

From: Gentry, Michael (
Date: Fri Nov 19 2004 - 11:33:12 EST

  • Next message: Andrus Adamchik: "RE: How do you create a custom DB Adapter?"

    Well, I didn't have types.xml there, but after I copied it in, it still
    doesn't work.

    I ran the modeler in the debugger and in's
    setAdapterName(), it is throwing a ClassNotFoundException, which seems
    to be out of the loadClass(name) call. It doesn't make it to the next

    getApplication() =>
      an org.objectstyle.cayenne.modeler.Application instance
    getApplication().getClassLoadingService() =>
      an org.objectstyle.cayenne.modeler.FileClassLoadingService instance
    getApplication().getClassLoadingService().loadClass(name) =>

    I've quadruple+ checked the CLASSPATH in preferences and it seems
    correct. Also, on a side note, should (or is?) the CLASSPATH preference
    be user-specific? Mine is currently pointing down into a project under
    my home directory. In a multi-user development environment, that could
    get pretty awkward if it isn't user-specific.



    -----Original Message-----
    From: Andrus Adamchik []
    Sent: Thursday, November 18, 2004 7:51 PM
    Subject: Re: How do you create a custom DB Adapter?


    > I also tried adding in the CLASSPATH preferences the path to the
    > files, but that didn't work, either.

    This should be sufficient for the adapter to be picked up. Even modeler
    restart is not required. Aside from possibly incorrect CLASSPATH (is it
    pointing to the root of the compiled classes package hierarchy?), there
    maybe an error in instantiating your custom adapter itself.

    Looking at the modeler code, I see that unfortunately it will provide
    no problem diagnostics (like an exception in the logs, or a verbose
    message on mouse over the red field). So lets try to guess. One thing
    that may be missing is "types.xml" files in the same Java package as
    your custom adapter. This file is accessed in constructor, so it is a
    possibility. You should just copy types.xml from dba.sybase package. If
    this doesn't help, I'll have to think of something else ;-)


    On Nov 18, 2004, at 12:49 PM, Gentry, Michael wrote:
    > I'm trying to create a custom DB adapter for our Sybase database (I
    > need
    > a custom PK generator, basically). I subclassed the existing Sybase
    > adapter and overrode the createPkGenerator() method and then when into
    > the modeler and put the full path to my new adaptor in the "DB
    > field of the DataNode Configuration section. When I tab or click out
    > of
    > it, it changes the field background to a reddish pink color and seems
    > to
    > lose the changes.
    > I also tried adding in the CLASSPATH preferences the path to the
    > files, but that didn't work, either.
    > Any suggestions?
    > Thanks,
    > /dev/mrg

    This archive was generated by hypermail 2.0.0 : Fri Nov 19 2004 - 11:33:20 EST