-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Abstraction layer over PanacheRepositoryBase #5885
Comments
@issoares can you provides your Quarkus version, the list of features you use (from the qtartup log), your entity and the complete stacktrace please ? |
@loicmathieu project was created using Quarkus website (https://code.quarkus.io/). Quarkus version and features current being loaded:
Stacktrace:
|
The entity: @Entity
@Table(name = "example")
public class ExampleEntity extends AbstractBaseLongEntity {
public String code;
} @MappedSuperclass
public abstract class AbstractBaseLongEntity extends PanacheEntityBase {
/**
* The auto-generated ID field. This field is set by Hibernate ORM when this entity
* is persisted.
*
* @see #persist()
*/
@Id
@GeneratedValue
public Long id;
@Override
public String toString() {
return this.getClass().getSimpleName() + "<" + id + ">";
}
} |
Note that you But I tested the same aproach and it works. The |
I don't have a and I don't see anything special in the application properties:
Have you had the chance to try the project I uploaded? |
Problem is "created" on
Then errors occurs when have a repository that extends the class above:
...But if repository implements
|
I was misleading you, you should be able to use a Repository with an Entity. |
@loicmathieu Thanks! you're right. I was using both....my mistake.
|
Perhaps it's due to a generics issue not being properly instantiated. I guess we should look at the generated bytecode for |
Yeah, it looks like we're generating |
Yeah, it looks worse, the public long count(java.lang.String, io.quarkus.panache.common.Parameters);
descriptor: (Ljava/lang/String;Lio/quarkus/panache/common/Parameters;)J
flags: ACC_PUBLIC, ACC_SYNTHETIC
Code:
stack=3, locals=3, args_size=3
0: ldc #23 // class java/lang/Object
2: aload 1
4: aload 2
6: invokestatic #38 // Method io/quarkus/hibernate/orm/panache/runtime/JpaOperations.count:(Ljava/lang/Class;Ljava/lang/String;Lio/quarkus/panache/common/Parameters;)J
9: lreturn |
Do not enhance generic/abstract repos Use proper generics resolution when looking up the repository type arguments
Fix is at #6191 |
Fix #5885: generics break panache repo enhancer
Fixed. |
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: rename all this stuff fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide
fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide Apply suggestions from code review Co-Authored-By: Guillaume Smet <guillaume.smet@gmail.com>
fix: improve test - Use @MongoEntity - Better SSE test feat: optional support chore: move to axle package Merge reactive and blocking API into the same module fix bug quarkusio#5885 for Axle Remove the deleted reactive extension stage from the CI Documentation guide Apply suggestions from code review Co-Authored-By: Guillaume Smet <guillaume.smet@gmail.com>
Describe the bug
When implementing an abstraction over the PanacheRepositoryBase, I get the error when calling findById method:
org.hibernate.UnknownEntityTypeException: Unable to locate persister: org.acme.base.AbstractBaseLongEntity
Expected behavior
findById() should work when using an Abstraction layer, as findAll() just works.
Actual behavior
(Describe the actual behavior clearly and concisely.)
To Reproduce
Steps to reproduce the behavior:
Additional context
1.Calling the endpoint that uses findAll() works fine: http://0.0.0.0:8080/example
2. If you edit ExampleRepository.java and swap the lines indicated there, both endpoints will work.
The text was updated successfully, but these errors were encountered: