开发者

CreateCriteria, joining associations

开发者 https://www.devze.com 2023-01-25 04:28 出处:网络
How can I write the following SQL using CreateCriteria: SELECTsa_bec_matricula.* FROMsa_bec_matricula INNER JOIN sa_matricula ON sa_bec_matricula.sa_mtc_num = sa_matricula.sa_mtc_num

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消