Adding Property

From: Peter (peatha..ahoo.de)
Date: Mon Oct 30 2006 - 14:59:19 EST

  • Next message: Bryan Lewis: "Re: Is there an awakeFromInsertion equivalent in cayenne?"

    Hallo Cayenne Users!

    The generic-exmaple (see
    http://cwiki.apache.org/confluence/display/CAY/Generic+DataObjects+Example)
    was useful for me.
    There you add columns via:

    DbEntity messageTable = orMapping.getDbEntity("message");
    DbAttribute topicColumn = new DbAttribute("topic", Types.VARCHAR,
    messageTable);
    messageTable.addAttribute(topicColumn);
    ObjEntity messageEntity = orMapping.getObjEntity("Message");
    ObjAttribute topicProperty = new ObjAttribute("topic",
    String.class.getName(), messageEntity);
    topicProperty.setDbAttribute(topicColumn);
    messageEntity.addAttribute(topicProperty);

    For what is method messageTable.dbAttributeAdded(AttributeEvent)? Who
    receives what?
    How can I add columns at runtime, after I created the default db schema,
    so that the existing columns will not be removed? Should I subclass
    DbGenerator? Or is this only possible with raw sql statements?

    And how to read ALL properties from database, not only the mapped one.
    Because if I add a column externally, it won't appear in cayenne
    attribute list: getDbEntity(name).getGeneratedAttributes will fail.
    Should I use: Remote Object Persistence?

    Thank you, Peter.

                    
    ___________________________________________________________
    Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de



    This archive was generated by hypermail 2.0.0 : Mon Oct 30 2006 - 15:05:12 EST