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

Hibernate panache codestart #21651

Merged
merged 2 commits into from
Jan 2, 2023

Conversation

loicmathieu
Copy link
Contributor

No description provided.

@loicmathieu loicmathieu requested a review from ia3andy November 23, 2021 17:32
@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/panache labels Nov 23, 2021
@ia3andy ia3andy changed the title Hibernate panache quickstart Hibernate panache codestart Nov 24, 2021
@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from 7d3fb37 to 6cbfe22 Compare November 24, 2021 14:02
@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch 4 times, most recently from dd18377 to 0763a08 Compare December 10, 2021 18:06
@loicmathieu
Copy link
Contributor Author

@ia3andy I merged the codestarts

@quarkus-bot
Copy link

quarkus-bot bot commented Dec 10, 2021

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building 0763a08

Status Name Step Failures Logs Raw logs
Devtools Tests - JDK 11 Build Failures Logs Raw logs
Devtools Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs
Devtools Tests - JDK 17 Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Devtools Tests - JDK 11 #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.HibernateOrmPanacheCodestartTest.testContent line 23 - More details - Source on GitHub

java.lang.AssertionError: 
[Snapshot is not matching (use -Dsnap to udpate it automatically): HibernateOrmPanacheCodestartTest/testContent/src_main_java_ilove_quark_us_MyEntity.java] 
Path:

io.quarkus.devtools.codestarts.quarkus.HibernateOrmPanacheKotlinCodestartTest.testContent line 23 - More details - Source on GitHub

java.lang.AssertionError: 
[Snapshot is not matching (use -Dsnap to udpate it automatically): HibernateOrmPanacheKotlinCodestartTest/testContent/src_main_kotlin_ilove_quark_us_MyKotlinEntity.kt] 
Path:

⚙️ Devtools Tests - JDK 17 #

- Failing: integration-tests/devtools 

📦 integration-tests/devtools

io.quarkus.devtools.codestarts.quarkus.HibernateOrmPanacheCodestartTest.testContent line 23 - More details - Source on GitHub

java.lang.AssertionError: 
[Snapshot is not matching (use -Dsnap to udpate it automatically): HibernateOrmPanacheCodestartTest/testContent/src_main_java_ilove_quark_us_MyEntity.java] 
Path:

io.quarkus.devtools.codestarts.quarkus.HibernateOrmPanacheKotlinCodestartTest.testContent line 23 - More details - Source on GitHub

java.lang.AssertionError: 
[Snapshot is not matching (use -Dsnap to udpate it automatically): HibernateOrmPanacheKotlinCodestartTest/testContent/src_main_kotlin_ilove_quark_us_MyKotlinEntity.kt] 
Path:

@loicmathieu loicmathieu requested a review from Sanne January 4, 2022 11:30
@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from 0763a08 to e974f1f Compare January 4, 2022 12:10
@quarkus-bot
Copy link

quarkus-bot bot commented Jan 4, 2022

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building e974f1f

Status Name Step Failures Logs Raw logs
Native Tests - gRPC Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Native Tests - gRPC #

- Failing: integration-tests/grpc-mutual-auth integration-tests/grpc-plain-text-mutiny 

📦 integration-tests/grpc-mutual-auth

io.quarkus.grpc.examples.hello.HelloWorldMutualTlsEndpointIT.testHelloWorldServiceUsingBlockingStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldMutualTlsEndpointIT.testHelloWorldServiceUsingMutinyStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldMutualTlsServiceIT.testHelloWorldServiceUsingBlockingStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldMutualTlsServiceIT.testHelloWorldServiceUsingMutinyStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

📦 integration-tests/grpc-plain-text-mutiny

io.quarkus.grpc.examples.hello.HelloWorldEndpointIT.shouldSetHeader - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldEndpointIT.shouldSetHeaderWithMutiny - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldEndpointIT.shouldSetHeaderWithInterface - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldEndpointIT.testHelloWorldServiceUsingBlockingStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldEndpointIT.testHelloWorldServiceUsingMutinyStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldServiceIT.shouldSetHeader - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldServiceIT.shouldSetHeaderWithMutiny - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldServiceIT.shouldSetHeaderWithInterface - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldServiceIT.testHelloWorldServiceUsingBlockingStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

io.quarkus.grpc.examples.hello.HelloWorldServiceIT.testHelloWorldServiceUsingMutinyStub - More details - Source on GitHub

java.net.SocketTimeoutException: Read timed out
	at java.base/java.net.SocketInputStream.socketRead0(Native Method)
	at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)

@Sanne
Copy link
Member

Sanne commented Jan 6, 2022

Is there any particular reason for the non-panache entity to use getters+setters while the Panache version uses filed instrumentation?

Unless I'm missing something, it would be nice to showcase that both approaches can be used without the "ceremonial" getters and setters overhead.

@loicmathieu
Copy link
Contributor Author

@Sanne I was thinking that the field enhancement was a Panache thing, if you look at the Hibernate ORM guide it shows a regular JPA entity: https://quarkus.io/guides/hibernate-orm#setting-up-and-configuring-hibernate-orm

I was thinking the bytecode transformer to transform field access to accesor was this one: https://github.com/quarkusio/quarkus/blob/main/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheFieldAccessMethodVisitor.java

But maybe I'm missing something ?

@Sanne
Copy link
Member

Sanne commented Jan 6, 2022

@loicmathieu no it's an Hibernate ORM thing, Panache only adds additional capabilities to it

@loicmathieu
Copy link
Contributor Author

@Sanne it should be documented then :), as on the Panache guide it is said that it's a Panache feature (see point 2): https://quarkus.io/guides/hibernate-orm-panache#how-and-why-we-simplify-hibernate-orm-mappings

I'll update the quickstart.

@Sanne
Copy link
Member

Sanne commented Jan 6, 2022

@Sanne it should be documented then :), as on the Panache guide it is said that it's a Panache feature (see point 2): https://quarkus.io/guides/hibernate-orm-panache#how-and-why-we-simplify-hibernate-orm-mappings

I'll update the quickstart.

ah good point - yes I see what you mean. To be clear the Panache doc isn't entirely wrong, as when using Panache the getters/setters are added by Panache - but the doc is indeed misleading as ORM "alone" would do the same.

@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from a41c9e6 to 097b872 Compare January 11, 2022 13:03
@loicmathieu
Copy link
Contributor Author

@Sanne I updated the Hibernate ORM with public fields instead of getters§setters

@quarkus-bot

This comment has been minimized.

gsmet
gsmet previously requested changes Jan 12, 2022
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

This shouldn't be merged until we figure out #22773 .

@yrodiere
Copy link
Member

yrodiere commented Nov 4, 2022

I closed #22773 as not planned. @loicmathieu can you please rebase your PR? Thanks.

@FroMage
Copy link
Member

FroMage commented Nov 4, 2022

ah good point - yes I see what you mean. To be clear the Panache doc isn't entirely wrong, as when using Panache the getters/setters are added by Panache - but the doc is indeed misleading as ORM "alone" would do the same.

@Sanne is it really the case? I remember from years ago that the bytecode enhancer for field accesses wasn't enabled for Hibernate without Panache. The getters are generated alright, but nothing is there in Quarkus to rewrite the field accesses from outside the entity. Only Panache does that AFAIR.

@Sanne
Copy link
Member

Sanne commented Nov 4, 2022

@FroMage it's called extended enhancement in Hibernate ORM, it's disabled by default but you could enable it to let it do it for you.

https://github.com/hibernate/hibernate-orm/blob/674b1dfd271a940b91038a7e5f72a3f381697e75/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java#L81-L89

@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from 097b872 to f86e5bb Compare November 9, 2022 11:00
@loicmathieu
Copy link
Contributor Author

@yrodiere I rebased the PR.

@Sanne so public fields rewritting is enabled by default for Quarkus or not ? I upgrade the codestart for Hibernate ORM to use public fields.

@yrodiere
Copy link
Member

yrodiere commented Nov 9, 2022

@Sanne so public fields rewritting is enabled by default for Quarkus or not ?

It is. I worked on that.

ia3andy
ia3andy previously requested changes Nov 9, 2022
Copy link
Contributor

@ia3andy ia3andy left a comment

Choose a reason for hiding this comment

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

Looking good

@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from 771e3c5 to b57455d Compare November 9, 2022 14:04
@quarkus-bot

This comment has been minimized.

@loicmathieu loicmathieu force-pushed the hibernate-panache-quickstart branch from b57455d to 613a05a Compare November 9, 2022 16:29
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 9, 2022

Failing Jobs - Building 613a05a

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 17 MacOS M1 Build Failures Logs Raw logs
✔️ JVM Tests - JDK 18
✔️ Maven Tests - JDK 11
Maven Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ JVM Tests - JDK 17 MacOS M1 #

- Failing: integration-tests/mailer integration-tests/smallrye-opentracing 

📦 integration-tests/mailer

io.quarkus.it.mailer.MailerTest.sendHtmlEmail - More details - Source on GitHub

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:625)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:696)

📦 integration-tests/smallrye-opentracing

io.quarkus.it.opentracing.OpenTracingTestCase. line 35 - More details - Source on GitHub

java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
	at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:256)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)

@loicmathieu loicmathieu requested review from ia3andy and gsmet November 10, 2022 08:58
@loicmathieu
Copy link
Contributor Author

@yrodiere PR is updated and all test pass, can you approve it ?

@loicmathieu loicmathieu added triage/flaky-test and removed triage/on-ice Frozen until external concerns are resolved labels Nov 10, 2022
@loicmathieu loicmathieu requested a review from yrodiere December 16, 2022 10:10
@yrodiere
Copy link
Member

@loicmathieu sorry, I was on leave. Will have a look ASAP.

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

I wasn't able to test this locally (can't seem to use codestarts from a locally-built Quarkus). But the code looks good, so I'll just trust the tests :)

@yrodiere yrodiere dismissed ia3andy’s stale review January 2, 2023 13:44

Suggestion was applied (AFAICS)

@yrodiere yrodiere merged commit dfc0b63 into quarkusio:main Jan 2, 2023
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Jan 2, 2023
@loicmathieu loicmathieu deleted the hibernate-panache-quickstart branch January 2, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/panache triage/flaky-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants