On 29/01/13 8:54pm, Rafael López Torres wrote:
SQLTemplate sqlQuery = new SQLTemplate( Recinto.class, "SELECT " + "#result('t1.ID_RECINTO_ALFANUM' 'Long' '' 'toRecintoAlfanum.ID_RECINTO_ALFANUM'), " + "#result('t2.ID_RECINTO_GEOM' 'Long' '' 'toRecintoGeom.ID_RECINTO_GEOM'), " + "#result('t2.SD_GEOM' 'com.vividsolutions.jts.geom.Geometry' ) " + "FROM SGPCD_RECINTOS t0, SGPCD_RECINTOS_ALFNUM t1, SGPCD_RECINTOS_GEOM t2 " + "WHERE t0.ID_RECINTO_ALFANUM = t1.ID_RECINTO_ALFANUM AND " + " t0.ID_RECINTO_GEOM = t2.ID_RECINTO_GEOM AND " + "t0.IU_IL_RECINTO=23747616");sqlQuery.addPrefetch("toRecintoAlfanum");
Someone else who uses SQLtemplates more than me might be able to correct me on this, but I don't think prefetch is going to work along with SQLtemplate. It is designed to work with a normal Cayenne query and probably isn't going to be able to munge the SQL to add the extra join. The error message could be clearer though. I don't know MS-SQL, but could you achieve a similar result by using a view and then a SelectQuery? Alternatively you might be able to edit the database adapter to support additional data types. Ari -- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
