my2iu / Jinq

LINQ-style queries for Java 8
Other
660 stars 71 forks source link

can just suport 'select new xxxobj()' statement ? #38

Closed yangzhixiao closed 8 years ago

yangzhixiao commented 8 years ago

like this:

.where(xxxx) .select(m -> new UserWalletModel(m.getId(), m.getName(), m.getWallet().getBalance())) .toList();

as like HQL:

.createQuery("select new com.yzx.discover.model.UserWalletModel(u.id, u.name,u.wallet.balance) " + "from UserEntity u " + "where u.wallet.balance > :balance") .setParameter("balance", balance) .list();

my2iu commented 8 years ago

I actually added support for that a couple of weeks ago.

Look for "Custom Tuples" in the Query Guide:

http://www.jinq.org/docs/queries.html