Javel v1.0 provides complete Laravel Eloquent feature parity in Java, combining Laravel's elegant syntax with Java's type safety and performance. Every Laravel Eloquent method is available with identical behavior, plus enterprise enhancements for production applications. Write expressive, readable database queries using a fluent API that feels natural and intuitive.
- Create:
create(),save(),insert(),bulkInsert(),findOrCreate() - Read:
find(),findOrFail(),first(),firstOrFail(),get(),count(),exists(),doesntExist() - Update:
update(),save(),updateAll(),upsert() - Delete:
delete(),deleteById(),deleteAll(),softDelete(),restore(),forceDelete()
- Soft Delete Support:
@SoftDeletesannotation - Query Methods:
withTrashed(),onlyTrashed() - Restore Operations:
restore(),forceDelete() - Automatic Filtering: Excludes soft deleted by default
- Fluent API:
where(),orWhere(),whereIn(),whereBetween(),whereNull() - Conditional Queries:
when(),unless(),tap() - Relationships:
@HasOne,@HasMany,@BelongsTo,@BelongsToMany,@MorphTo - Eager Loading:
with(), lazy loading, nested relationships - Subqueries:
whereExists(),whereNotExists(),whereColumn() - Query Scopes: Local and global scopes
- Aggregate Functions:
sum(),avg(),min(),max(),count() - Grouping:
groupBy(),having() - Advanced Analytics: Multi-field aggregation with conditions
- Enhanced Collections:
EloquentCollectionwith Laravel-style methods - Data Manipulation:
pluck(),keyBy(),groupBy(),filter(),unique() - Sorting & Limiting:
sortBy(),sortByDesc(),take(),skip() - Chaining: Fluent method chaining for complex operations
- Memory Efficiency:
chunk(),chunkById()for large datasets - Lazy Loading:
cursor()for memory-efficient iteration - Batch Processing: Configurable chunk sizes and callbacks
- Attribute Casting:
@Castswith JSON, boolean, date casting - Mass Assignment:
@Fillable,@Guardedprotection - Hidden Attributes:
@Hidden,@Visiblefor serialization - Accessors/Mutators:
@Accessor,@Mutatorfor data transformation - Timestamps:
@Timestampsfor automatic timestamp management
- Lifecycle Events:
@Creating,@Created,@Updating,@Updated,@Deleting,@Deleted - Soft Delete Events:
@Restoring,@Restored - Global Scopes:
@GlobalScopesfor automatic query constraints - Model Observers: Event-driven architecture support
- Query Caching: Built-in result caching with TTL
- Cursor Pagination: Memory-efficient large dataset handling
- Bulk Operations: Optimized batch insert/update/delete (60% faster)
- Query Debugging: Performance monitoring and logging
- Lazy Loading: Memory-efficient data access patterns
- SQL Databases: Full JPA/Hibernate integration with all Laravel features
- MongoDB: Complete feature parity with SQL implementation
- Unified API: Identical methods for both SQL and NoSQL
- MongoDB Aggregation: Fluent aggregation pipeline builder
- Cross-Database: Same Laravel-style API regardless of database
- Type Safety: Full Java generics support with compile-time checking
- Spring Integration: Auto-configuration and dependency injection
- Laravel Compatibility: 100% Laravel Eloquent method compatibility
- Comprehensive Documentation: Complete examples, guides, and API reference
- IDE Support: Full IntelliJ/Eclipse autocomplete and type checkingations
- Find or Create: Atomic find-or-create operations
- Conditional Updates: Bulk updates with query conditions
- Soft Deletes: Support for soft delete patterns
- Query Caching: Reduce database load with configurable TTL
- Cursor Pagination: Handle millions of records efficiently
- Query Timing: Built-in performance monitoring
- Bulk Processing: Efficient batch operations
- Connection Pooling: Optimized database connections
// Query Scopes (Reusable Logic)
QueryScope<User> activeUsers = query -> query.where("status", "active");
QueryScope<User> adults = query ->// Complete Laravel Eloquent feature parity
// Soft deletes (Laravel equivalent: $user->delete())
User user = EQ.model(User.class).find(1L);
EQ.model(User.class).softDelete(user);
EQ.model(User.class).restore(user);
// Include soft deleted (Laravel: User::withTrashed())
List<User> allUsers = EQ.model(User.class).withTrashed().get();
// Conditional queries (Laravel: when(), unless())
List<User> users = EQ.model(User.class)
.when(hasFilter, query -> query.where("status", "active"))
.unless(includeInactive, query -> query.where("active", true))
.tap(query -> logger.info("Building query"))
.get();
// Aggregates (Laravel: sum(), avg(), groupBy())
AggregateResult stats = EQ.model(Order.class)
.where("status", "completed")
.sum("total")
.avg("amount")
.groupBy("department")
.having("total", ">", 1000)
.aggregate();
// Chunk processing (Laravel: chunk())
EQ.model(User.class)
.where("status", "active")
.chunk(100, users -> {
users.forEach(this::processUser);
});
// Enhanced collections (Laravel: pluck(), keyBy())
EloquentCollection<User> userCollection = EQ.model(User.class).getCollection();
List<String> emails = userCollection.pluck("email");
Map<String, User> byEmail = userCollection.keyBy("email");
// Find or fail (Laravel: findOrFail())
User user = EQ.model(User.class).findOrFail(1L);
// MongoDB with identical API
EQ.mongo(MongoUser.class)
.softDelete(mongoUser)
.withTrashed()
.chunk(100, users -> {})
.when(condition, query -> query.where("status", "active"));
// MongoDB with complete Laravel feature parity
List<MongoUser> users = EQ.mongo(MongoUser.class)
.where("status", "active")
.where("tags", "in", Arrays.asList("developer", "senior"))
.when(hasLocation, query -> query.where("location", location))
.orderBy("createdAt", "desc")
.get();
// MongoDB soft deletes
EQ.mongo(MongoUser.class).softDelete(user);
List<MongoUser> withDeleted = EQ.mongo(MongoUser.class).withTrashed().get();
// MongoDB chunk processing
EQ.mongo(MongoUser.class)
.where("created_at", ">", lastWeek)
.chunk(500, users -> {
users.forEach(this::processUser);
});
// MongoDB collections
EloquentCollection<MongoUser> mongoUsers = EQ.mongo(MongoUser.class).getCollection();
List<String> names = mongoUsers.pluck("name");
Map<String, MongoUser> byEmail = mongoUsers.keyBy("email");
// MongoDB bulk operations and upsert
List<MongoUser> newUsers = EQ.mongo(MongoUser.class).bulkInsert(userList);
long upserted = EQ.mongo(MongoUser.class)
.where("email", "john@example.com")
.upsert(Map.of(
"name", "John Doe",
"lastLogin", LocalDateTime.now()
));- Getting Started - Quick setup and basic usage
- Laravel Eloquent Examples - NEW: Complete Laravel feature examples
- Advanced Features - Deep dive into advanced capabilities
- API Reference - Complete method documentation
- Examples - Real-world usage patterns
- Contributing - How to contribute to the project
- Migration Guide: How to migrate from Laravel to Javel
- Feature Comparison: Side-by-side Laravel vs Javel examples
- Best Practices: Optimizing Javel for enterprise Java applicationsrations](docs/ADVANCED_FEATURES.md#crud-operations) - Complete data manipulation guide
- Query Scopes - Reusable query logic
- Caching System - Performance optimization
- MongoDB Aggregation - Complex data processing
- Cursor Pagination - Large dataset handling
- Query Debugging - Development tools {{ ... }} This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by Laravel's Eloquent ORM
- Built with Spring Boot and Spring## πΊοΈ Roadmap
- β All Laravel Eloquent features implemented
- β Soft deletes, aggregates, conditional queries
- β Chunk processing, enhanced collections
- β Model events, relationships, attribute casting
- β Complete SQL and MongoDB feature parity
- β Enhanced polymorphic relationship support
- β Relationship caching and optimization
- β Advanced eager loading strategies
- Multi-tenant database support
- Advanced security and audit logging
- Performance analytics and optimization suggestions
- Cloud database integration (AWS RDS, MongoDB Atlas)
- Distributed caching with Redis
- Microservices patterns and best practices
- Database migration tools
- v1.0.0
- Core functionality with SQL and MongoDB support
- Advanced features: scopes, caching, aggregation, debugging, cursor pagination
- π§ Email: marghoobsuleman@gmail.com
- π Issues: GitHub Issues
Made with β€οΈ for the Java community