This commit is contained in:
eugenp 2013-05-18 15:54:43 +03:00
parent dbd5616f5a
commit 71a230ef91
4 changed files with 5 additions and 11 deletions

View File

@ -40,11 +40,7 @@ public class PersistenceConfig {
factoryBean.setDataSource(restDataSource()); factoryBean.setDataSource(restDataSource());
factoryBean.setPackagesToScan(new String[] { "org.baeldung.spring.persistence.model" }); factoryBean.setPackagesToScan(new String[] { "org.baeldung.spring.persistence.model" });
final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter() { final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
{
// JPA properties ...
}
};
factoryBean.setJpaVendorAdapter(vendorAdapter); factoryBean.setJpaVendorAdapter(vendorAdapter);
factoryBean.setJpaProperties(additionalProperties()); factoryBean.setJpaProperties(additionalProperties());

View File

@ -40,9 +40,9 @@ public class FooDao implements IFooDao {
} }
@Override @Override
public void update(final Foo entity) { public Foo update(final Foo entity) {
Preconditions.checkNotNull(entity); Preconditions.checkNotNull(entity);
entityManager.merge(entity); return entityManager.merge(entity);
} }
@Override @Override

View File

@ -12,7 +12,7 @@ public interface IFooDao {
void create(Foo entity); void create(Foo entity);
void update(Foo entity); Foo update(Foo entity);
void delete(Foo entity); void delete(Foo entity);

View File

@ -4,7 +4,6 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import org.baeldung.spring.persistence.config.PersistenceConfig; import org.baeldung.spring.persistence.config.PersistenceConfig;
import org.baeldung.spring.persistence.model.Foo; import org.baeldung.spring.persistence.model.Foo;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -51,9 +50,8 @@ public class FooServicePersistenceIntegrationTest {
} }
@Test @Test
@Ignore
public final void temp_whenInvalidEntityIsCreated_thenDataException() { public final void temp_whenInvalidEntityIsCreated_thenDataException() {
service.create(new Foo(randomAlphabetic(2048))); service.create(new Foo());
} }
} }