Total Pageviews

2009/11/17

Eclipse Tips and Shortcuts

http://shawnkercher.com/2009/11/15/eclipse-tips-and-shortcuts/

Shortcuts

Most Common

Delete linectrl + d
Go to Methodctrl + o

Format Codectrl + shift + f
Last Editctrl + q
Line Numberctrl + l
Move line(s)alt + up/down
Open Resourcectrl + shift + r

Open Proj Propalt + enter
Open Typectrl + shift + t
Run Java Appalt + shift + x, j
Run JUnitalt + shift + x, t
Shortcut Listctrl + shift + l

Refactoring Tips

Extract Methodalt + shift + m
Extract Variablealt + shift + l
Renamealt + shift + r
Surroundalt + shift + z

Templates

Go to Windows->Preferences->Java->Editor->Templates

To Activate templates press ctrl + space after command

For loopfor
If statementif
Main Methodmain
System.out.println()sysout

System.err.println()syserr
While statementwhile

Custom Templates

  • Logger

    • private static final Logger logger = Logger.getLogger(${enclosing_type}.class);

2009/10/30

2009/10/23

nHibenrate Exception: Unable to locate appropriate constructor on class [Persistence.vo.CaseTypeReportBean, Persistence]

I'm using aggregate functions in my HQL, it looks like this



and the CaseTypeReportBean is as bellowing


But as I run this function, system report this error message: Unable to locate appropriate constructor on class [Persistence.vo.CaseTypeReportBean, Persistence] [select new CaseTypeReportBean(t1.caseType, count(t1)) from Persistence.vo.Cases t1 group by t1.caseType]


It results from the inappropriate data type for CaseTypeReportBean constructor



Hence, I modify the constructor just like this(from int to Int64), then it works now



Reference: https://www.hibernate.org/407.html#A22