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

fix some defects in repositories doc #9319

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

NathanQingyangXu
Copy link
Contributor

Hibernate Data is definitively highly interesting to MongoDB Hibernate integration project for it provides a good selling point to compete with Spring Data Mongo (I used to be a lover of Spring Data's method name based query feature, now I found it is not well-founded and technically Hibernate Data is much more powerful and makes more sense).

I found some obvious defects in the doc, though there are some I am not certain of so I left some comments to confirm.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


@hibernate-github-bot
Copy link

hibernate-github-bot bot commented Nov 23, 2024

Thanks for your pull request!

This pull request does not follow the contribution rules. Could you have a look?

❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
    ↳ Offending commits: [4380fa8, ba0fd59, 341d743, fffa998, 99553bd]

› This message was automatically generated.

@@ -16,6 +16,7 @@ public class Book {
@Basic(optional = false)
String title;

@Basic(optional = false)
LocalDate publicationDate;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@gavinking gavinking left a comment

Choose a reason for hiding this comment

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

Thanks Nathan, I have left comments.

@@ -126,7 +126,7 @@ It's always possible to instantiate a repository implementation directly.

[source,java]
----
Library library = new Library_(statelessSession);
Library library = new Library(statelessSession);
Copy link
Member

Choose a reason for hiding this comment

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

Revert this one, please.

@@ -113,7 +113,7 @@ This really isn't as bad as it sounds; overuse of lazy fetching is associated wi
A future release of Jakarta Data will feature repositories backed by Jakarta Persistence stateful persistence contexts, but this functionality did not make the cut for Jakarta Data 1.0.
====

The second big difference is that instead of providing a generic interface like `EntityManager` that's capable of performing persistence operations for any entity class, Jakarta Data requires that each interaction with the database go via a user-written method specific to just one entity type. The method is marked with annotations allowing Hibernate to fill in the method implementation.
The second big difference is that instead of providing a generic interface like `EntityManager` that's capable of performing persistence operations for any entity class, Jakarta Data requires that each interaction with the database goes via a user-written method specific to just one entity type. The method is marked with annotations allowing Hibernate to fill in the method implementation.
Copy link
Member

Choose a reason for hiding this comment

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

@NathanQingyangXu this sentence is correct! English has a subjunctive mood just like Spanish does. Sure, plenty of English speakers don't use it in spoken English, but it's more correct in written English, and I do use it because I guess I read too much.

Here's what ChatGPT says about that sentence:

Yes, the sentence is grammatically correct. It conveys its meaning clearly and follows standard grammar rules. Here's a breakdown:

Subject-Verb Agreement:

The subject "Jakarta Data" correctly agrees with the verb "requires."

Subjunctive Mood:

The clause "that each interaction with the database go via a user-written method" uses the subjunctive mood correctly. The verb "go" (not "goes") is appropriate here because it's expressing a requirement or necessity.

Modifiers:

"Specific to just one entity type" modifies "method" appropriately, and the meaning is clear.
The sentence is well-constructed for a technical or formal context.

If you ask ChatGPT more about the subjunctive mood in English, I'm sure it will explain it to you.

Copy link
Member

Choose a reason for hiding this comment

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

FTR this comes from the same reason you say "if I were ten feet tall" instead of "if I was ten feet tall". Many English speakers will use "was" here, which isn't incorrect, but "were" is more elegant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the detailed explanation. Reverted back.

@@ -60,7 +60,7 @@ annotationProcessor 'org.hibernate.orm:hibernate-processor:7.0.0'

=== Excluding classes from processing

There's three ways to limit the annotation processor to certain classes:
There are three ways to limit the annotation processor to certain classes:
Copy link
Member

Choose a reason for hiding this comment

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

Note that I'm letting you change these because in principle (to a linguistic prescriptivist) "there's three ways" is grammatically "incorrect" in written English. But note that "there's many things" is something that's incredibly common in informal English and this phrase sounds completely correct to a native speaker. I would never ever notice this "mistake" in either written or spoken English.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted back

Copy link
Member

Choose a reason for hiding this comment

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

You didn't have to revert, it was just an observation. I agree it's strictly-speaking incorrect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hehe, then I reverted back the usage of there are .... Also, the changes align with the other two docs (Hiberbate 6 introduction and Hibernate Query Language) I'd made similar changes.

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.

2 participants