0

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?

ninux
  • 31
  • 2

2 Answers2

0

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

jklee
  • 2,198
  • 2
  • 15
  • 25
  • I guess ManyToOne and JsonApiToMany wont let me create meta-annotation -@Target({METHOD, FIELD}) -@Retention(RUNTIME) public -@interface ManyToOne { – ninux Mar 29 '17 at 16:29
0

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

Christian Bongiorno
  • 5,150
  • 3
  • 38
  • 76