I'm currently using Quarkus combined with Blaze Persistence for my microservice. I have the following entity model:
@Entity
public class Content extends BaseEntity {
private boolean deleted;
private boolean published;
}
@Entity
public class WebContent extends Content {
private String webpage;
}
I've mapped the entities to the following EntityViews:
@EntityView(Content.class)
@EntityViewInheritance
@CreatableEntityView
@UpdatableEntityView
public interface ContentUpdateView {
@IdMapping
Long getId();
boolean isPublished();
void setPublished(boolean published);
}
@EntityView(WebContent.class)
@CreatableEntityView
@UpdatableEntityView
public interface WebContentUpdateView extends ContentUpdateView {
String getWebpage();
void setWebpage(String webpage);
}
I have the following method in my ContentsResource:
@POST
public ContentUpdateView save(ContentUpdateView content) {
return contentsService.save(content);
}
When I invoke the post operation I only get the base ContentUpdateView and not the WebContentUpdateView. Is there any configuration to do? (with Jackson I use @JsonTypeInfo and @JsonSubType annotation on the entities to accomplish this).
Thanks euks
I got it working using Jackson annotation. Here's the base class:
And here's a subclass:
I'm using abstract classes for other purposes, but it also works with interfaces.