Hello everybody, I am getting lost in trying to use an SQLTemplate query.
I have tried to reduce the problem to the core, and this is the point where I am stuck. The following two lines of code do what I was expecting them to do: Query query = new SelectQuery(SaleSummary.class); List<SaleSummary> saleSummariesToProcess = objectContext.performQuery(query); Looking into the logs, this is the SQL statement generated automatically by Cayenne: > SELECT t0.amount, t0.unique_id, t0.period, t0.registrationDate, > t0.id_contract, t0.id_currency, t0.id_customer, t0.id_frontendSystem, > t0.id_saleSummary, t0.id_store FROM wolf.SaleSummary t0 So far, so good. But as soon as I replace the SelectQuery with a SQLTemplate, I can no longer get any result. Actually, I get the expected results, but instead of being instances of SaleSummary, the list contains all nulls. I need to run a fairly complex query that I would like to store into the model, but also the most trivial tests are failing. I have tried all the following options, all with the same bad result: - query = new SQLTemplate(SaleSummary.class, "select * from salesummary"); - query = new SQLTemplate(SaleSummary.class, "SELECT * FROM SALESUMMARY"); - query = new SQLTemplate(SaleSummary.class, "SELECT t0.amount, t0.unique_id, t0.period, t0.registrationDate, t0.id_contract, t0.id_currency, t0.id_customer, t0.id_frontendSystem, t0.id_saleSummary, t0.id_store FROM wolf.SaleSummary t0"); This latest option includes the same exact SQL query logged by the initial working code (that was using the SelectQuery class instead of SQLTemplate). Am I doing something blatantly wrong, or is there something weird going on here? BTW, I am using Cayenne 3.1B2. I was tempted to go back to 3.0.2, but being the model files not compatible, I was trying to understand why it is not working on 3.1B2 first. Any hints? Best regards, Giulio Cesare