[
https://issues.apache.org/jira/browse/CAY-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761491#action_12761491
]
Andrus Adamchik commented on CAY-1287:
--------------------------------------
Evgeny, I don't think this is an issue at all. Indeed SQLTemplate can be used
without a root entity (or a Java class) attached to it. However during
execution we need to know which DataNode to run it against (the mapping can
have more than one DataNode). So we still need that piece of information. And
this is achieved by using the following constructor:
SQLTemplate(DataMap rootMap, String defaultTemplate)
Where rootMap is the DataMap that is linked to the desired DataNode. This
should solve your problem I think.
> SQLTemplate for not-mapping (DataRow) queries
> ---------------------------------------------
>
> Key: CAY-1287
> URL: https://issues.apache.org/jira/browse/CAY-1287
> Project: Cayenne
> Issue Type: New Feature
> Components: Cayenne Core Library
> Affects Versions: 2.0 branch
> Reporter: Evgeny Ryabitskiy
> Fix For: 3.0
>
>
> I wish to use nice SQLTemplate scripting engine for my simple not-mapping
> (DataRow) runtime-formed queries.
> But now I should pass a DataObject to SQLTemplate constructor.
> The question is: "For what?"
> To do mapping???
> If my query is like: "SELECT max(id) as MAX_ID from Table1" it has no sense!
> I want to add constructor like: SQLTemplate(String defaultTemplate, Map
> parameter)
> and teach DataContext to perform such queries well.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.