193,12 → 193,18 |
throws ModelStoreException |
{ |
try { |
return ((Integer)HibernateUtil.currentSession().iterate( |
"select count(*) from Mailbox mb left join mb.domain as d" |
+ " where d.owner=? or mb.owner=?", |
new Object[] { user, user }, |
new Type[] { Hibernate.entity(User.class), Hibernate.entity(User.class) }) |
.next()).intValue(); |
List countlist = HibernateUtil.sqlQuery( |
"select count(*) from (" |
+ " select mb.id from mailboxes mb" |
+ " where mb.owner=?" |
+ " union" |
+ " select mb.id from mailboxes mb" |
+ " left join domains as d on mb.domain = d.id" |
+ " where d.owner=?" |
+ ") as count_table", |
new Object[] { user.getId(), user.getId() }); |
|
return ((Long)countlist.get(0)).intValue(); |
} |
catch(HibernateException ex) |
{ |