Create the Repository
If you want to access the database and apply operations to your entity, a repository must be defined.
Keep in mind that the repository isn't a class
. It's just an interface
!
To ensure type safety, the type of the entity and the identifier must be specified as type parameters of the Repository<E, K>
interface.
ATTENTION:
First type is the ENTITY (
<E>
)Second type is the KEY of the ENTITY (
<K>
)
Example repository CustomerRepository
:
import eu.koboo.en2do.*;
import java.util.*;
// Name of the collection in database
@Collection("customer_repository")// Entity Key / Identifier
public interface CustomerRepository extends Repository<Customer, UUID> {
}
Last updated