Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

kaiwinter/JavaActiveRecord

Open more actions menu

Repository files navigation

Example

PersonAR is an Active Record which extends BaseAR. For a running example see the JavaActiveRecord-Example-Project or the unit tests of JavaActiveRecord.

// Saving an entity
PersonAR person = new PersonAR();
person.setName("First name");
person.setSurname("Last name");
person.save();
System.out.println("Saved Person with ID: " + person.getId());

// Loading by ID
PersonAR findById = PersonAR.findById(PersonAR.class, 1);
System.out.println("Person by ID: " + findById);

// Loading by custom field
Collection<PersonAR> findByField = PersonAR.findAllByField(PersonAR.class, "name", "First name");
System.out.println("Person by Name: " + findByField);

// Loading all
Collection<PersonAR> findAll = PersonAR.findAll(PersonAR.class);
System.out.println("All Persons: " + findAll);

About

Toy implementation of a minimal, generic Active Record pattern

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.