Return-Path: X-Original-To: apmail-deltaspike-users-archive@www.apache.org Delivered-To: apmail-deltaspike-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28CEA10A4B for ; Wed, 11 Jun 2014 19:24:33 +0000 (UTC) Received: (qmail 44114 invoked by uid 500); 11 Jun 2014 19:24:33 -0000 Delivered-To: apmail-deltaspike-users-archive@deltaspike.apache.org Received: (qmail 44080 invoked by uid 500); 11 Jun 2014 19:24:32 -0000 Mailing-List: contact users-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@deltaspike.apache.org Delivered-To: mailing list users@deltaspike.apache.org Received: (qmail 44069 invoked by uid 99); 11 Jun 2014 19:24:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2014 19:24:32 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of karl.kilden@gmail.com designates 209.85.214.175 as permitted sender) Received: from [209.85.214.175] (HELO mail-ob0-f175.google.com) (209.85.214.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2014 19:24:28 +0000 Received: by mail-ob0-f175.google.com with SMTP id wo20so226908obc.20 for ; Wed, 11 Jun 2014 12:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ylXNSzZf+lKgjWpH9W4jW931WjCI8aUJIDUm3NJMEDA=; b=zKxyTX4JZbZj7GgWKa2eE/C20MuXoagfp1/M/nEjN5NQCvt4xga2TiysllNiQbTYpH MeY9kwFaD3RH/wCd8jLIPu5IwPWSWf5wHYIJlFKjMsNFxLzJWsxkg9DRxwbiY3LciGOZ VOD/hOyOFF36upmEoIOVoIcSPw/2vvvt2mM4TVn3q88Vty7qnzcFbGDwK9h5OuCysR55 hDn/k8cbq4ANFoUffekpqagoy33oJAZgtjeqK0FicNYHYYjVVLIRrmpS+7hwFGrIk5HR ZND/gyMB7Ely3qc6WuClGfbx5dz68Lfhqoe6jcubzSxQR1OG7Q0IRblfd+RimuUh+yGz wZtw== MIME-Version: 1.0 X-Received: by 10.182.97.234 with SMTP id ed10mr39343155obb.31.1402514644263; Wed, 11 Jun 2014 12:24:04 -0700 (PDT) Received: by 10.76.10.36 with HTTP; Wed, 11 Jun 2014 12:24:04 -0700 (PDT) Date: Wed, 11 Jun 2014 21:24:04 +0200 Message-ID: Subject: Entity - DTO Mapper API question / issue From: =?UTF-8?B?S2FybCBLaWxkw6lu?= To: users@deltaspike.apache.org Content-Type: multipart/alternative; boundary=047d7b2e421629e98704fb94638c X-Virus-Checked: Checked by ClamAV on apache.org --047d7b2e421629e98704fb94638c Content-Type: text/plain; charset=UTF-8 Hi guys this regards the mapping API and https://issues.apache.org/jira/browse/DELTASPIKE-606 So I ran into issues with the DTO mapper api and voiced my concerns in irc. I saw the discussion and now I am trying the solution present in the current SNAPSHOT. However I have one comment / question: What if my Entity has a relationship to another Entity? Like this: public class User extends BaseAuditEntity { @Column private String name; @Column @ManyToOne @JoinColumn(name="group_id") private Group group; This means my userDTO may come with a GroupDTO and how do I map that relationship? Or to explain by code please fill in the question marks below ;) or if you feel my implementation is weird then I would gladly accept comments on that too. But the way I see it I need to @Inject the GroupMapper, use the EntityManager to find the Group then call groupMapper.toEntity and then I think to myself that the API is worse now because before I could call groupMapper.toEntity with only a dto argument. At that point you had to use the entitymanager anyways to find "yourself" and that feels clean compared to find your entities you form relationships with. @Override protected User toEntity(final User user, final UserDTO userDTO) { MapperUtil.toAuditEntity(user, userDTO); user.setName(userDTO.getName()); user.setEmail(userDTO.getEmail()); user.setLocale(userDTO.getLocale()); user.setGroup(*?????*); return user; } Cheers / Karl --047d7b2e421629e98704fb94638c--