CodeName OneShai Almog6 min readintermediate
JPA Inspired ORM from SQLite to PostgreSQL
Summary
CodeName One introduced a JPA-inspired ORM layer, enabling shared entity definitions and managed sessions for both client (SQLite) and server (PostgreSQL, MySQL). This layer simplifies data persistence with relationship mappings, optimistic locking, and a JPQL-like query language.
- A managed session tracks entity changes and coordinates persistence for a single unit of work.
- Relationship mappings (@OneToMany, @ManyToOne) are supported, with explicit in-memory management.
- Transactions are explicit, with beginTransaction(), commitTransaction(), and automatic rollback on session close.
- Queries support eager/lazy loading via fetch() and a JPQL subset for complex operations.
Engineers building cross-platform applications with CodeName One can now use a consistent, JPA-inspired ORM for both client and server, simplifying data modeling and persistence logic across platforms.
6/10
