Skip to content

Can have BeforeLoad Entity Callback? #1028

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

Open
Ikki-Dai opened this issue Aug 17, 2021 · 1 comment
Open

Can have BeforeLoad Entity Callback? #1028

Ikki-Dai opened this issue Aug 17, 2021 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@Ikki-Dai
Copy link

May I Have BeforeLoad Entity Callback to use encrypt string to query

Now I have AfterLoadCallback to process something about decryption.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 17, 2021
@mp911de mp911de self-assigned this Sep 13, 2021
@schauder schauder added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 21, 2021
@schauder
Copy link
Contributor

The problem is, we don't really have a useful abstraction that we could use in such a callback.
At that stage we are dealing with ResultSet which is way to complex and fiddly for this purpose.
It has multiple ways of accessing a column (by index, by name, with specified type or just as getObject) and it includes traversal controls.

Of course we could wrap it in a simpler interface, but this wouldn't allow actually changing the data since all the other infrastructure works on ResultSet.

What we can do is have an additional AfterLoadWithResultSetCallback(*) interface that will take an entity and a wrapped ResultSet.

If will be called after construction of the entity but allows to extract additional data from the ResultSet
This allows to have custom queries with additional columns that by default don't get used for construction of the entity but maybe used in post processing.

Also #1006 might be of interest to you since it will allow to completely control the construction of entities.

(*) that name is just proposal and will not be the final name. See #1053.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants