Hibernate Find By Example

當TB_FD_USER裡面的PK=USER_NO時候
只有放PK到findByExample會被忽略喔...

eStoreService dao = (eStoreService)SpringService.getService(SpringService.USE_JDBC, "eStoreService");
TbFdUser user = new TbFdUser();
user.setUserNo(new Long(1));
Collection c = dao.getUserByExample(user);
System.out.println("result size:"+c.size());

Result...
Hibernate: select this_.USER_NO as USER1_4_0_, this_.ADDRESS as ADDRESS4_0_, this_.AREA_CODE as AREA3_4_0_, this_.BANK_ACCOUNT as BANK4_4_0_, this_.BIRTHDAY as BIRTHDAY4_0_, this_.CITY as CITY4_0_, this_.COMPANY_NAME as COMPANY7_4_0_, this_.COUNTRY_CODE as COUNTRY8_4_0_, this_.CREATE_BY as CREATE9_4_0_, this_.CREATE_DATE as CREATE10_4_0_, this_.EMAIL as EMAIL4_0_, this_.FAX_NO as FAX12_4_0_, this_.FLAG as FLAG4_0_, this_.ID_NO as ID14_4_0_, this_.INTRODUCED_BY as INTRODUCED15_4_0_, this_.LOGIN_ID as LOGIN16_4_0_, this_.LOGIN_PWD as LOGIN17_4_0_, this_.MOBILE_NO as MOBILE18_4_0_, this_.PROVINCE_CODE as PROVINCE19_4_0_, this_.SEX as SEX4_0_, this_.STATUS as STATUS4_0_, this_.TEL_NO as TEL22_4_0_, this_.TITLE as TITLE4_0_, this_.UPDATE_BY as UPDATE24_4_0_, this_.UPDATE_DATE as UPDATE25_4_0_, this_.USER_NAME as USER26_4_0_, this_.USER_TYPE as USER27_4_0_ from tb_fd_user this_ where (1=1)
result size:3


eStoreService dao = (eStoreService)SpringService.getService(SpringService.USE_JDBC, "eStoreService");
TbFdUser user = new TbFdUser();
user.setUserNo(new Long(1));
user.setEmail("xxx@ooo.com");
Collection c = dao.getUserByExample(user);
System.out.println("result size:"+c.size());

Result...
Hibernate: select this_.USER_NO as USER1_4_0_, this_.ADDRESS as ADDRESS4_0_, this_.AREA_CODE as AREA3_4_0_, this_.BANK_ACCOUNT as BANK4_4_0_, this_.BIRTHDAY as BIRTHDAY4_0_, this_.CITY as CITY4_0_, this_.COMPANY_NAME as COMPANY7_4_0_, this_.COUNTRY_CODE as COUNTRY8_4_0_, this_.CREATE_BY as CREATE9_4_0_, this_.CREATE_DATE as CREATE10_4_0_, this_.EMAIL as EMAIL4_0_, this_.FAX_NO as FAX12_4_0_, this_.FLAG as FLAG4_0_, this_.ID_NO as ID14_4_0_, this_.INTRODUCED_BY as INTRODUCED15_4_0_, this_.LOGIN_ID as LOGIN16_4_0_, this_.LOGIN_PWD as LOGIN17_4_0_, this_.MOBILE_NO as MOBILE18_4_0_, this_.PROVINCE_CODE as PROVINCE19_4_0_, this_.SEX as SEX4_0_, this_.STATUS as STATUS4_0_, this_.TEL_NO as TEL22_4_0_, this_.TITLE as TITLE4_0_, this_.UPDATE_BY as UPDATE24_4_0_, this_.UPDATE_DATE as UPDATE25_4_0_, this_.USER_NAME as USER26_4_0_, this_.USER_TYPE as USER27_4_0_ from tb_fd_user this_ where (this_.EMAIL=?)
result size:1

這個網誌中的熱門文章

Bash判斷參數是否存在

Node.js package : forever