Getting property type information for JBND

From: Dirk Lattermann (
Date: Mon May 19 2008 - 16:51:29 EDT

  • Next message: Dirk Lattermann: "Re: SelectQuery and new objects"

    The following may boil down to "How can I get entity/property
    information on a Fault object?", but I'm not sure. Let me explain:

    To use Cayenne in a Swing application, I found JBND yesterday after
    browsing this list. It didn't seem too complicated to implement the
    needed org.jbnd.DataObject interface for the CayenneDataObjects, so I
    gave it a naïve try.

    I used a custom superclass for the objects generated by the Cayenne
    modeler. Most things were rather straightforward and work to a small
    amount. Then I stumbled over a problem which seems to be connected to

    A JBND DataObject must be able to return a JBND DataType which
    describes, among others, its properties. To determine the type of a
    property (attribute, to-one or to-many), I use

     objEntity = JBNDCayenneObject.this.getObjEntity();
     if (objEntity.getAttribute(key) != null) return DataType.ATTRIBUTE_KEY;
     if (objEntity.getRelationship(key) != null)
        if (objEntity.getRelationship(key).isToMany()) return
        else return TO_ONE_KEY;

    now, in a to-many-relationship, the JBND framework asks for the type of
    a property of a descendant object. A
       {<no id>; transient; []}

    This indicates a yet unfetched object (Fault), right?
    Apparently, even though JBNDCayenneObject.this.getClass() is the
    correct class of my data object, the getObjEntity() returns null.

    How can I obtain the property information in this case?
    Maybe it should be done via the DataMap and object entity name, but how
    do I find and access the DataMap?
    Even JBNDCayenneObject.this.getObjectId() returns null!

    Thank you!

    This archive was generated by hypermail 2.0.0 : Mon May 19 2008 - 16:52:01 EDT