Skip to content

JdbcOperationsSessionRepository lazy deserialization broken #1411

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

Closed
candrews opened this issue May 6, 2019 · 2 comments
Closed

JdbcOperationsSessionRepository lazy deserialization broken #1411

candrews opened this issue May 6, 2019 · 2 comments
Assignees
Labels
in: jdbc status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@candrews
Copy link
Contributor

candrews commented May 6, 2019

The lazy loading work done for #1133 was undone by @vpavic's polish commit b61937d

The key problem is that this working code:

byte[] bytes = lobToBytes(rs, "ATTRIBUTE_BYTES");
session.delegate.setAttribute(attributeName, lazily(() -> deserialize(bytes)));

was changed to:

Object attributeValue = getBlobAsObject(rs, "ATTRIBUTE_BYTES");
session.delegate.setAttribute(attributeName, lazily(() -> attributeValue));

Note that the actual work of deserializing occurs in getBlobAsObject which is done outside of lazily. Also note that nothing is done in lazily - it just returns a value.

getBlobAsObject must be separated into two methods, one to convert the LOB to bytes and that must be done outside of the lazily, and one to deserialize the bytes to an object which must be done in the lazily.

Can b61937d please be reverted?

@vpavic vpavic self-assigned this May 6, 2019
@vpavic vpavic added this to the 2.2.0.M2 milestone May 6, 2019
@vpavic
Copy link
Contributor

vpavic commented May 6, 2019

Thanks for the report @candrews - indeed I mishandled that polish.

Can b61937d please be reverted?

Fixed yes, reverted no, because as stated in the #1133 the PR didn't have any tests.

@vpavic vpavic changed the title Lazy loading broken by polish JdbcOperationsSessionRepository lazy deserialization broken May 6, 2019
@vpavic vpavic closed this as completed in 83e0f4f May 6, 2019
@candrews
Copy link
Contributor Author

candrews commented May 7, 2019

Thank you very much! 👏

@vpavic vpavic added the status: backported An issue that has been backported to maintenance branches label Jun 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jdbc status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants