Re: [CONF] Apache Cayenne: XML Mapping File (page edited)

From: Terrence A. Pietrondi (tepietrond..ahoo.com)
Date: Sat Dec 22 2007 - 18:43:18 EST

  • Next message: Andrus Adamchik (JIRA): "[JIRA] Closed: (CAY-948) Implement flattened attributes in Cayenne"

    --- Aristedes Maniatis <ar..sh.com.au> wrote:

    > The simplest way to have Cayenne handle PK
    > generation is to follow the
    > instructions here:
    >
    >
    http://cayenne.apache.org/doc/generate-primary-key-support.html
    >
    > That will implement a solution which is thread safe
    > and portable
    > between databases. I don't believe your solution
    > would be thread safe.
    >

    Here is the trick, the work I am doing is on an
    existing database (Oracle) and I do not have access to
    modify the existing schema. It could be possible that
    I go through a review with our database developer, but
    I am trying to solve the problem within the constrains
    of his design. For whatever reason, he chose not to
    implement auto-key generation and is expecting that to
    take place in the application code. Whether that is a
    good design decision or not is arguable, but I'd like
    to continue the implementation of my solution without
    database modifications. And therefore, key generation
    is going to have to take place in the application
    code. Hope that is not too confusing.

    > What is it you are wanting to do here? One of the
    > primary purposes of
    > an ORM is to insulate the user from the database
    > schema, allowing you
    > to refactor the database naming and schema without
    > touching your Java
    > code. Hardcoding in database field names may not be
    > in the best
    > interests of this approach. Also the comments in
    > your example suggest
    > a one to one mapping between databases tables
    > (DbEntity) and
    > ObjEntity. This is not always true in Cayenne:
    >
    >
    http://cayenne.apache.org/doc/handling-inheritance.html
    >

    I have a service that has a method to set a value for
    an entry of a member on a table. This method is
    "annotating" a "member" of a "category"
    (conceptually). And so, when using the "annotate"
    method, of the arguments for this method are a "rule"
    and a "value". A "rule" is a column on the database
    table, and a table represents a "category". I need to
    map this "rule" to the correct property name in
    Cayenne so I can set it properly for the correct
    "member". To be clear, I am editing an existing entry
    in the table, but I am targeting a specific column to
    set, and I need to map from the column name to the
    property name.

    Thanks.

    Terrence A. Pietrondi
    http://del.icio.us/tepietrondi

          ____________________________________________________________________________________
    Looking for last minute shopping deals?
    Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping



    This archive was generated by hypermail 2.0.0 : Sat Dec 22 2007 - 18:43:53 EST