Open full view…

Generating Entity with links

Fri, 03 Jan 2020 15:23:19 GMT

I'm trying generate JPA Entities from DSL Model. When I use *$jpa.linkAnnotations(4, $link, $allMappedFields)* the result is *@OneToMany(mappedBy="null", targetEntity=LineEntity.class)*. Why my mappedBy is always *null*? My DSLs Model: --- Payment{ id : long { @Id } ; line : Line[] ; } Line{ id : long { @Id } ; lineNumber : int { @Min(0) } ; } ---

Telosys Team
Fri, 03 Jan 2020 16:52:29 GMT

It's probably because in your DSL there's no reference to 'Payment' in the 'Line' entity, so there's no "owning side" in the relationship (you just have the "inverse side"). In JPA the "owning side" is the entity holding the "ManyToOne" link ( the "Foreign Key" in the database ) Try to add `payment : Payment ; ` in *'Line'* entity

Mon, 06 Jan 2020 10:57:30 GMT

I tried add `payment : Payment ;`, but the result is the same. Any more tips? Thank you in advance. Best Regards.