Tests added looking into #35
This commit is contained in:
@@ -97,10 +97,7 @@ public class RepositoryAwareJacksonModule extends SimpleModule implements Initia
|
||||
}
|
||||
}
|
||||
|
||||
if(!conversionService.canConvert(domainType, Resource.class)) {
|
||||
// Assign only if no custom converter already assigned
|
||||
conversionService.addConverter(domainType, Resource.class, new EntityToResourceConverter(repoMeta));
|
||||
}
|
||||
conversionService.addConverter(domainType, Resource.class, new EntityToResourceConverter(repoMeta));
|
||||
|
||||
sers.addSerializer(domainType, new DomainObjectToResourceSerializer(domainType));
|
||||
keySers.addSerializer(domainType, new DomainObjectToStringKeySerializer(domainType, repoMeta));
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springframework.data.rest.test.webmvc;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
@Entity
|
||||
public class Child extends Parent {
|
||||
|
||||
private String occupation;
|
||||
|
||||
public Child() {
|
||||
}
|
||||
|
||||
public Child(String name, String occupation) {
|
||||
super(name);
|
||||
this.occupation = occupation;
|
||||
}
|
||||
|
||||
public String getOccupation() {
|
||||
return occupation;
|
||||
}
|
||||
|
||||
public void setOccupation(String occupation) {
|
||||
this.occupation = occupation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.springframework.data.rest.test.webmvc;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public interface ChildRepository extends JpaRepository<Child, Long> {
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.springframework.data.rest.test.webmvc;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public class Parent {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
private String name;
|
||||
|
||||
public Parent() {
|
||||
}
|
||||
|
||||
public Parent(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.springframework.data.rest.test.webmvc;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public interface ParentRepository extends JpaRepository<Parent, Long> {
|
||||
}
|
||||
Reference in New Issue
Block a user