On 20 July 2014 21:55,  wrote:

> Hi,
>
>
>
>
>         I am just starting with Isis.
>

Hi Johan, welcome to the Isis mailing list.



>
>         I want a field (property) to be optional and coded:
>
>          private String middleName;
>
>
>
>             @Named("tussen")
>
>             @javax.jdo.annotations.Column(allowsNull = "true")
>
>             @MemberOrder(sequence = "2")
>
>             @Optional
>
>
>
>         But in the user interface it is still mandatory.
>
>
>
>         Can somebody help?
>
>
Isis currently requires annotations to be on the getter, not on the field;
see for example [1].  Are those annotations you've listed on the field ?
 If so, that'll be the issue.

Also, the (Isis) @Optional annotation is not required if you have the (JDO)
annotation @javax.jdo.annotations.Column(allowsNull = "true").

Let me know if that fixes things or not.

Dan

Hi Dan,

I used the annatation the way you described it:



        � ��private String middleName;

        �� �

        � � @Named("tussen")

        � � @javax.jdo.annotations.Column(allowsNull = "true")

        � � @MemberOrder(sequence = "2")

        � � public String getMiddleName() {

        � � � � return middleName;

        � � }

        �� �

        � � public void setMiddleName(String name) {

        � � � � this.middleName = name;

        � � } � �
In the console you can see that it is picked up correctly:

        (

        � � "id" BIGINT GENERATED BY DEFAULT AS IDENTITY,

        � � "dateOfBirth" DATE NOT NULL,

        � � "firstName" NVARCHAR(255) NOT NULL,

        � � "joinedOn" BLOB NOT NULL,

        � � "lastName" NVARCHAR(255) NOT NULL,

        � � "middleName" NVARCHAR(255) NULL,

        � � "sex" NVARCHAR(255) NOT NULL,

        � � "version" BIGINT NOT NULL,

        � � CONSTRAINT "User_PK" PRIMARY KEY ("id")

        )
But in the user-interface it remains required. (see attachtment) [1] 
https://github.com/apache/isis/blob/master/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java#L392
 > > > Tnx, johan. > > > >

        �

Reply via email to