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

Support serialization for property that is an object #1069

Open
NBXXF opened this issue Apr 20, 2022 · 4 comments
Open

Support serialization for property that is an object #1069

NBXXF opened this issue Apr 20, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@NBXXF
Copy link

NBXXF commented Apr 20, 2022

您好,我期望自定义类型 能更好的支持二进制,提高速度,是否可以参考 https://github.com/twitter/Serial
这样更方便的将字段是自定义模型 更快插入和读取

Translation: Hello, I hope that the custom type can better support binary and improve the speed. Can you refer to https://github.com/twitter/Serial
This makes it more convenient to insert and read the field into a custom model faster

@NBXXF NBXXF added the enhancement New feature or request label Apr 20, 2022
@ivahnenkoAnna ivahnenkoAnna changed the title 您好,我期望自定义类型 能更好的支持二进制,提高速度,是否可以参考 https://github.com/twitter/Serial I hope that the custom type can better support binary and improve speed Apr 21, 2022
@ivahnenkoAnna
Copy link
Contributor

Thank you for the feature request. We are looking into this and will reply as soon as possible.

@greenrobot-team
Copy link
Member

You can already store byte arrays in an object, see built-in support for types: https://docs.objectbox.io/advanced/custom-types#objectbox-supported-types

If this is about completely replacing the class model (e.g. classes annotated with @Entity containing fields that are properties) then I don't think this makes sense. ObjectBox already uses a binary format behind the scenes (FlatBuffers) to store objects. Could you elaborate on your idea then?

@greenrobot-team greenrobot-team added the more info required Further information is requested label Apr 25, 2022
@NBXXF
Copy link
Author

NBXXF commented Apr 27, 2022

You can already store byte arrays in an object, see built-in support for types: https://docs.objectbox.io/advanced/custom-types#objectbox-supported-types

If this is about completely replacing the class model (e.g. classes annotated with @Entity containing fields that are properties) then I don't think this makes sense. ObjectBox already uses a binary format behind the scenes (FlatBuffers) to store objects. Could you elaborate on your idea then?

关键性能在于转二进制 以及持久化的二进制如何完整反序列化 不出现兼容字段问题,行业有cryo flatbuffers 等
我的场景是 UserPo.xxxField 是一个对象

Translation: The key performance lies in how to convert the binary and how to completely deserialize the persistent binary without the problem of compatible fields. The industry has cryo flatbuffers, etc. My scenario is UserPo.xxxField is an object

@greenrobot-team greenrobot-team changed the title I hope that the custom type can better support binary and improve speed Support serialization for property that is an object May 2, 2022
@greenrobot-team greenrobot-team removed the more info required Further information is requested label May 2, 2022
@greenrobot-team
Copy link
Member

greenrobot-team commented May 2, 2022

Using the current ObjectBox API this should be solvable in a technology independent way using @Convert and a PropertyConverter that de/serializes objects. https://docs.objectbox.io/advanced/custom-types#convert-annotation-and-property-converter

E.g. you could write a converter that uses https://github.com/twitter/Serial as you suggested.

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

No branches or pull requests

3 participants