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

docs: Hibernate sample #373

Merged
merged 31 commits into from
Nov 24, 2022
Merged

docs: Hibernate sample #373

merged 31 commits into from
Nov 24, 2022

Conversation

olavloite
Copy link
Collaborator

@olavloite olavloite commented Oct 4, 2022

Hibernate Sample which depicts how hibernate can be implemented with PgAdpter. It also contains the README file detailing the limitation of Hibernate.
Integration test for Hibernate is also added.

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #373 (a8b9e85) into postgresql-dialect (6ef7240) will increase coverage by 1.37%.
The diff coverage is 96.09%.

@@                   Coverage Diff                    @@
##             postgresql-dialect     #373      +/-   ##
========================================================
+ Coverage                 86.32%   87.70%   +1.37%     
- Complexity                 1914     2049     +135     
========================================================
  Files                       122      123       +1     
  Lines                      6216     6799     +583     
  Branches                    849      972     +123     
========================================================
+ Hits                       5366     5963     +597     
+ Misses                      605      587      -18     
- Partials                    245      249       +4     
Flag Coverage Δ
all_tests 87.70% <96.09%> (+1.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ud/spanner/pgadapter/utils/ClientAutoDetector.java 93.18% <ø> (ø)
...e/cloud/spanner/pgadapter/utils/PgJdbcCatalog.java 0.00% <ø> (ø)
...panner/pgadapter/wireprotocol/DescribeMessage.java 86.11% <66.66%> (ø)
.../cloud/spanner/pgadapter/utils/MutationWriter.java 92.09% <69.23%> (+1.70%) ⬆️
...gle/cloud/spanner/pgadapter/error/PGException.java 90.62% <85.71%> (+0.96%) ⬆️
...oud/spanner/pgadapter/parsers/TimestampParser.java 91.78% <90.90%> (-1.44%) ⬇️
...oud/spanner/pgadapter/statements/SimpleParser.java 91.98% <91.57%> (+0.64%) ⬆️
...panner/pgadapter/statements/BackendConnection.java 92.09% <95.23%> (+1.56%) ⬆️
...ud/spanner/pgadapter/statements/CopyStatement.java 94.78% <96.87%> (+9.93%) ⬆️
.../spanner/pgadapter/statements/CopyToStatement.java 99.04% <98.36%> (+3.88%) ⬆️
... and 44 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

list = query.list();
System.out.println("Singers list size with first result: " + list.size());

/* Current Limit is not supported. */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Marked this as not supported as the change is not published in PROD. Will update this when the change is published

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ack

@pratickchokhani pratickchokhani marked this pull request as ready for review November 3, 2022 12:12
Copy link
Collaborator Author

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

The tests seem to get stuck somewhere. How long does it take to run the Hibernate test for you locally?

samples/java/hibernate/README.md Outdated Show resolved Hide resolved
samples/java/hibernate/README.md Outdated Show resolved Hide resolved
samples/java/hibernate/README.md Outdated Show resolved Hide resolved
samples/java/hibernate/README.md Outdated Show resolved Hide resolved
samples/java/hibernate/README.md Outdated Show resolved Hide resolved
@Entity
public class Tracks {

@EmbeddedId private TracksId id;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it would be good to add a comment here that explains what we are doing to model an interleaved table.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not specific to interleaved table. It will have to be done for every composite primary key. Which is standard across hibernate

import javax.persistence.Embeddable;

@Embeddable
public class TracksId implements Serializable {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also here: I think it would be good to add a small comment on why we are creating this embeddable ID.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done

}
}

// Write liquibase.properties
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do a search-and-replace liquibase -> Hibernate ;-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Done

pratickchokhani and others added 9 commits November 5, 2022 11:48
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
Co-authored-by: Knut Olav Løite <koloite@gmail.com>
…ibernateTest.java

Co-authored-by: Knut Olav Løite <koloite@gmail.com>
2. Copyrights added
3. Nit fixes
Copy link
Collaborator Author

@olavloite olavloite left a comment

Choose a reason for hiding this comment

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

LGTM

@olavloite olavloite changed the title docs: [WIP] Hibernate sample docs: Hibernate sample Nov 24, 2022
@pratickchokhani pratickchokhani merged commit 7125c91 into postgresql-dialect Nov 24, 2022
@pratickchokhani pratickchokhani deleted the hibernate-sample branch November 24, 2022 14:57
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.

None yet

2 participants