[OS-JIRA] Created: (CAY-81) Add appropriate string for createAndRegisterNewObject to generated class

From: jir..bjectstyle.org
Date: Thu Jan 22 2004 - 21:31:45 EST

  • Next message: Andrus Adamchik: "Re: Cayenne xdocs checked in"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-81

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-81
        Summary: Add appropriate string for createAndRegisterNewObject to generated class
           Type: Improvement

         Status: Assigned
       Priority: Minor

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Versions:
                 1.0 [STABLE]

       Assignee: Andrus Adamchik
       Reporter: Scott Ellsworth

        Created: Thu, 22 Jan 2004 9:30 PM
        Updated: Thu, 22 Jan 2004 9:30 PM
    Environment: MacOS X, Java 1.4

    Description:
    In just the short time I have been using Cayenne, I have already typed code like:

            private void createGameWithPlayers(int number) {
                    Game game = (Game) ctxt.createAndRegisterNewObject("GameObjEntity");
                    game.setTurn(new Integer(0));
                    for (int i=1; i<= number; i++){
                            Player player = (Player) ctxt.createAndRegisterNewObject("PlayerObjEntity");
                            player.setName("Player"+i);
                            game.addToPlayers(player);
                    }
            }

    a number of times. Given that inside, Cayenne knows the name of the object to create, as it had to populate the tables used by the context, I would like it to generate the name for me:

    package com.alodar.starmap.persist;

    import java.util.List;

    public class Game extends org.objectstyle.cayenne.CayenneDataObject {

        public static final String CREATE_NAME_PROPERTY = "GameObjEntity";
        public static final String TURN_PROPERTY = "turn";

    ...

    Alternatively, add a method to Context that will take a class and look up the proper name to instantiate. Once we did these two things to our own persistence framework (see metagraph.org), we saw our error counts drop substantially, as refactoring editors became able to catch typos.

    Scott

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Thu Jan 22 2004 - 21:31:46 EST