โ˜• Advanced Features

Enterprise Java Bean Support

PikaORM provides a custom enterprise bean implementation through EnterprisePikaBean that combines ORM functionality with validation and lifecycle management. Unlike traditional heavy EJBs, this is a lightweight, ORM-focused bean system.

Key Features

๐Ÿ“กAuto persistence tracking
โœ…Built-in validation
๐Ÿ”„Change tracking
๐Ÿ”—Relationship loading

Basic Usage

public class User extends EnterprisePikaBean {
    private String name;
    private String email;
    private Integer age;

    @Override
    protected void validation() {
        if (name == null || name.trim().isEmpty()) {
            addError("name", "Name is required");
        }
        if (email == null || !email.contains("@")) {
            addError("email", "Valid email is required");
        }
    }
}

CRUD Operations

Because the bean inherits from EnterprisePikaBean, it handles its own database state.

// Create new record
User user = new User();
user.setName("John Doe");
user.setEmail("john@example.com");

if (user.validate()) {
    Long id = user.insert(); // Returns generated ID
}

// Update existing record
user.setName("Jane Doe");
user.save(); // Automatically calls update() since it tracks its persisted state

// Delete record
user.delete();

Loading Relationships

// Load one-to-many relationship
PikaManyQuery<Order> orders = user.loadMany(Order.class);

// Load many-to-many through join table
PikaManyThroughQuery<UserRole, Role> roles =
    user.loadManyThrough(UserRole.class, Role.class);

// Load single related entity
Company company = user.load(Company.class);

EJB Context: Traditional EJBs require complex container dependencies. PikaORM's implementation is a Simple POJO approach that works in any Java environment โ€” directly mapped to your database.

Simple, honest, no magic. That's the PikaORM way.
โ€” PikaORM docs, end of the road ๐ŸŽ‰