Hibernate/JPA @AttributeOverrides not playing nicely with Groovy -


please note: full sscce , reproducible source code here on github repo. readme says, clone , run ./gradlew clean build reproduce error i'm seeing.


i'm designing data model groovy (not java) spring boot app use hibernate/jpa read/write entities to/from mysql. of entities extend abstract baseentity provides pk identifier ("refid"). instance:

@canonical @entity @mappedsuperclass abstract class baseentity {   @id   long id    string refid }  @canonical @entity @attributeoverrides({     @attributeoverride(name = "id", column=@column(name="customer_id")),     @attributeoverride(name = "refid", column=@column(name="customer_ref_id")) }) class customer extends baseentity {   @column(name = "customer_name")   string name    @column(name = "customer_fav_food")   string favoritefood } 

as can see, because each entity extends baseentity, , because want each subclass/entity/table have own column name id , refid fields, need use attributeoverrides declaration in each subclass.

however attributeoverrides causing compiler issue can't reproduce in plain ole' java. @ compile-time complains unexpected token error @ n=@column(name="customer_id")),.

can reproduce , figure out what's going on (and fix is)?

however attributeoverrides causing compiler issue can't reproduce in plain ole' java.

unlike java's compiler, groovy's compiler takes { ... } closure instead of array. should use [ ... ] instead, this:

@canonical @entity @attributeoverrides([     @attributeoverride(name = "id", column=@column(name="customer_id")),     @attributeoverride(name = "refid", column=@column(name="customer_ref_id")) ]) class customer extends baseentity {     // ...     } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -