@Table(name = "CUBAPROJECT_BANK")
@Entity(name = "cubaproject_Bank")
@NamePattern("%s|label")
public class Bank extends BaseGenericIdEntity<String> {
private static final long serialVersionUID = -6460255337403979003L;
public Bank() {
id = UUID.randomUUID().toString();
}
@Id
@Column(name = "ID", nullable = false)
protected String id;
@Column(name = "CODE", length = 100)
private String code;
@NotNull
@Column(name = "LABEL", nullable = false, length = 100)
private String label;
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}
BankRepository.java
public interface BankRepository extends SimpleCubaJpaRepository<Bank, String> {
@SimpleJpqlQuery("SELECT Count(Bank) FROM cubaproject_Bank Bank")
Long countAll();
@SimpleCubaView("_local")
@SimpleJpqlQuery("SELECT Bank FROM cubaproject_Bank Bank ORDER BY Bank.label ASC")
Bank findFirstByOrderByLabelDesc();
@SimpleCubaView("_local")
@SimpleJpqlQuery("SELECT Bank FROM cubaproject_Bank Bank ORDER BY Bank.label ASC")
List<Bank> findAllByOrderByLabelAsc(Pageable pageable);
@SimpleCubaView("_local")
@SimpleJpqlQuery(value = "SELECT Bank FROM cubaproject_Bank Bank ORDER BY Bank.label ASC",
countQuery = "SELECT Count(Bank) FROM cubaproject_Bank Bank")
Page<Bank> findPageByOrderByLabelAsc(Pageable pageable);
}