public List<ClientDetailsDTO> getClientListBasedOnCriteria(HttpServletRequest request) {
try {
Criteria queries = getHbSession().createCriteria(ClientDetailsDTO.class , "clientAdmin");
String city = request.getParameter("cityList").replace('-',' ').trim();
List<String> cities = Arrays.asList(city.split(","));
List<String> regions = Arrays.asList(region.split(","));
List<String> payTypes = Arrays.asList(payType.split(","));
List<String> activeUser = Arrays.asList(activUser.split(",") );
if (null != cities && cities.size() > 0&& !((cities.get(0)).equalsIgnoreCase("all"))) {
queries.createAlias("clientAdmin.cityBeanDTO", "city");
queries.add(Restrictions.in("city.cityName", cities));
}
return queries.list();
SELECT this_.client_id AS client1_1_7_,
this_.acc_mangr_id AS acc25_1_7_,
this_.address_line AS address2_1_7_,
this_.address_line2 AS address3_1_7_,
this_.adtnl_logins AS adtnl4_1_7_,
this_.alt_mail_id AS alt5_1_7_,
this_.brand_name AS brand6_1_7_,
this_.city_id AS city26_1_7_,
this_.client_name AS client7_1_7_,
this_.con_per_fname AS con8_1_7_,
this_.con_per_lname AS con9_1_7_,
this_.country AS country1_7_,
this_.fax_number AS fax11_1_7_,
this_.free_promotional_id AS free27_1_7_,
this_.free_transactional_id AS free28_1_7_,
this_.isloggedin AS isloggedin1_7_,
this_.landline_code AS landline13_1_7_,
this_.landline_no AS landline14_1_7_,
this_.location AS location1_7_,
this_.login_id AS login16_1_7_,
this_.mail_id AS mail17_1_7_,
this_.mobile_no AS mobile18_1_7_,
this_.mobile_no2 AS mobile19_1_7_,
this_.no_of_logins AS no20_1_7_,
this_.password AS password1_7_,
this_.pincode AS pincode1_7_,
this_.promo_sms_status AS promo29_1_7_,
this_.promotional_id AS promoti30_1_7_,
this_.registered_date AS registered23_1_7_,
this_.client_status AS client31_1_7_,
this_.transactional_id AS transac32_1_7_,
this_.tx_sms_status AS tx33_1_7_,
this_.user_type_id AS user34_1_7_,
this_.valid_till AS valid24_1_7_,
manager2_.acc_mangr_id AS acc1_25_0_,
manager2_.acc_mangr_name AS acc2_25_0_,
manager2_.managr_location AS managr3_25_0_,
manager2_.emp_code AS emp4_25_0_,
manager2_.acc_mgr_region AS acc6_25_0_,
manager2_.reporting_head AS reporting5_25_0_,
manager2_.user_type_id AS user7_25_0_,
region3_.region_id AS region1_37_1_,
region3_.region_name AS region2_37_1_,
city1_.city_id AS city1_18_2_,
city1_.city_name AS city2_18_2_,
city1_.state_id AS state3_18_2_,
msgtemplat11_.client_id AS client4_9_,
msgtemplat11_.tmplt_id AS tmplt1_9_,
msgtemplat11_.tmplt_id AS tmplt1_29_3_,
msgtemplat11_.client_id AS client4_29_3_,
msgtemplat11_.msg_header AS msg2_29_3_,
msgtemplat11_.msg_template AS msg3_29_3_,
msgtemplat11_.tmplt_type AS tmplt5_29_3_,
msgtemplat11_.msg_status AS msg6_29_3_,
aorn6_.status_id AS status1_27_4_,
aorn6_.status_type AS status2_27_4_,
charges4_.chrg_id AS chrg1_17_5_,
charges4_.adtnl_log_chrgs AS adtnl2_17_5_,
charges4_.client_id AS client23_17_5_,
charges4_.discount AS discount17_5_,
charges4_.engage_bill_end_date AS engage4_17_5_,
charges4_.engage_bill_start_date AS engage5_17_5_,
charges4_.month_chrg AS month6_17_5_,
charges4_.one_time_chrg AS one7_17_5_,
charges4_.client_pay_mode_id AS client24_17_5_,
charges4_.pay_type AS pay8_17_5_,
charges4_.pr_credit_bal AS pr9_17_5_,
charges4_.prmn_sms_credits AS prmn10_17_5_,
charges4_.prmn_sms_extend_till AS prmn11_17_5_,
charges4_.prmn_free_sms_credits AS prmn12_17_5_,
charges4_.prmn_sms_rate AS prmn13_17_5_,
charges4_.prmn_sms_valid_till AS prmn14_17_5_,
charges4_.prmn_updated_sms_credits AS prmn15_17_5_,
charges4_.tx_credit_bal AS tx16_17_5_,
charges4_.tx_updated_sms_credits AS tx17_17_5_,
charges4_.txn_sms_credits AS txn18_17_5_,
charges4_.txn_sms_extend_till AS txn19_17_5_,
charges4_.txn_free_sms_credits AS txn20_17_5_,
charges4_.txn_sms_rate AS txn21_17_5_,
charges4_.txn_sms_valid_till AS txn22_17_5_,
paymode5_.pay_mode_id AS pay1_16_6_,
paymode5_.pay_mode AS pay2_16_6_,
paymode5_.pay_mode_value AS pay3_16_6_
FROM client_details_tbl this_
INNER JOIN acc_mangr_tbl manager2_ ON this_.acc_mangr_id=manager2_.acc_mangr_id
INNER JOIN region_tbl region3_ ON manager2_.acc_mgr_region=region3_.region_id
INNER JOIN city_tbl city1_ ON this_.city_id=city1_.city_id
LEFT OUTER JOIN msg_tmplts_tbl msgtemplat11_ ON this_.client_id=msgtemplat11_.client_id
INNER JOIN status_tbl aorn6_ ON this_.client_status=aorn6_.status_id
INNER JOIN client_chrgs_tbl charges4_ ON this_.client_id=charges4_.client_id
INNER JOIN client_pay_mode_tbl paymode5_ ON charges4_.client_pay_mode_id=paymode5_.pay_mode_id
WHERE city1_.city_name IN (?)
AND region3_.region_name IN (?)
AND paymode5_.pay_mode IN (?,
?)
AND aorn6_.status_type IN (?)
我需要根据位置/城市,地区,状态,包裹搜索客户详细信息。
我曾使用内部联接来加入Cities,Regions,Paytypes,ActiveUser Tables。
但我收到了重复的数据行。
有人可以为我的问题提供解决方案。
答案 0 :(得分:1)
我已添加此声明。
queries.setResultTransformer( DistinctRootEntityResultTransformer.INSTANCE ) ;
答案 1 :(得分:0)
测试在您的休眠标准中添加此项,之前调用list():
queries.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
此致