วันพฤหัสบดีที่ 6 มกราคม พ.ศ. 2554

How to query several columns with Hibernate? | Benjamin Winterberg

How to query several columns with Hibernate? | Benjamin Winterberg

Hi Lars,
nice post!!!

I was searching for an explanation of "new map(" hibernate query ability and your post came up.

It is a bit confusing though when you describe the part about the new map:"...each containing entries with aliases (the keys) to selected values". You basically explained a map here, but you'r not describing what will be the actual key and what the value in your example:
"select new map(c.name as name, c.order as order) from Customer c"

If I do the following:
List mapsList = session.createQuery("select new map(c.name as name, c.order as order) from Customer c").list();
would this be true:
List> orderMapsList = (List>) mapsList;
Will this way, every map contain one entry with key name and value the order? or will it contain multiple entries?! I am confused!

Kind Regards,
Despot

ไม่มีความคิดเห็น:

แสดงความคิดเห็น