Roo hint on relationships Order/LineOrder confusing - since ManyToMany created
Brand new to using Roo. Starting my app I needed a oneToMany, ManyToOne relationship - similar to how I'd think a "Order" and "LineItem" behavior would work. When in the roo console and you do 'hint relationships' you get:
Yet, if I follow that you end up with a ManyToMany relationship in Order for "items" which is not typically correct. Buried in the JPA docs I saw an example where --cardinality is mentioned, but it wasn't obvious in the docs. I had to add --cardinality ONE_TO_MANY to get the relationship I was expecting (maybe that shouldn't be mentioned in the hint?) Shouldn't the default be OneToMany and ManyToOne anyway? And then if you need ManyToMany you'd add the cardinality?
You create persistent relationships via 'field set' and 'field reference'.
For example, consider the typical Order <-> LineItem case:
ENTITY: Order ENTITY: LineItem
Set<LineItem> items Order order
To setup this relationship in Roo, you would use:
field set --fieldName items --class Order --type LineItem --mappedBy order
field reference --fieldName order --class LineItem --type Order --notNull
That hint is very confusing in my opinion since it's not even how Orders/LineItems typically work ( multiple orders don't typically share the same linesItems do they?)