請如何寫這個簡單的工作選擇,在Hibernate查詢,或標準休眠加入
SELECT * FROM `call` AS c JOIN `event_customer` AS e ON c.customer_id = e.customer_id WHERE e.dgdelete = FALSE AND c.eventruletype_id = 1 AND e.event_id = 74 AND c.callactivity_id = 3 AND e.calltype = 2
我發現已經有很多建議,但沒有任何幫助我呢。
它可能是什麼與Hibernate映射?
謝謝。
PS: 這是行不通的
query = session.createQuery("select c from " + Call.class.getSimpleName()+ " as c " + EventCustomer.class.getSimpleName()+ " as e where e.customer_id = c.customer_id and e.event_id = 74");
也是這個工作不
query = session.createQuery("select c from " + Call.class.getSimpleName()+ " as c join " + EventCustomer.class.getSimpleName()+ " as e where e.customer_id = c.customer_id and e.event_id = 74");
而且這個
query = session.createQuery("select c from " + Call.class.getSimpleName()+ " as c join " + EventCustomer.class.getSimpleName()+ " as e on e.customer_id = c.customer_id where e.event_id = 74");
而且這個
query = session.createQuery("select c from " + Call.class.getSimpleName()+ " as c left join " + EventCustomer.class.getSimpleName()+ " as e on e.customer_id = c.customer_id where e.event_id = 74");
,並在某些情況下,我得到這個錯誤
您以何種方式查詢不起作用?會發生什麼與你的預期?什麼是數據庫模式和Java數據模型? – Adrian 2013-05-07 16:08:09