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

Incorrect web links Quarkus Hibernate Reactive Rest Data Panache #38247

Closed
bpasson opened this issue Jan 17, 2024 · 5 comments · Fixed by #38265
Closed

Incorrect web links Quarkus Hibernate Reactive Rest Data Panache #38247

bpasson opened this issue Jan 17, 2024 · 5 comments · Fixed by #38265

Comments

@bpasson
Copy link
Contributor

bpasson commented Jan 17, 2024

Describe the bug

Quarkus Hibernate Reactive Rest Data Panache is providing the incorrect web link self relation urls.

The following snippets taken from the example entities of the reproducer project quarkus-issue-38247 produce incorrect rel=self web links.

@Entity
@Table(name="double_ids")
public class TestRecordOne extends PanacheEntityBase {

    // marked tid as the pk for this object and not the id field to show
    // the LinkProcessor uses the id field to render self link and not the
    // tid value.
    @Id
    @Column(name="tid", columnDefinition = "BIGINT", nullable = false)
    private Long tid;
    @Column(name="id", columnDefinition = "BIGINT", nullable = false)
    private Long id;

    @Column(name="name", columnDefinition = "TEXT", nullable = false)
    private String name;    
    ...
@Entity
@Table(name="annotation_only")
public class TestRecordTwo extends PanacheEntityBase {

    // field not named 'id' to force LinkProcessor to use the @Id annotation
    // which is then not used for the id path param, but stored as tid path param
    // and no value is rendered in the self link.
    @Id
    @Column(name="tid", columnDefinition = "BIGINT", nullable = false)
    private Long tid;
    @Column(name="name", columnDefinition = "TEXT", nullable = false)
    private String name;
   
    ....
}

Expected behavior

When running the ReproducerTest cases the following is expected for each test case:

Actual behavior

When running the ReproducerTest cases the following is actually happening for each test case:

How to Reproduce?

To reproduce this clone https://github.com/bpasson/quarkus-issue-38247 and run ./mvnw clean verify and see the failing testcases.

Output of uname -a or ver

Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "17.0.9" 2023-10-17

Quarkus version or git rev

3.6.6

Build tool (ie. output of mvnw --version or gradlew --version)

maven 3.9.6

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Jan 17, 2024

/cc @DavideD (hibernate-reactive), @FroMage (panache), @gavinking (hibernate-reactive), @geoand (rest-data-panache), @loicmathieu (panache)

@DavideD
Copy link
Contributor

DavideD commented Jan 17, 2024

@bpasson sorry, where is the reproducer?

@bpasson
Copy link
Contributor Author

bpasson commented Jan 17, 2024

@DavideD added it just now, I had to create the issue first to get the number.

@bpasson
Copy link
Contributor Author

bpasson commented Jan 17, 2024

@DavideD I will also open a PR for to fix the issue. Just creating the issue here to have a PR reference it.

@DavideD
Copy link
Contributor

DavideD commented Jan 17, 2024

Ok, thanks.
I guess I checked this too quickly :)

bpasson added a commit to bpasson/quarkus that referenced this issue Jan 17, 2024
bpasson added a commit to bpasson/quarkus that referenced this issue Jan 17, 2024
bpasson added a commit to bpasson/quarkus that referenced this issue Jan 18, 2024
bpasson added a commit to bpasson/quarkus that referenced this issue Jan 18, 2024
bpasson added a commit to bpasson/quarkus that referenced this issue Jan 22, 2024
@quarkus-bot quarkus-bot bot added this to the 3.9 - main milestone Jan 22, 2024
@gsmet gsmet modified the milestones: 3.9 - main, 3.7.0 Jan 23, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants