-
Notifications
You must be signed in to change notification settings - Fork 1
6 Eclipse
Contents:
- Make boxing/unboxing an error in eclipse
- Enable JPA annotation processing in Eclipse
- Enable JPA Tools (specifically Generate Entities from Tables...)
- Setting up Tomcat in Eclipse
Auto-boxing is evil. To trigger an error message in eclipse for every boxing/unboxing incident then do the following
- Go to Eclipse Preferences (Window > Preferences)
- Go to Java > Compiler > Error and Warnings
- Type box in the text box below the text "Select the severity ..."
- Choose Error in selector to the right of the text "Boxing and ..."
- Click apply
This is also illustrated below:
JPA annotation processing generates metadata classes for all entities in the project, that features type-safe dynamic queries. Enable it by performing the below steps.
- Go to Eclipse Marketplace (Help > Eclipse Marketplace)
- Search for apt
- Install m2e-apt
- Restart Eclipse as requested
- Go to Eclipse Preferences (Window > Preferences)
- Go to Maven > Annotation Processing
- Select the third option (Do not ...)
- Click OK
- Go to Window > Preferences
- Go to Data Management > Driver Definitions
3. Click Add and fill out the tabs as shown below and click OK.
- Goto Database Development perspective
- Right-click on Database Connections and click New...
- Choose Generic JDBC and name it EPRTRpublic and click Next
4. Insert password 5. Set a check mark in "Save password", "Connect when the wizard completes", and "Connect every time the workbench is started" 6. Click Test Connection 7. Click Finish
- Right-click the project and select JPA Tools > Generate Entities from Tables
- Select connection and schema and select the tables for which you wish to generate entities, and un-check "List generated classes in persistence.xml", and click Next twice
- Set the package to "eea.eprtr.model" and click Finish.
- Create a new Tomcat instance (and add the eprtr project in the second step).
- Add a resource to the context.xml as described in README.md (use the one with the jtds driver). The tags must be replaced by proper values.
- Disable automatic reloading for the Tomcat instance as illustrated below.
- Double-click the server instance.
- In the overview tab expand the Publishing section and select the Automatically publish when resources change option (if not already selected).
- In the modules tab click the Edit... button and uncheck Auto reloading enabled and click Save.
- Press Ctrl+S
Always start the server instance in debug mode (using the "Debug" menu item in the context-menu).
Doing this will enable JPDA HCR as described in How to Set Up Hot Code Replacement with Tomcat and Eclipse and Eclipse WTP Tomcat hot deploy.