elide icon indicating copy to clipboard operation
elide copied to clipboard

Support external relationship annotation

Open cythrawll opened this issue 8 years ago • 0 comments

Currently we want a polymorphic relationship in a model to unrelated entities.

{
  "relationships": { 
     "item": { 
       "data": { 
         "type": "foo", //or could be "bar", or "spam" of unrelated entities inheritance-wise   
         "id": "2" 
       } 
     } 
  } 
}

We can model this easily with Hibernate's @Any or @ManyToAny annotation

       @Any( metaColumn = @Column( name="item_type" ) ) 
       @AnyMetDef( 
                idType = "long" 
                metaValues = { 
                        @MetaValue( value="foo", targetEntity=Foo.class ),  
                        @MetaValue( value="bar", targetEntity=Bar.class ),  
                } 
       ) 
       @JoinColumn(name = "item_id") 
      public SimilarInterface getItem() { return item; }

But despite being able to do this in Hibernate, Elide doesn't seem to be able to recognize these as relationships. So we would like to implement an annotation that allows us to annotate relationships outside of just the JPA supported ones. So we can continue to map relationships with non JPA supported annotations.

cythrawll avatar Sep 18 '17 20:09 cythrawll