RE: Problem by Updating an Object

From: Kai Michael Bodach (
Date: Wed Feb 11 2004 - 04:55:43 EST

  • Next message: Vassilis Raxenidis: "Recovery from Network error"

    Hi Andrus,

    my last debugs and reviews in my source and the source of cayenne bring me
    to the "point of failure". It is the following line:
    I have tested this call with different params for lookupObjEntity like the
    Class or the EntityName. Here my calls:
    Both calls are working fine and give me the right ObjEntity. But if I follow
    the cayenne source and call the method in that way (were "recht" is a even
    loaded object, the resolver could't find the entity:

    That lets me think little bit and I think now it has something to do with my
    configuration, because I have to use the
    Configuration.bootstrapSharedConfiguration(Class i_class) method and I think
    that my problem causes on different class loaders. It's only a guess. But if
    I don't use the bootstrapSharedConfiguration(...) method I get a
    CayenneRuntimeException: [v.1.0.6 January 26 2004] No suitable DataNode to
    handle query.
    I think I don't use this method in a correct way.

    In my configuration I use the PoolManager, to set up the connection data,
    because the user of my app should be able to define them. I do not found a
    better way and so I hope it is the right one. And in my configuratin every
    session has there own DataContext. Here my configuration:


    Configuration config = Configuration.getSharedConfiguration();

    DataDomain domain = config.getDomain(DOMAIN_NAME);
    PoolManager oldManager =
            (PoolManager) domain.getNode(NODE_NAME).getDataSource();
    PoolManager manager = null;
            try {
                     manager = new PoolManager(
            } catch (NumberFormatException e) {
                    // TODO Auto-generated catch block
            } catch (SQLException e) {
                    // TODO Auto-generated catch block
            DataNode connInfo = domain.getNode(NODE_NAME);
            if (_context != null)
            config = Configuration.getSharedConfiguration();
            domain = config.getDomain(DOMAIN_NAME);

            DataContext context = domain.createDataContext();
            _context = context;
            _conChanged = false;


    And last but not least, here is a successful select in my db layer. (But
    only if I use the bootstrapSharedConfiguration(...) method, like above.


    public LgRessourceListe ladeAlle() {
            DataContext context =
            SelectQuery query = new SelectQuery(CYDbRessource.class);
            List dbRessourcenList = context.performQuery(query);

            return generiereLgRessourcenListe(dbRessourcenList);


    And yes CYDbObject is a subclass of CayenneDataObject. I use the following
    class hierarchy. CayenneDataObject <-- CYDbObject <-- _CYDBRecht <--
    CYDbRecht (in the last heirarchy level are all my persistent db objects. So
    I can all generall method put into the CYDbObject, like
    getDataContextForSession(String i_sessionId) and objectFromPrimaryKey(Class
    i_class, String i_column_name, int i_pk).

    Thanks for your time and help.


    -----Original Message-----
    From: Andrus Adamchik []
    Sent: Tuesday, February 10, 2004 8:41 PM
    Subject: Re: Problem by Updating an Object

    Hi Kai,

    This is indeed strange. The fact that you were able to perform
    successful select, already means that your configuration is loaded
    properly. And the error is rather unambiguous - it means exactly what
    it says.

    Could you post your Java code including both select and commit pieces?
    Also a random question - is "CYDbObject" a subclass of


    On Feb 10, 2004, at 6:34 AM, Kai Michael Bodach wrote:

    > I have a strange problem when I'm using cayenne. I'm a newbie and the
    > cause
    > could be the configuration or the way I use cayenne. What I try, is to
    > update a exist Object (I think the right term is ObjEntity???). Ok, I
    > have
    > load the object via SelectQuery from the db (oracle). I got my object
    > (CayenneDataObject) and cast it to my Type. Then I use the setMethod to
    > change a property, e.g. a discription property (String). So far so
    > good.
    > When I now commit my changes, via dataContext.commitChanges(), I got
    > the
    > following Exception:
    > org.objectstyle.cayenne.CayenneRuntimeException
    > [v.1.0.6 January 26 2004] Class
    > '' does not map to an
    > ObjEntity
    > and is therefore not persistent. Can't commit changes.

    This archive was generated by hypermail 2.0.0 : Wed Feb 11 2004 - 04:57:22 EST