Re: [jira] Commented: (CAY-1287) SQLTemplate for not-mapping (DataRow) queries

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Oct 02 2009 - 07:43:41 EDT

  • Next message: ςΡΒΙΓΛΙΚ εΧΗΕΞΙ: "RE: [jira] Commented: (CAY-1287) SQLTemplate for not-mapping (DataRow) queries"

    I am taking this to dev, as Jira is a poor medium for discussion.

    On Oct 2, 2009, at 2:33 PM, Evgeny Ryabitskiy (JIRA) wrote:
    > But it's also very confusing to developer course he don't know which
    > Map to Use and User Guide have nothing about it.

    How come you don't know which DataMap to use, but know which DataNode
    to use? I would think that if you know the later, you'd definitely
    know the former. Unless you have projects that are just DataNodes
    without any DataMaps?

    > We should write about it there!
    >
    > I have simple solution for it.. At least it's not confusing to new
    > developer.... :
    >
    > // new constructor using only DataNode
    > public SQLTemplate(DataNode dataNode, String defaultTemplate) {
    > //use any DomainMap course there is no metter...
    > this(dataNode.getDomainMaps.iterator().next(), defaultTemplate);
    > }

    I explained why this is not going to work in Jira. Let me reiterate.
    Referencing DataNode in the user code is prohibited by design. Queries
    are designed to be run via an ObjectContext that can map to multiple
    nodes, and can be executed from remote layers with no access to
    DataNode. So Cayenne general purpose queries must not have API
    dependency on the DataNode. There's a level of indirection that I
    think is not that hard for the end user to use.

    I can agree about better documentation, but now that I described how
    it works, does it make sense? It is easier to create missing
    documentation instead of changing the main framework assumptions.

    Andrus



    This archive was generated by hypermail 2.0.0 : Fri Oct 02 2009 - 07:44:13 EDT