Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.74 KB

readme.md

File metadata and controls

43 lines (31 loc) · 1.74 KB

Java Discord Database

Discord Repository

Method Description
save saves entity in table
saveAll saves array of entities in table
findById if entity with specified ID exists, returns it in other case method returns empty Optional
findAll returns all entities
existsById returns either true if entity with specified ID exists in database, or false if it does not
count returns number of entities
deleteById removes entity with specified ID
delete removes passed entity from table
deleteAll removes passed array of entities, if no arguments are passed it clears entire table
executeQuery takes Query object and returns objects based on its content

Query syntax

public List<User> getByName(){
    return executeQuery(
            new Query<User, User>()
                    .SELECT("*")
                    .WHERE("name=Adam")
                    .AND()
                    .WHERE("age>30")
    );
}

Customizable column names

@Column(name = "some other name")
private String surname;