Newer
Older
storm / README.md
@aljunggren aljunggren on 27 Sep 2020 798 bytes Added primitive unit tests for list and array

Storm - Object-Relational Mapper

Interface

    @Connection(context = "H2")
    private interface UserRepository {
        
        @Select(sql = "select * from users")
        public List<User> fetchAll();
        
        @Select(sql = "select * from users where id = ?")
        public User findById(int id);
        
        @Select(sql = "select firstname || ' ' || lastname from users")
        public List<String> fullNames();

    }

Use

    UserRepository repository = StormRepository.newInstance(UserRepository.class);
    
    List<User> users = repository.fetchAll();
    User user = repository.findById(12);
    List<String> fullNames = repository.fullNames();

Mapping

    @ColumnProperty(name = "employee_id")
    private int employeeID;