isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshan Vishwakarma <roshan.vishwaka...@celeritio.com>
Subject Apache ISIS - Store multiple selected values into Single column in database
Date Thu, 01 Feb 2018 07:40:27 GMT
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<Door>{

    @javax.jdo.annotations.Column(name="name" ,allowsNull = "true")
    @Property(editing = Editing.ENABLED)
    @Getter @Setter
    private String name;

    @javax.inject.Inject
    @javax.jdo.annotations.Column(name="doortype", allowsNull="true")
    @Getter @Setter
    DoorType[] doorType;
}

2. DoorMenu.java
@Action(domainEvent = CreateDomainEvent.class)
    @ActionLayout(cssClassFa="fa-clock-o", named="Door")
    @MemberOrder(sequence = "1")
    public Door createDoor(
            @Parameter(optionality = Optionality.OPTIONAL)
@ParameterLayout(named="Name") String name,
            @Parameter(optionality = Optionality.OPTIONAL)
@ParameterLayout(named="Door Type") DoorType[] doorType){
        return doorRepository.create(name, doorType);
    }

3. DoorRepository.java
public Door createDoor(
            final String name,
            final DoorType[] doorType){

        final Door door = 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message