users@cargotracker.java.net

Re: How to deal with Filtering, Pagination and Sorting with DDD Repository-JAVAEE 7

From: Iury <iury.lira_at_gmail.com>
Date: Sun, 20 Mar 2016 13:22:29 -0300

Dear Reza,

First of all, I would like to thank you for spent time helping me for fighting in favor of Java Community.

As I am developing a SPA ( AngularJs, JWT Token) and Rest Api Design (JavaEE 7) I would love to pick the first option however, as some legacy tables has more than 300k registers, I think I will sacrifice DDD a little 😄.

How could I help you to contribute with Cargo Tracker JavaEE version in order to help support a lot of DDD beginners?

Regards,

Iury



Atenciosamente,

Iury

> Em 20 de mar de 2016, às 00:05, reza_rahman <reza_rahman_at_lycos.com> escreveu:
>
> This is an extremely interesting question indeed. You'll find that there is plenty of colorful discussion around this in the DDD community. The thing to understand about DDD is that it is not very religious and always flexible to pragmatic implementation.
>
> In this case the core concepts of DDD is actually not at issue. Whatever you do you should still have a good domain model. The issue is to what degree you need to maintain isolation of layers.
>
> There are two general approaches to solving the issue you are facing.
>
> The first is to simply get all required entities in the view, translating to view layer DTOs or adapters and do the pagination, sorting and filtering completely in the view layer. This is the approach I usually take. The strength of this approach is that it keeps code very simple. The weakness is that it is memory intensive, the initial data load can be slow and you won't actually be using the sorting, pagination and filtering capabilities that JPA offers out of the box.
>
> The second option basically has the reverse set of strengths and weaknesses. In this case your repositories must be aware of sorting, paging and filtering (which are really view layer concerns and not persistence concerns). You can still isolate your domain model by creating DTOs or view adapters above the repository layer. While this might not feel like classical DDD, it's the only practical solutions if performance turns out to be a serious concern (in reality this is not always a concern).
>
> Does this help?
>
> BTW this is not a use case for CQRS.
>
>
> Sent via the Samsung Galaxy S7, an AT&T 4G LTE smartphone
>
> -------- Original message --------
> From: Iury <iury.lira_at_gmail.com>
> Date: 3/18/16 11:01 PM (GMT-05:00)
> To: users_at_cargotracker.java.net
> Subject: How to deal with Filtering, Pagination and Sorting with DDD Repository-JAVAEE 7
>
> Hello All,
>
> I'm beginning a project with DDD and JavaEE 7 and I am having some problems to practice it the right way.
>
> As I read on Erick book and played with CargoTracker JavaEE7 version, the repository is a business specification, however I don't know how to send to DDD repository the filtering and pagination from user interface.
>
> Could you help me to solve this issue?
>
> Regards ,
>
> Iury