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

Cannot reuse class extending PanacheMongoEntity #40367

Open
floka94 opened this issue Apr 30, 2024 · 2 comments
Open

Cannot reuse class extending PanacheMongoEntity #40367

floka94 opened this issue Apr 30, 2024 · 2 comments
Labels

Comments

@floka94
Copy link

floka94 commented Apr 30, 2024

Describe the bug

I have a BaseReport extending PanacheMongoEntity. Then a subclass TankReport extends BaseReport. BaseReport has additional Properties.

@MongoEntity(collection = "Report")
public class BaseReport extends PanacheMongoEntity{
    public LocalDateTime createdAt;
    public String reportKey;

    public static <T extends BaseReport> List<T> listAllByReportKey(String reportKey) {
        return T.list("reportKey = ?1", Sort.by("createdAt", Sort.Direction.Descending), reportKey);
    }

}

@MongoEntity(collection = "Report")
public class TankReport extends BaseReport {
    public String tankName;
}

If i run TankReport.listAllByReportKey("tankReport") I get Reports WITHOUT the additional property "tankName".

Expected behavior

If I run TankReport.listAllByReportKey("tankReport"), I get Documents with the additional properties.

Actual behavior

If i run TankReport.listAllByReportKey("tankReport") I get Reports WITHOUT the additional property "tankName".

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.9.3

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

No response

Additional information

No response

@floka94 floka94 added the kind/bug Something isn't working label Apr 30, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 30, 2024

/cc @FroMage (panache), @loicmathieu (mongodb,panache)

@floka94 floka94 changed the title Cannot reuse abstract class extending PanacheMongoEntityBase Cannot reuse abstract class extending PanacheMongoEntity Apr 30, 2024
@floka94 floka94 changed the title Cannot reuse abstract class extending PanacheMongoEntity Cannot reuse class extending PanacheMongoEntity Apr 30, 2024
@floka94
Copy link
Author

floka94 commented Apr 30, 2024

I also tried to make BaseReport abstract and the Subclasses have to implement the Methods. But that didn´t work neither.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant