Katharsis and JPA Annotations

330 Views Asked by At

Using Katharsis in our SpringBoot Application with JPA requires to annotate JPA's @OneToMany relationships with @JsonApiToMany and similarly @ManyToOne with @JsonApiToOne. I am wondering if there is any way to avoid this duplicate annotations? Is there any easier way to integrate Katharsis in SpringBoot + JPA Applications?

2

There are 2 best solutions below

1
jklee On

You can build you own stereotype annotation, by example

@Target({ElementType.FIELD, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@JsonApiToMany
@OneToMany
public @interface CustomOneToMany{

    // ....
}

Meta-annotations

0
Christian Bongiorno On

There is actually a Katharsis JPA module that you should have a look at