RepositoryJPA is a project mainly written in Java, it's free.
Intends to be a generic repository for JPA instances
TODO
Validar as entidades - Ok Inclusao de objetos - Ok Alteracao - Ok Exclusao logica - Ok Listagem sem parametros - Ok Consulta parametrizada - Ok Validar a estrutura - Ok Buscar apenas itens ativos - Ok Colocar enums para o inicio da consulta - Ok
Lancar excecao no Keeper - Ok
Documentar o Utils. Estudar o Arquilian
Consulta by Google. Reescrever Readme. Documentar o codigo. Traduzir mensagens de erro.
Seeker s = new Seeker();
List
List
Proposicoes: AND(new Equals(...), new Between(...)) -- OK OR(new Equals(...), new Between(...)) -- OK NOT(...) -- OK ORDERBY -- OK
Modificar o Like -- OK
Lancar excecao JPQL - Ok
Proposicao composta nao tem order by. -- OK
Testar: Seeker s = new Seeker(); s.searchAll(Carro.class); s.searchAll(Moto.class); s.searchAll(Bicicleta.class);
This project intends to be a generic repository for JPA instances.
It isolates the developer from knowing the databases and transactions and criterias.
Keeper k = new Keeper(); k.persist(instance); k.remove(instance); k.remove(instance, RemoveEnum.LOGICAL) k.remove(instance, RemoveEnum.PHYSICAL)
Seeker s = new Seeker(); s.giveme(ALL/SINGLE, X.class); s.whose(new Equals("field", value)); s.go();
The entities have to fulfill some requirements before persist.
There is an example:
@Entity public class BasicEntity implements Serializable {
@Id
private Long id;
@Version
private Integer version;
private Boolean active;
public Entidade(){
}
@Override
public boolean equals(Object obj) {
return super.equals(obj);
}
@Override
public int hashCode() {
return super.hashCode();
}
}
Development Environment
Eclipse IvyDE JPA (Hibernate) CDI (Weld) RepositoryJPA
JUnit Mockito HSQLDB
It uses ProjectJPA to execute tests