cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Рябицкий Евгений <>
Subject RE: [jira] Commented: (CAY-1287) SQLTemplate for not-mapping (DataRow) queries
Date Fri, 02 Oct 2009 12:28:56 GMT

> 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?

I use following code:

private static DataNode myProjectDataNode;
static {
//static init block
Configuration config = Configuration.getSharedConfiguration();
DataDomain domain = config.getDomain();
myProjectDataNode = domain.getNode("MapNode);

So I have my DataNode as a singleton instance for my whole application.
I can get DataNode from static getter every time. It's very comfortable.
I also have some DomainMaps (some Named Queries) but in some cases I just need to perform
runtime-formed queries. So it's very confusing for me to pass ANYDomainMap to SQLTemplate
constructor every time...
To be hones it was so confusing that I didn't guess to do it  :))))
And not only me...
When I was creating this issue I didn't know any nice solution...
I had NameQuery that was containing this: $DynamicQueryAsString
And pass there my runtime formed SQL string as a parameter...
Stupid annoying solution..... that is how this issue appeared...

> 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

DataMap doesn't belong to DataNode?

I am generally using one connection (one DataNode). Looks like I missed something about Nodes
and Maps...

> 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.

Yeah... at least now I know some solution better then my "DynamicQuery"...
In this case we should fix docs first...
Still think that we can improve Cayenne query engine ;)

P.S. Don't want to be annoying... but still looking forward to you answers to my other issues...

Evgeny Ryabitskiy.

View raw message