This is a sample project with best practice for enterprise Java developing. It’s particular because:
-
It provide both RESTful API & Grpc API
-
It fits into JavaEE 8 specification without the EJB parts, but not relying on any JavaEE application servers
Recommend to follow the Google API Design Guide.
Define wrapper interfaces for services to hide the details about communicating through Grpc or RESTful. Annotate on the interface to identify whether the API is stable, to identify the API is for internal or external.
The AbstractEntity
is to ensure using auto-incremental Id
field in database. It would bring better performance.
Create indexes for searchable fields, especially for the "natural id" field.
Assign column length for String
type fields.
Assign cascading for One-To-Many relationship.
Use DeltaSpike to simplify the implementation of Repository pattern.
The common project is separate because we want to build several server apps with the same business logics. It’s usually merged into the server app.
The presentation layer model directly matches the JSON entities accept from or return to user through RESTful API.