From users-return-5946-archive-asf-public=cust-asf.ponee.io@isis.apache.org Thu Feb 1 09:12:41 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 9F744180652 for ; Thu, 1 Feb 2018 09:12:41 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8FB3B160C44; Thu, 1 Feb 2018 08:12:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D8A78160C26 for ; Thu, 1 Feb 2018 09:12:40 +0100 (CET) Received: (qmail 37965 invoked by uid 500); 1 Feb 2018 08:12:40 -0000 Mailing-List: contact users-help@isis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@isis.apache.org Delivered-To: mailing list users@isis.apache.org Received: (qmail 37953 invoked by uid 99); 1 Feb 2018 08:12:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Feb 2018 08:12:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 92188C0572 for ; Thu, 1 Feb 2018 08:12:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.272 X-Spam-Level: X-Spam-Status: No, score=0.272 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_SOFTFAIL=0.972] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id sBLlk1GnxthX for ; Thu, 1 Feb 2018 08:12:37 +0000 (UTC) Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 72C825FDE1 for ; Thu, 1 Feb 2018 08:11:17 +0000 (UTC) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eh9xf-00040w-5p for users@isis.apache.org; Thu, 01 Feb 2018 09:11:11 +0100 Received: from [192.168.0.4] ([84.114.31.41]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id 5LB51x01u0tE6K001LB7aL; Thu, 01 Feb 2018 09:11:07 +0100 X-SourceIP: 84.114.31.41 To: users@isis.apache.org References: Subject: Re: Apache ISIS - Store multiple selected values into Single column in database From: Andi Huber Message-ID: <65f69275-69ae-7703-ee44-ae6180b86ab0@apache.org> Date: Thu, 1 Feb 2018 09:11:06 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US Hi Roshan, whenever I have such a use-case as you described (multiple values in one column), I do the following ... Split the the property (in your case the 'doorTypes') into 2 parts: 1) visible part as rendered by Isis (make this transient: @NotPersistent)= @NotPersistent List getDoorTypes(){ // parse field 'doorTypesStringified' ... } void setDoorTypes(List doorType){ // update field 'doorTypesStringified' ... } // add support methods here ... 2) hidden part as persisted by JDO (exemplified with 'String', but you can choose whatever you like) @PropertyLayout(hidden=3DWhere.EVERYWHERE) @Getter @Setter @Column(allowsNull=3D"true") String doorTypesStringified; Regards, Andi On 2018/02/01 07:40:27, Roshan Vishwakarma wrote: > Hi,> > > I have an use case where I have to insert multiple values in a single> > column.> > > For example:> > > 1. Door.java> > public class Door implements Comparable{> > > @javax.jdo.annotations.Column(name=3D"name" ,allowsNull =3D "true")> > @Property(editing =3D Editing.ENABLED)> > @Getter @Setter> > private String name;> > > @javax.inject.Inject> > @javax.jdo.annotations.Column(name=3D"doortype", allowsNull=3D"true")> > @Getter @Setter> > DoorType[] doorType;> > }> > > 2. DoorMenu.java> > @Action(domainEvent =3D CreateDomainEvent.class)> > @ActionLayout(cssClassFa=3D"fa-clock-o", named=3D"Door")> > @MemberOrder(sequence =3D "1")> > public Door createDoor(> > @Parameter(optionality =3D Optionality.OPTIONAL)> > @ParameterLayout(named=3D"Name") String name,> > @Parameter(optionality =3D Optionality.OPTIONAL)> > @ParameterLayout(named=3D"Door Type") DoorType[] doorType){> > return doorRepository.create(name, doorType);> > }> > > 3. DoorRepository.java> > public Door createDoor(> > final String name,> > final DoorType[] doorType){> > > final Door door =3D new Door();> > > door.setName(name);> > door.setDoorType(doorType);> > > serviceRegistry.injectServicesInto(door);> > repositoryService.persist(door);> > > return door;> > }> > > 4. DoorType.java - This will contain name of the type of door> > > From the above example I have to insert multiple DoorType in single column.> > But when code is executed it does not create column "doortype".> > I don't see error in the log.> > Is this correct way of defining "DoorType[]"?> > How we can achieve multiple values in single column. Which dataType is>= > considered here?> > > > Regards,> > Roshan> >