new owner - child support

This commit is contained in:
eugenp 2013-05-18 17:14:49 +03:00
parent 2035877d58
commit 2bde87bef2
5 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,8 @@
package org.baeldung.spring.persistence.service;
import org.baeldung.spring.persistence.dao.common.IOperations;
import org.baeldung.spring.persistence.model.Child;
public interface IChildService extends IOperations<Child> {
//
}

View File

@ -0,0 +1,8 @@
package org.baeldung.spring.persistence.service;
import org.baeldung.spring.persistence.dao.common.IOperations;
import org.baeldung.spring.persistence.model.Owner;
public interface IOwnerService extends IOperations<Owner> {
//
}

View File

@ -0,0 +1,28 @@
package org.baeldung.spring.persistence.service.impl;
import org.baeldung.spring.persistence.dao.IChildDao;
import org.baeldung.spring.persistence.dao.common.IOperations;
import org.baeldung.spring.persistence.model.Child;
import org.baeldung.spring.persistence.service.IChildService;
import org.baeldung.spring.persistence.service.common.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ChildService extends AbstractService<Child> implements IChildService {
@Autowired
private IChildDao dao;
public ChildService() {
super();
}
// API
@Override
protected IOperations<Child> getDao() {
return dao;
}
}

View File

@ -0,0 +1,28 @@
package org.baeldung.spring.persistence.service.impl;
import org.baeldung.spring.persistence.dao.IOwnerDao;
import org.baeldung.spring.persistence.dao.common.IOperations;
import org.baeldung.spring.persistence.model.Owner;
import org.baeldung.spring.persistence.service.IOwnerService;
import org.baeldung.spring.persistence.service.common.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class OwnerService extends AbstractService<Owner> implements IOwnerService {
@Autowired
private IOwnerDao dao;
public OwnerService() {
super();
}
// API
@Override
protected IOperations<Owner> getDao() {
return dao;
}
}

View File

@ -0,0 +1,28 @@
package org.baeldung.spring.persistence.service;
import org.baeldung.spring.persistence.config.PersistenceConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
public class OwnerServicePersistenceIntegrationTest {
@Autowired
private IOwnerService service;
@Autowired
private IChildService childService;
// tests
@Test
public final void whenContextIsBootstrapped_thenNoExceptions() {
//
}
}