Java Development Overview
intra-mart Accel Platform offers two development models for implementing business logic. There is the script development model (JSSP), in which you write the server side in JavaScript, and the JavaEE development model, in which you implement it in Java. This guide covers the latter, explaining how to divide up your classes when implementing a user module in Java, and how to use im_mirage, the database access foundation.
Who This Guide Is For
This guide is intended for developers who:
- Want to implement iAP user modules using the JavaEE development model
- Want to write code that reads from and writes to tables from Java, following an established set of conventions
- Need to understand the intent behind the DAOs and
SessionTemplatein a module they are maintaining
Prerequisites
To follow this guide, you must meet the following conditions.
- You understand the concept of iAP modules
- A local development environment is set up, and you are able to create a module project
- You have a basic knowledge of Java and SQL
The setup procedure is covered in Preparing the Development Environment, and the layout of a module project in Module Project Structure.
How This Guide Is Organized
| Page | Contents |
|---|---|
| Overall Architecture | How the four layers are arranged, the direction of dependencies, the naming of packages and classes, and the exception hierarchy |
| An Implementation Across Every Layer | The full set of classes that make up a single API, from DDL to endpoint |
| Presentation Layer Implementation Rules | The structure of an endpoint, authentication and authorization, request and response DTOs, input validation, turning exceptions into HTTP responses, and the response format |
| Application Layer Implementation Rules | Use cases, batch jobs, and exception translation |
| Domain Layer Implementation Rules | Domain models, the repository and service interfaces, factories, and exception classes |
| Infrastructure Layer Implementation Rules | Implementation classes, transaction boundaries, and exception translation |
| Creating Entities and DAOs | Mapping to tables, the supported column types, the audit fields that are set automatically, how to implement a DAO, and where to put SQL files |
| 2WaySQL | Dynamic queries written as SQL files, IN clauses and loops, the SET clause of UPDATE statements, and files for each database dialect |
| Transaction Control | Setting boundaries with SessionTemplate, and the behavior when they are nested |
| Anti-Patterns | The layer violations that come up repeatedly in review, and how to fix them |
| Available Skills | The skills for the implementation shape (layer structure, service layer, and database access) and for implementing intra-mart-specific APIs, such as accounts, roles, authorization, caching, IM-Workflow, and IM-Copilot |
If this is your first time, we recommend getting a grip on how the four layers relate in Overall Architecture, skimming how the classes line up in An Implementation Across Every Layer, and then moving on to the per-layer pages. The four implementation-rule pages run from the outside in, but reading only the page for the layer you are working on is perfectly fine. If you only want to know how database access is implemented, it is perfectly fine to start at Creating Entities and DAOs.
What This Guide Does Not Cover
The following topics are outside the scope of this guide.
- Implementing screens: Building business screens is covered in the Tutorial.
- Database access in the script development model: JSSP uses the
TenantDatabaseandSharedDatabaseAPIs. Both the way SQL is written and the way it is called differ from the Java side, so implementations cannot be carried over. - Creating table definitions (DDL): This guide covers the implementation of entities and DAOs; it does not cover the design of the
CREATE TABLEstatements themselves. - Web API Maker and the authorization feature themselves: Which layer an endpoint belongs in, and what it is responsible for, is covered in Presentation Layer Implementation Rules. The configuration options for publishing an API and the procedure for registering authorization resources are covered by the documentation for those features.