Backend — Employee Management API#
What you build. A SpringBoot service that publishes /api/department and /api/employee over your database, with paging, sorting, search, validation, and foreign-key resolution already wired — no hand-written SQL, no manual controllers.
Audience. Java / SpringBoot / Gradle developers. We skip over things Spring teaches well elsewhere (security config, JPA fundamentals, build system wrangling) and focus on the Palmyra-specific pieces: annotations, handlers, and the request/response shape.
Steps#
| # | Step | What you learn |
|---|---|---|
| 1 | Project setup | Wiring palmyra-spring into a plain SpringBoot project; creating the two tables |
| 2 | Department schema | Simplest shape of a Palmyra model + handler |
| 3 | Employee schema | Foreign keys as nested models; flattened columns via parentRef; FetchMode for payload size |
| 4 | Try it | curl exercises for every CRUD route, including natural-key upserts and joined-column filters |
What’s Palmyra-specific, what isn’t#
| You still write | Palmyra handles |
|---|---|
SpringBoot bootstrap (@SpringBootApplication, datasource config) |
URL routing, JSON (de)serialisation |
| Your POJOs (annotated model classes) | SELECT / INSERT / UPDATE / DELETE generation |
| Validation rules that aren’t expressible in annotations | Paging, sorting, quick-search, field projection |
Security rules (either via Spring Security or @Permission) |
Foreign-key expansion + flattening |
Business logic inside lifecycle hooks (preCreate, onQueryResult, …) |
Audit-safe stamping of createdAt / createdBy / updatedAt fields via DropMode |
End state: a running service on :8080 answering the full CRUD matrix for both entities, ready for the frontend track to consume.