Skip to content
Rolf Thunbo edited this page Mar 16, 2015 · 8 revisions

Contents:

Make boxing/unboxing an error in eclipse

Auto-boxing is evil. To trigger an error message in eclipse for every boxing/unboxing incident then do the following

  1. Go to Eclipse Preferences (Window > Preferences)
  2. Go to Java > Compiler > Error and Warnings
  3. Type box in the text box below the text "Select the severity ..."
  4. Choose Error in selector to the right of the text "Boxing and ..."
  5. Click apply

This is also illustrated below:

Make boxing/unboxing an error message in Eclipse

Enable JPA annotation processing in Eclipse

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.

  1. Go to Eclipse Marketplace (Help > Eclipse Marketplace)
  2. Search for apt
  3. Install m2e-apt

Install m2e-apt in Eclipse Market place

  1. Restart Eclipse as requested
  2. Go to Eclipse Preferences (Window > Preferences)
  3. Go to Maven > Annotation Processing
  4. Select the third option (Do not ...)
  5. Click OK

Install m2e-apt in Eclipse Market place

Enable JPA Tools (specifically Generate Entities from Tables...)

Add driver definition for Microsoft SQL (jtds)
  1. Go to Window > Preferences
  2. Go to Data Management > Driver Definitions

Eclipse Preferences - Driver Definitions 3. Click Add and fill out the tabs as shown below and click OK.

Eclipse Preferences - Add Driver Definition Eclipse Preferences - Add Driver Definition Eclipse Preferences - Add Driver Definition

Add Connection Profile
  1. Goto Database Development perspective
  2. Right-click on Database Connections and click New...
  3. Choose Generic JDBC and name it EPRTRpublic and click Next

New Connection Profile 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

New Connection Profile - Connect

Generate Entities from Tables
  1. Right-click the project and select JPA Tools > Generate Entities from Tables
  2. 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

Generate entities

  1. Set the package to "eea.eprtr.model" and click Finish.

Generate entities

Setting up Tomcat in Eclipse

  1. Create a new Tomcat instance (and add the eprtr project in the second step).
  2. 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.
  3. Disable automatic reloading for the Tomcat instance as illustrated below.
Disable automatic reloading for the Tomcat instance
  1. Double-click the server instance.
  2. In the overview tab expand the Publishing section and select the Automatically publish when resources change option (if not already selected).
  3. In the modules tab click the Edit... button and uncheck Auto reloading enabled and click Save.
  4. Press Ctrl+S
Running the Tomcat server instance

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.