templates.spring_jpa_data_access.st Maven / Gradle / Ivy
package ;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import poussecafe.discovery.DataAccessImplementation;
import poussecafe.spring.jpa.storage.JpaDataAccess;
import poussecafe.spring.jpa.storage.SpringJpaStorage;
import .;
import .DataAccess;
import .Id;
@DataAccessImplementation(
aggregateRoot = .class,
dataImplementation = Attributes.class,
storageName = SpringJpaStorage.NAME
)
public class JpaDataAccess extends JpaDataAccess\<Id, Attributes, String> implements DataAccess\<Attributes> {
@Override
public List\<Attributes> findByName(String name) {
return repository.findByName(name);
}
@Override
protected String convertId(Id key) {
return key.stringValue();
}
@Override
protected DataJpaRepository jpaRepository() {
return repository;
}
@Autowired
private DataJpaRepository repository;
}