2

Im trying to generate classes using my own springboot template and Dsl models. In my ".entity" files I have:

Car {​​​​​
id : int {​​​​​ @Id, @AutoIncremented }​​​​​;
users : Employee [];
}​​​​​
    
Employee {​​​​​
id : long {​​​​​ @Id }​​​​​ ;
name : string ;
cars : Car[] ;
}​​​​​

I was expecting a @ManyToMany relation in JPA but I didn't. The same thing with this:

Car {​​​​​
id : int {​​​​​ @Id, @AutoIncremented }​​​​​;
user : Employee;
}​​​​​
    
Employee {​​​​​
id : long {​​​​​ @Id }​​​​​ ;
name : string ;
car : Car;
}​​​​​

I expect a @OneToOne relation but I don't get it. It seems I can only get @ManyToOne and @OneToMany. How can I get @ManyToMany and @OneToOne relations using DSL models?

Pedro Araujo
  • 57
  • 1
  • 7

1 Answers1

1

Since Telosys 3.3.0 you can do that with “@OneToOne” and “@ManyToMany” DSL model annotations.

Add annotation for the relevant link, for example :

MyEntity {
  ...
  employee : Employee  { @OneToOne   @FetchTypeLazy  } ; 
  projects : Project[] { @ManyToMany @LinkByJoinEntity(EmpProj) } ;
}

See the doc :

lgu
  • 2,342
  • 21
  • 29
  • If I want to express the same relationships in a c# asp.net core project and entity framework model, are these annotation usable? is lang C# env variable of use? How to generated C# equivalent of JPA classes – Rad Oct 13 '21 at 11:01