Skip to content

Commit

Permalink
#40 - Upgraded to Gosling release train.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Igler authored and odrotbohm committed Oct 29, 2015
1 parent ed21282 commit e8776ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -59,7 +59,7 @@

<properties>
<spring.version>4.0.9.RELEASE</spring.version>
<spring.data.jpa.version>1.8.0.RELEASE</spring.data.jpa.version>
<spring.data.jpa.version>1.9.0.RELEASE</spring.data.jpa.version>
<slf4j.version>1.7.10</slf4j.version>
<file.encoding>UTF-8</file.encoding>
</properties>
Expand Down
Expand Up @@ -25,7 +25,7 @@
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
import org.springframework.data.repository.history.RevisionRepository;
Expand All @@ -35,6 +35,7 @@
* {@link FactoryBean} creating {@link RevisionRepository} instances.
*
* @author Oliver Gierke
* @author Michael Igler
*/
public class EnversRevisionRepositoryFactoryBean extends
JpaRepositoryFactoryBean<EnversRevisionRepository<Object, Serializable, Long>, Object, Serializable> {
Expand Down Expand Up @@ -64,9 +65,10 @@ protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityM
*
* @author Oliver Gierke
*/
private static class RevisionRepositoryFactory extends JpaRepositoryFactory {
private static class RevisionRepositoryFactory<T, ID extends Serializable, N extends Number & Comparable<N>> extends JpaRepositoryFactory {

private final RevisionEntityInformation revisionEntityInformation;
private final EntityManager entityManager;

/**
* Creates a new {@link RevisionRepositoryFactory} using the given {@link EntityManager} and revision entity class.
Expand All @@ -77,6 +79,7 @@ private static class RevisionRepositoryFactory extends JpaRepositoryFactory {
public RevisionRepositoryFactory(EntityManager entityManager, Class<?> revisionEntityClass) {

super(entityManager);
this.entityManager = entityManager;
revisionEntityClass = revisionEntityClass == null ? DefaultRevisionEntity.class : revisionEntityClass;
this.revisionEntityInformation = DefaultRevisionEntity.class.equals(revisionEntityClass) ? new DefaultRevisionEntityInformation()
: new ReflectionRevisionEntityInformation(revisionEntityClass);
Expand All @@ -88,12 +91,11 @@ public RevisionRepositoryFactory(EntityManager entityManager, Class<?> revisionE
*/
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected <T, ID extends Serializable> SimpleJpaRepository<?, ?> getTargetRepository(RepositoryMetadata metadata,
EntityManager entityManager) {
protected EnversRevisionRepositoryImpl getTargetRepository(RepositoryInformation information) {

JpaEntityInformation<T, Serializable> entityInformation = (JpaEntityInformation<T, Serializable>) getEntityInformation(metadata
.getDomainType());
return new EnversRevisionRepositoryImpl(entityInformation, revisionEntityInformation, entityManager);
JpaEntityInformation<T, Serializable> entityInformation = (JpaEntityInformation<T, Serializable>) getEntityInformation(information.getDomainType());

return new EnversRevisionRepositoryImpl<T, ID, N>(entityInformation , revisionEntityInformation, entityManager);
}

/*
Expand Down

0 comments on commit e8776ca

Please sign in to comment.