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

Wrong value saved in EMBEDDED #10391

Open
adriancoca opened this issue Jan 22, 2025 · 7 comments
Open

Wrong value saved in EMBEDDED #10391

adriancoca opened this issue Jan 22, 2025 · 7 comments

Comments

@adriancoca
Copy link

OrientDB Version: 3.2.22
Java Version: 8
OS: linux docker

Hello
When creating or updating a vertex the saved value of producedQuantity is 35.927673

create vertex package set data={"@type":"d",producedQuantity: 35.927675, numberOfPackages: 1}

Image

Update

Image

I am not sure if we are doing something wrong or is a conversion issue that can be solved.

@tglman
Copy link
Member

tglman commented Jan 27, 2025

Hi,

This looks like some float/double rounding, what is the type of producedQuantity ?

OrientDB support also decimal type that is based on java BigDecimal is a bit more heavy in the implementation but it keep the precision.

@adriancoca
Copy link
Author

Vertex package have a property defined as below (data ). I don't think I can set the type on key producedQuantity .

Image

@tglman
Copy link
Member

tglman commented Jan 28, 2025

Hi,

You can set the type of that creating another class (preferably abstract) and used it as a linked_class of the of the data property, than the property of the embedded class should match the type of the linked class

@adriancoca
Copy link
Author

Hello again,

I tried create vertex packagetest set data2={"@type":"d",producedQuantity: 35.927675} but I receive the message

com.orientechnologies.orient.core.exception.OValidationException: The field 'PackageTest.data2' has been declared as EMBEDDED with linked class 'PackageDetail2' but the record is of class 'PackageDetail2' that is vertex class DB name="testcarettavineri" Error Code="4"
Also I tried with PackageDetail Abstract and the error is
com.orientechnologies.orient.core.exception.OSchemaException: Cannot create a document of the abstract class 'PackageDetail' DB name="testcarettavineri"

Image

Image

@tglman
Copy link
Member

tglman commented Jan 30, 2025

Hi,

It sounds like that PackageDetail2 extends V it shouln't

@adriancoca
Copy link
Author

adriancoca commented Jan 30, 2025

Created PackageDetail3 - CREATE CLASS PackageDetail3 ABSTRACT
Image

Image

create vertex packagetest set data={"@type":"d",producedQuantity: 35.927675}

com.orientechnologies.orient.core.exception.OSchemaException: Cannot create a document of the abstract class 'PackageDetail3' DB name="testcarettavineri"

I tried after (maybe error helps)
CREATE PROPERTY Packagetest.quantity EMBEDDED Packagedetail3

com.orientechnologies.orient.core.exception.OValidationException: The field 'PackageTest.data' has been declared as EMBEDDED with linked class 'PackageDetail3' but the record has no class DB name="testcarettavineri" Error Code="4"

LE:

Created Generic Class, not abstract

Image

Image

@adriancoca
Copy link
Author

Even simpler, added quantitystore on main vertex DECIMAL

Image

Image

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

No branches or pull requests

2 participants