Skip to content

Serialization of predicates#1065

Merged
Shredder121 merged 6 commits into
masterfrom
i1062
Dec 5, 2014
Merged

Serialization of predicates#1065
Shredder121 merged 6 commits into
masterfrom
i1062

Conversation

@timowest
Copy link
Copy Markdown
Member

Fixes #1062

@Shredder121
Copy link
Copy Markdown
Member

@timowest would it help to make hashCode transient, and fill it with readObject()?
That way it doesn't get serialized, and you can ensure that the hashcode came from the current running JVM(so that it is consistent across the lifecycle), and not from the serialized form.
Of course, this will break existing serialized forms, so we'll have to think about this carefully.

@timowest
Copy link
Copy Markdown
Member Author

timowest commented Dec 1, 2014

Yes, I am doing that right now.

@Shredder121
Copy link
Copy Markdown
Member

It would only make sense, since it is not a significant state value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a duplicate test case, that's why I removed it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right, and that's fine.

@timowest
Copy link
Copy Markdown
Member Author

timowest commented Dec 1, 2014

I haven't yet tested with multiple JVMs, but I could alter the hashCode values via reflection and make sure that they are properly reset via deserialization.

@Shredder121
Copy link
Copy Markdown
Member

I am already testing with multiple JVMs, and can at least see that the fields are correctly restored.
I am now resetting to before the fixes to compare the behavior, but it looks good.

@Shredder121
Copy link
Copy Markdown
Member

There are no cats in the database, do you see the same?
This makes the build fail.
Speaking of failing builds, Travis seems to be down.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the mixin has the hashCode cached, so this should cause only a minimal performance penalty, but makes the deserialization easier.

@timowest timowest removed the progress label Dec 2, 2014
@Shredder121
Copy link
Copy Markdown
Member

Looks good, I also deserialized the predicate in a seperate VM and it works.
Nicely done Timo!

@Shredder121
Copy link
Copy Markdown
Member

Seeing as the build succeeds, I will merge this.

Shredder121 added a commit that referenced this pull request Dec 5, 2014
Serialization of predicates
@Shredder121 Shredder121 merged commit 0640aa1 into master Dec 5, 2014
@Shredder121 Shredder121 deleted the i1062 branch December 5, 2014 15:05
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

Successfully merging this pull request may close these issues.

Support serialization of any() paths in Querydsl JPA

2 participants