Hello Kumar,

Currently it is not possible to extract a query defined in the datamap as an SQLTemplate query instance.

MappedSelect is a separate type of query which represents all the query types that can be defined in the datamap and the idea behind it is that after defining your query in the Modeler, you then don't have to worry about which type it is when calling it and just specify the necessary parameters for every select you make. E.g.:

List<Artist> artists = MappedSelect.query("SelectArtists", Artist.class)
  .param("name", "artist1")
  .select(context);

So in essence you can use MappedSelect instance you get the way you would use any other Cayenne query instance.

Hope this helps.


Dima


On 12/21/16 1:09 PM, Kumar wrote:
Hey,

I have defined few queries in the datamap.xml file and and accessing it
using MappedSelect.query("queryName")

My quick question is, I want to define a native sql query in the
datamap.xml file and to access in the code. Currently MappedSelect.query()
is returning a MappedSelect which i cannot use with SQLTemplate.

Thanks in Advance
Saravana Kumar.M


Reply via email to