Home  >  Q&A  >  body text

mysql - How to implement a DAO in JAVA to query the result sets of two entity classes at the same time

How to implement a DAO in JAVA to query the result sets of two entity classes at the same time
1. The picture is as follows:


Union all query of two tables. Now only one entity set result can be returned. The entity set of the other table is filtered. How to return two entities at the same time? set.


2. There are three pieces of data in the database query: as shown in the figure

3. The current one can only return one solution set, please ask for guidance.

阿神阿神2712 days ago772

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-18 10:47:21

    Baidu

    hibernate 中createQuery与createSQLQuery两者区别是:
    前者用的hql语句进行查询,后者可以用sql语句查询
    前者以hibernate生成的Bean为对象装入list返回
    后者则是以对象数组进行存储
    

    It seems that you need to use the createSQLQuery method. The return result is an array, not a list

    reply
    0
  • Cancelreply