Open
Conversation
Contributor
|
Bump - can we get this merged in - is anything blocking it? (well, apart from the conflict now on PojoMetadata - that wasnt there when we submitted the PR) |
Owner
|
Sorry for replying to this so late. Is there a specific reason why you can't remove the column from the query? |
Author
|
It's been quite a while since I logged that ticket so I don't really recall
the reasoning behind it. There was a reason though! If I had to guess it
was likely so that I could issue a simple select * and ignore some columns
for making the loading easier. I believe I implemented this in our local
copy of sql2o but I'd have to load the repo to see what changes we made.
…On Sat, Apr 13, 2024, 06:31 Lars Aaberg ***@***.***> wrote:
Sorry for replying to this so late. Is there a specific reason why you
can't remove the column from the query?
—
Reply to this email directly, view it on GitHub
<#273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUCWLYOGORDXSAM4EJSKI3Y5ECRTAVCNFSM4DGYDFUKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBVGM3DANJWGU3Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Owner
|
Thanks. You are right; there is a use case here, although it is debatable if fetching columns that won't be used is good practice. I am thinking that maybe the existing columnMappings can be expanded to incorporate this feature instead, which I believe will result in a better API. |
Author
|
I think we considered that approach but found the simpler select * easier
to leverage - again, its been several years and I dont recall the specifics
anymore.
I just took a look at the project where we used this - we used this a lot.
The pattern was to "select * from table" via a
Queryu.creaqteQueryWithParams()
then leverage the automatic bean mapping to construct a domain entity in
code via the query.executeAndFetch( DomainClass.class );
Im assuming (again, its been a while) that if we didnt ignore some fields,
that the auto mapping would fail due to unmapped columns. We like the
control of excluding specific fields - this way if new fields were added to
the schema and we didnt update the code, then stuff would break (I think)
Reading the code now after all these years I can clearly see whats going
on, what we're loading and what we expect to be in the DB vs what we need
to construct the domain entities in memory. It does seem to be query
specific.
Nick
…On Sat, Apr 13, 2024 at 7:20 AM Lars Aaberg ***@***.***> wrote:
Thanks. You are right; there is a use case here, although it is debatable
if fetching columns that won't be used is good practice. I am thinking that
maybe the existing columnMappings can be expanded to incorporate this
feature instead, which I believe will result in a better API.
—
Reply to this email directly, view it on GitHub
<#273 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUCWL7S6E6V56R7AX4IKX3Y5EIHDAVCNFSM4DGYDFUKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBVGM3DCNZVG42A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ability to ignore specific fields when mapping POJOs. The blanket "ignore mapping exceptions" option that was added actually hid defects since primitive values in the POJO were being initialized with incorrect values