- Messages
- 123
- Reaction score
- 185
Entity4j - Lightweight Java ORM
GitHub Repository (full documentation)
What is Entity4j?
A minimal, type-safe Object Relational Mapper (ORM) for Java inspired by Entity Framework. Built and tested on Java 1.8 with support for MySQL, PostgreSQL, SQL Server, and SQLite.
Key Features:
• Lambda-based queries - Type-safe filtering with method references
• Annotation-based entities - Simple @Entity, @Id, @Column mapping
• Fluent mappings - Alternative to annotations for complex configurations
• Auto table creation - Generate tables from entity classes
• Multi-dialect support - Works with major databases
• Column selection - Project only needed columns for performance
• CRUD operations - Full Create, Read, Update, Delete support
• Bulk operations - Filtered updates and deletes without loading entities
Quick Example:
Installation:
Gradle:
Maven:
Advanced Features:
• Complex filtering with AND/OR logic and parentheses
• JOIN support with column selection into custom DTOs
• Pagination with limit/offset
• Multi-column ordering
• SQL debugging and parameter output
• Both annotation and fluent mapping styles
Perfect for developers who want Entity Framework-like functionality in Java without the complexity of heavyweight ORMs like Hibernate.

What is Entity4j?
A minimal, type-safe Object Relational Mapper (ORM) for Java inspired by Entity Framework. Built and tested on Java 1.8 with support for MySQL, PostgreSQL, SQL Server, and SQLite.
Key Features:
• Lambda-based queries - Type-safe filtering with method references
• Annotation-based entities - Simple @Entity, @Id, @Column mapping
• Fluent mappings - Alternative to annotations for complex configurations
• Auto table creation - Generate tables from entity classes
• Multi-dialect support - Works with major databases
• Column selection - Project only needed columns for performance
• CRUD operations - Full Create, Read, Update, Delete support
• Bulk operations - Filtered updates and deletes without loading entities
Quick Example:
Code:
// Define entity
@Entity(table = "users")
public class User {
@Id(auto = true) private Long id;
@Column(name = "full_name", nullable = false) private String name;
private Boolean active;
}
// Query with lambdas
List<User> results = ctx.from(User.class)
.filter(f -> f.equals(User::getActive, true))
.orderBy(User::getName, true)
.limit(10)
.toList();
Installation:
Gradle:
Code:
repositories { maven { url 'https://jitpack.io' } }
dependencies { implementation 'com.github.lovepigeons:Entity4j:v1.0.5' }
Maven:
Code:
<repository><id>jitpack.io</id><url>https://jitpack.io</url></repository>
<dependency>
<groupId>com.github.lovepigeons</groupId>
<artifactId>Entity4j</artifactId>
<version>v1.0.5</version>
</dependency>
Advanced Features:
• Complex filtering with AND/OR logic and parentheses
• JOIN support with column selection into custom DTOs
• Pagination with limit/offset
• Multi-column ordering
• SQL debugging and parameter output
• Both annotation and fluent mapping styles
Perfect for developers who want Entity Framework-like functionality in Java without the complexity of heavyweight ORMs like Hibernate.
Last edited: