I have 2 tables with corresponding classes in a legacy app.
public class SystemEvent { Long electionId; } public class Election { Long id; String name; Date endDate; }
For some unknown reason there is no foreign key between these two tables. And instead of SystemEvent having an Election Object, it has an electionId.
We have a Statistics page that up until now used Criteria with the SystemEvent Object/table. The problem is now we need to show some statistics using a join on SystemEvent and Election. For example "show me statistics for SystemEvent where election name is xxx". Since there is no field linking these two Objects/tables together, I can't use Criteria, correct?
I thought of using Query instead of Criteria, it's not that big of a change. But we are also doing Projections with the data, and as far as I know you can only use Projections with Criteria, not with Query.
So my questions:
Is there any way to make my query using a Query object and then somehow convert it to a Criteria so I can use Projection? Or, Is there any way to use Projections with Query objects?
Thanks!
|