SpringDataRest 和@Lob 属性中的投影问题
Issue with projection in SpringDataRest and @Lob attribute
我有一个实体人:
@Entity
public class Person implements Serializable {
@Id
@GeneratedValue(strategy = AUTO, generator = "PERSON_SEQ")
private Integer idPerson;
private String lastName;
private String firstName;
@Lob
private byte[] picture;
一个存储库
public interface PersonRepository extends PagingAndSortingRepository<Person, Integer> {}
投影
@Projection(name = "picture", types = { Person.class })
public interface ProjectionPicturePerson {
byte[] getPicture();
}
当我使用投影时:..../persons/1?projection=picture
我有这个错误
There was an unexpected error (type=Internal Server Error, status=500).
Could not write content: [B cannot be cast to [Ljava.lang.Object; (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->$Proxy109["picture"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: [B cannot be cast to [Ljava.lang.Object; (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->$Proxy109["picture"])
当我在字符串上使用投影时,例如 lastName 它有效
@Projection(name = "lastName", types = { Person.class })
public interface ProjectionLastName {
String getLastName();
}
当我不使用投影时它也可以工作
jackson 序列化图像属性
Blob 有限制吗?
这是 ProxyProjectionFactory
中的错误。我已经为您提交并修复了 DATACMNS-722 计划在即将发布的服务版本中(下周中)。
我有一个实体人:
@Entity
public class Person implements Serializable {
@Id
@GeneratedValue(strategy = AUTO, generator = "PERSON_SEQ")
private Integer idPerson;
private String lastName;
private String firstName;
@Lob
private byte[] picture;
一个存储库
public interface PersonRepository extends PagingAndSortingRepository<Person, Integer> {}
投影
@Projection(name = "picture", types = { Person.class })
public interface ProjectionPicturePerson {
byte[] getPicture();
}
当我使用投影时:..../persons/1?projection=picture
我有这个错误
There was an unexpected error (type=Internal Server Error, status=500). Could not write content: [B cannot be cast to [Ljava.lang.Object; (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->$Proxy109["picture"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: [B cannot be cast to [Ljava.lang.Object; (through reference chain: org.springframework.data.rest.webmvc.json.["content"]->$Proxy109["picture"])
当我在字符串上使用投影时,例如 lastName 它有效
@Projection(name = "lastName", types = { Person.class })
public interface ProjectionLastName {
String getLastName();
}
当我不使用投影时它也可以工作
jackson 序列化图像属性
Blob 有限制吗?
这是 ProxyProjectionFactory
中的错误。我已经为您提交并修复了 DATACMNS-722 计划在即将发布的服务版本中(下周中)。