MapStruct is great

90 views
Skip to first unread message

Gaël Marziou

unread,
Aug 20, 2015, 5:57:45 PM8/20/15
to JHipster dev team
Hi all,

I must admit I was not convinced by MapStruct at first sight but after I took time to understand it I really enjoyed it, thanks for this great feature.

One thing that bugged me a little is with an entity Order with OneToMany relationship with OrderItem entities, the OrderDTO does not include the List<OrderItem> property.
In my case it, I wanted to be able to create the Order with its OrderItems with a single POST.

Rather than having not generating it in DTO, I think it would be nicer to generate full mapping but add ignore=true by default in the Mapper.

I also think that we could add more comments in generated code to guide the developer maybe by a link to mastruct doc.

Cheers,
Gael

Anders Steiner

unread,
Aug 21, 2015, 2:05:00 AM8/21/15
to Gaël Marziou, JHipster dev team
If one removes the mapping with ignore=true will Hibernate then create or update OrderItem entities automatically or is there need for annotating the entity as well?

--
You received this message because you are subscribed to the Google Groups "JHipster dev team" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jhipster-dev...@googlegroups.com.
To post to this group, send email to jhipst...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jhipster-dev/64321b60-31b1-4557-9f3f-1be240768905%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gaël Marziou

unread,
Aug 21, 2015, 6:23:11 AM8/21/15
to JHipster dev team
You have to put Cascade.ALL on relationship property in your JPA entity.
Reply all
Reply to author
Forward
0 new messages