Re: EOModels and Eclipse Question

From: Ralf Liebenow (ral..heco.de)
Date: Mon Dec 13 2004 - 10:45:00 EST

  • Next message: Ulrich Köster: "Re: webserver resources not found"

    Hi !

    We're facing a similar problem and it can be solved:

    By default EOF will load Models of all Frameworks by
    searching the Paths for directories ending with .eomodeld, so
    it is not possible to use two models with the same name
    for different databases in your project:

    When EOModelGroup.defaultGroup() is first called, it will call
    EOModelGroup.globalModelGroup() which will search all Frameworks and .woa
    Paths for .eomodeld Directories and construct the default Model Group.

    (The first Access to defaultGroup() is done, when EOF is first used,
    for instance if you create an Instance of an EOGenericRecord ...).

    If you register your own Model Group as default Model group _before_
    this initialization is done no automatic inclusion of existing Model
    Groups is done, but your own Model Group is used. All you have to do
    is, to know where your models are, configure them in your application
    Properties and create your own model group, and register it as default
    model group (EOModelGroup.setDefaultGroup(...)).

    Example:

    java.net.URL modelURL;//Assume this exists
    EOModelGroup group = new EOModelGroup();
    group.addModelWithPathURL(modelURL); // URL of Directory
    .. // other models
    EOModelGroup.setDefaultGroup(group);

    The directories you can set, do not need to end with .eomodeld. They
    must only be real models (with index.eomodeld and the other model files in
    them).

    So you could create a model Foo.eomodeld.mysql which has a mysql Model,
    and could create another model Foo.eomodeld.openbase for another db type and
    choose to load this or that by specifying the right path in a Porperty and
    use that to load your desired model.

    Because prototypes have different mappings in different database adaptors,
    you will have to create an own model for every DB flavour with EOModeler
    using the appropiate adaptor.

    Just make sure that the datatypes used for Java attribute mapping are
    compatible, so that the used entity classes are the same.

      Hope that helps
         Ralf

    > OK -
    >
    > I have read and re-read the section in Practical WebObjects and of
    > course EOModeler help.
    >
    > Nowhere did I ever find that you could have two models in the same
    > project and the one
    > model would see the other's prototypes. Ok, so I finally figured that
    > out.
    >
    > Now my question is do I put my prototypes in the same model in eclipse
    > or do I put them in
    > separate models in Eclipse? Finally, do I need a separate framework for
    > them, or is that just
    > a convenience for future projects? I need one for MySQL and another for
    > DB2 (As an aside has
    > anyone created a DB2 prototype entity?).
    >
    > Just trying to go a bit slow here and trying to understand a bit more
    > about the structure
    > of where these EOModels go with Eclipse.
    >
    > Thanks again.
    > James Cicenia
    >
    >

    -- 
    theCode AG
    Oranienstr. 10-11, 10997 Berlin [×]
    fon +49 30 617 897-0  fax -10
    ral..heCo.de http://www.theCo.de
    



    This archive was generated by hypermail 2.0.0 : Mon Dec 13 2004 - 10:45:03 EST