Re: Modeler Attribute Order Question.

From: Ahmed Mohombe (
Date: Thu Oct 27 2005 - 05:36:05 EDT

  • Next message: Ahmed Mohombe: "Reverse Engineer Database Comments?"

    > I think you're confused about what cgen is.
    > Cgen is the class generation code. It's the same class generation
    > code that's called from the modeler.
    I observed that it's the generator :) - from the documentation.

    > Not all of the functionality of
    > cgen is yet available from the modeler,
    Well, IMHO this should be improved.
    For me it's more logical to offer the 'entire' functionality from
    the modeler, and even more :).

    In order not to duplicate code, it might make sense from the GUI to
    call directly the ANT tasks and to redirect the ANT output to a
    'console' window in the Modeler. Also since there are pretty many
    windows, or one would like to work with more than one project (e.g.
    to do a migration, or just to 'look at some queries'), a framework like this:
    would make it easier to maintain the windows.

    Of course this is just a perspective of a user, but since most of the users
    who use Cayenne (over other ORMs) do it because of the productivity and the comfort
    with the Modeler :).

    > And by providing a tool, I don't mean extending the modeler or
    > extending cgen itself.
    I see. Are there some docs I missed about this approach?

    > It's as trivial as creating an independent POJO java class with the
    > following method, and using the VPPConfig-based config element to
    > stick it into your configuration as orderTool.
    > public List orderAttributeList(String ObjEntityName, List
    > unorderedListOfObjAttributes) { /* your ordering logic here */ }
    > Then in your template you use:
    > #foreach( $attr in $orderTool.orderAttributeList($,
    > $objEntity.DeclaredAttributes) )
    Interesting, however I found not documentation about this, and looking
    at the Modeler code it was not evident for me.

    > That's certainly not as complicated as writing UI-generating templates :)
    Well, maybe for you :).
    For me it was much simpler to read directly the DB structure, 'reuse' the 'dialect' implementation
    from Hibernate(to support more DBs) and generate everything I need.
    I even 'clicked' a nice GUI(in just a few hours) with this efficient tool :) :

    That generation tool was for a customer, and now I thought it might make sense to
    to 'reuse' that 'knowhow' (maybe for Cayenne since it already had a Modeler).
    Unfortunately for me it seems much simpler to start that from the scratch instead
    of extending the Modeler.

    It also looks much simpler to read with XStream or JDOM the Cayenne specific XML files
    and to generate everything from them than to deal with the Modeler 'model' and to change it
    to generate custom files :).
    I know this isn't the right approach, but everyone I asked agreed with my approach, since
    the was much simpler than the entire modeler object hierarchy :).

    Thanks in advance,


    This archive was generated by hypermail 2.0.0 : Thu Oct 27 2005 - 05:38:08 EDT