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

Document class not retrieved #8052

Closed
diegomtassis opened this issue Feb 1, 2018 · 3 comments
Closed

Document class not retrieved #8052

diegomtassis opened this issue Feb 1, 2018 · 3 comments

Comments

@diegomtassis
Copy link
Contributor

diegomtassis commented Feb 1, 2018

OrientDB Version: 2.2.31, but I tested with older versions and the behavior is the same.

Java Version: 1.8

OS: Windows, Linux.

Given an empty document database, I repeat the following process several times:

  • Create a document, assigning it to a given class (via the document constructor). new ODocument(RESOURCE_DOCUMENT_CLASS)
  • Save the document. db.save(oDocument)
  • Check that the document returned by the save operation is correct. Its id is recorded to be used later.
  • Retrieve the stored documents, one by one, by using the id.

Expected behavior

Everything correct.

Actual behavior

The document which was saved first, id #3:0, is retrieved successfully, but its class is empty.
The rest of documents are correct. Ids #17:0, #18:0.

If instead of retrieving one by one I do a db.browseClass(RESOURCE_DOCUMENT_CLASS) the first document is not returned.
If I execute a SQL query filtering by document class the result is the same, the first one saved is not returned.

Steps to reproduce

I have several integration tests proving this behavior but they are part of a product so I can not make them public.
I have tested using both Plocal and a in Memory databases, and the result is the same.

May I be doing something wrong?

@luigidellaquila
Copy link
Member

Hi @diegomtassis

it seems a record is saved in the "default" cluster (cluster 3) instead of its own class cluster. Of course this should not happen

The use case you described is pretty basic, but it seems we cannot replicate it, so there must be something else.

Any chance to have a plain junit test (without your application logic) that reproduces it?

Thanks

Luigi

@diegomtassis
Copy link
Contributor Author

It is going to take me some time, but I will try to isolate it in an integration test.

@diegomtassis
Copy link
Contributor Author

diegomtassis commented Feb 15, 2018

Ok, now I know the reason.

I was creating the document inside a transaction, and, as explained in the documentation, the schema can not be changed inside a transaction (the document class does not exist before saving the first document).

That´s fine.
But, why does it exist for the rest of the documents?

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

4 participants