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

实体特殊属性名导致的序列化失败问题仍然没有彻底解决 #752

Open
sunshio opened this issue Nov 4, 2024 · 5 comments

Comments

@sunshio
Copy link
Contributor

sunshio commented Nov 4, 2024

版本:0.9.10

image
image

Exception in thread "main" java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: There is no jimmer property for public final java.lang.String org.babyfish.jimmer.sql.example.model.BookDraft$Producer$Implementor.getISApp()
at org.babyfish.jimmer.ImmutableObjects.toString(ImmutableObjects.java:365)
at org.babyfish.jimmer.sql.example.model.BookDraft$Producer$Impl.toString(BookDraft.java:924)
at java.base/java.lang.String.valueOf(String.java:4507)
at java.base/java.io.PrintStream.println(PrintStream.java:1187)
at org.babyfish.jimmer.sql.example.App.main(App.java:34)
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: There is no jimmer property for public final java.lang.String org.babyfish.jimmer.sql.example.model.BookDraft$Producer$Implementor.getISApp()
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1300)
at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1447)
at com.fasterxml.jackson.databind.SerializerProvider.findValueSerializer(SerializerProvider.java:544)
at com.fasterxml.jackson.databind.SerializerProvider.findTypedValueSerializer(SerializerProvider.java:822)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:308)
at com.fasterxml.jackson.databind.ObjectMapper._writeValueAndClose(ObjectMapper.java:4568)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3821)
at org.babyfish.jimmer.ImmutableObjects.toString(ImmutableObjects.java:363)
... 4 more

@babyfish-ct
Copy link
Owner

babyfish-ct commented Nov 4, 2024

这类“BUG”的修复,无外乎就一个把下限放多低的问题。好奇为什么要违背Java的规则呢?

@sunshio
Copy link
Contributor Author

sunshio commented Nov 4, 2024

我也好奇为什么要通过getter方法反推属性名是什么,不能直接维护原始属性名吗

@sunshio
Copy link
Contributor Author

sunshio commented Nov 4, 2024

这个主要不是我需要把属性定义成这个样子,而是我认为,通过getter方法反推属性名的做法似乎不妥,java的pojo,record,难道会有此类问题?

@sunshio
Copy link
Contributor Author

sunshio commented Nov 4, 2024

实测,pojo会有类似问题,record不会,我已了解,不再纠结此类问题

@SWQXDBA
Copy link

SWQXDBA commented Nov 5, 2024

java中属性的前两个字符不要大写
纠结为什么没意义,是生态的问题。
很多框架对pojo的解析千奇百怪。

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

3 participants