Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JPA不推荐使用List<Map<String,Object>>作为响应结果 #53

Open
zhangzhenhuajack opened this issue Aug 26, 2022 · 2 comments
Open

Comments

@zhangzhenhuajack
Copy link
Owner

1: 不够结构化,完全不知道里面是什么;
2:可能引起其它bug

@zhangzhenhuajack
Copy link
Owner Author

老铁们,写自定义QSL的时候,如果不写后面的as xxx,会报JSON NULL无法转换,与字段内容无关,字段都是有值的,是少写了什么东西吗
image

Map的key为NULL所以报错,打印了一下,确实都是NULL,本意是想把字段名当成key,字段值当成value。

如果加了as xxx就没问题

Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: java.util.ArrayList[0]->org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap["null"])]

@zhangzhenhuajack
Copy link
Owner Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant