Menu

Domain logic AND Generation from schema

Help
2004-05-05
2004-05-10
  • Mike Mulligan

    Mike Mulligan - 2004-05-05

    Just starting to learn about Jaxor, and like a birthday kid excited by his many new presents, I look at Jaxor's cool features.  But, does it make sense to consider using the Domain logic (extend the Base class) and the Generation from db schema features together?

    What I think this looks like is:

    1. Set up database schema.

    2. Some tables will be base objects that you will want to extend, let's say the FOOBAR table will become a Foobar object, so I write the Foobar class extending Jaxor's FoobarBase.

    3. Run schema2jaxor + jaxor + javac -- I have hacked jaxor.vm template to add an <code>impl</code> attribute: <code>&lt;entity name="FOOBAR" impl="Foobar"&gt;</code>

    Is this reasonable?  Is there another way to accomplish this?

     
    • Mike Mulligan

      Mike Mulligan - 2004-05-08

      > 2. Some tables will be base objects that you will want to extend

      But hacking the jaxor.vm template means that ALL base objects need to be extended.

      Second idea: extend AntTask to include nexted elements like this:

        <extend base="FoobarBase" impl="Foobar">

      Now ONLY the indicated classes get extended.  The effect is the same as having an impl="Foobar" attribute in the foobar.jaxor file.

       
    • Michael Rettig

      Michael Rettig - 2004-05-08

      Add a new nested element seems like a good idea.

      Would it be easier to just use schema2jaxor once to generate the first set of jaxor mapping files, then modify the mapping files? I've found the task saves a lot of time initially, but once the first set of mappings are generated, I prefer to modify them myself to customize the entity.  To ensure the mappings stay in sync, I use the ColumnChecker task that validates the mappings.

      Regards,

      Mike

       
    • Mike Mulligan

      Mike Mulligan - 2004-05-10

      > Would it be easier ...

      That sounds very sensible.  I'll try that and see how it feels as I learn more about Jaxor's features.

      Thanks!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.