hibernate在from子句中选择子查询

时间:2016-07-14 10:26:23

标签: java mysql hibernate

我有这个问题:

    if (i == movies.length) {
        i = 0
    }

但是,hibernate不支持FROM子句中的子查询。 我不知道如何重写它才能正常工作。

我使用的调用java代码是(其中SELECT DATE(t.trade_date) AS tradeDate, a.basic , b.total FROM transaction t JOIN ( SELECT DATE(trade_date) AS date, COUNT(transaction.id) AS basic FROM transaction, account WHERE transaction.account = account.id and account.country='BE' and trader_id in ('M8', 'M5') GROUP BY DATE(trade_date) ORDER BY date desc ) a ON a.date = DATE(t.trade_date) JOIN ( SELECT DATE(trade_date) AS date, COUNT(transaction.id) AS total FROM transaction, account WHERE transaction.account = account.id and account.country='BE' GROUP BY DATE(trade_date) ORDER BY date desc ) b ON b.date = DATE(t.trade_date) WHERE t.trade_date is not null GROUP BY DATE(t.trade_date) ORDER BY t.trade_date desc 是基于上面一个的有效java字符串):

sql

使用此代码时,出现以下错误:

  

org.hibernate.MappingException:未知实体:[Ljava.lang.Object

0 个答案:

没有答案