Added new classes for implementing Spring Data

This commit is contained in:
Tom Vahlman 2012-03-30 15:10:44 +02:00
parent 4e2ec940c0
commit 734d7e2777
3 changed files with 77 additions and 0 deletions
src/main/java/se/su/dsv/scipro/springdata

@ -0,0 +1,19 @@
package se.su.dsv.scipro.springdata.repos;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
/**
* @author: fred-fri
* date: 2012 03 23
*/
@Transactional(readOnly = true)
public interface SupervisorRepo extends JpaRepository<Employee, Long>, QueryDslPredicateExecutor<Employee> {
//nothing here yet
}

@ -0,0 +1,46 @@
package se.su.dsv.scipro.springdata.serviceimpls;
import com.mysema.query.types.expr.BooleanExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.data.dataobjects.Employee;
import se.su.dsv.scipro.data.dataobjects.ProjectClass;
import se.su.dsv.scipro.match.dataobject.Match;
import se.su.dsv.scipro.match.dataobject.ProjectIdea;
import se.su.dsv.scipro.match.dataobject.QProjectIdea;
import se.su.dsv.scipro.springdata.repos.ProjectIdeaRepo;
import se.su.dsv.scipro.springdata.repos.SupervisorRepo;
import se.su.dsv.scipro.springdata.services.ProjectIdeaService;
import se.su.dsv.scipro.springdata.services.SupervisorService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @author: fred-fri
* date: 2012 03 26
*/
@Service ( "supervisorService" )
@Transactional ( readOnly = true )
public class SupervisorServiceImpl extends AbstractQueryService<Employee, Long> implements SupervisorService {
@Resource
private SupervisorRepo supervisorRepo;
@Autowired
public SupervisorServiceImpl(@Qualifier("supervisorRepo") SupervisorRepo supervisorRepo) {
super(supervisorRepo, supervisorRepo);
System.out.println("BLA BLA");
}
@Override
public List<Employee> findAllEmployees() {
List<Employee> employeeList = new ArrayList<Employee>();
return employeeList;
}
}

@ -0,0 +1,12 @@
package se.su.dsv.scipro.springdata.services;
import se.su.dsv.scipro.data.dataobjects.Employee;
import java.util.List;
/**
* @author: fred-fri
* date: 2012 03 26
*/
public interface SupervisorService extends CrudService<Employee,Long>, QueryService<Employee, Long> {
public List<Employee> findAllEmployees();
}