jpa work
This commit is contained in:
parent
dbd5616f5a
commit
71a230ef91
|
@ -40,11 +40,7 @@ public class PersistenceConfig {
|
|||
factoryBean.setDataSource(restDataSource());
|
||||
factoryBean.setPackagesToScan(new String[] { "org.baeldung.spring.persistence.model" });
|
||||
|
||||
final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter() {
|
||||
{
|
||||
// JPA properties ...
|
||||
}
|
||||
};
|
||||
final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
||||
factoryBean.setJpaVendorAdapter(vendorAdapter);
|
||||
factoryBean.setJpaProperties(additionalProperties());
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ public class FooDao implements IFooDao {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void update(final Foo entity) {
|
||||
public Foo update(final Foo entity) {
|
||||
Preconditions.checkNotNull(entity);
|
||||
entityManager.merge(entity);
|
||||
return entityManager.merge(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,7 @@ public interface IFooDao {
|
|||
|
||||
void create(Foo entity);
|
||||
|
||||
void update(Foo entity);
|
||||
Foo update(Foo entity);
|
||||
|
||||
void delete(Foo entity);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
|
|||
|
||||
import org.baeldung.spring.persistence.config.PersistenceConfig;
|
||||
import org.baeldung.spring.persistence.model.Foo;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -51,9 +50,8 @@ public class FooServicePersistenceIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public final void temp_whenInvalidEntityIsCreated_thenDataException() {
|
||||
service.create(new Foo(randomAlphabetic(2048)));
|
||||
service.create(new Foo());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue