CreateCriteria, joining associations
How can I write the following SQL using CreateCriteria:
SELECT sa_bec_matricula.*
FROM sa_bec_matricula
INNER JOIN sa_matricula ON sa_bec_matricula.sa_mtc_num = sa_matricula.sa_mtc_num
INNER JOIN sa_periodo ON sa_matricula.sa_per_cod = sa_periodo.sa_per_cod
INNER JOIN sa_tpo_beca ON sa_bec_matricula.sa_tpo_bec_cod = sa_tpo_beca.sa_tpo_bec_cod
WHERE sa_periodo.sa_per_abi = 1
AND sa_t开发者_运维百科po_beca.sa_tpo_bec_gpr = 2
Attach the model. link text
It depends on your models and how they are mapped to your tables as Criteria are in terms of properties on objects not tables in schemas.
精彩评论