@JmixProperty in Jmix 2.4

Hi everyone.
I have an additional datastore connected to SQL Server.
I want to add a non-persistent property to my entity, that returns a computed non-persistent value.
Reading the documentation, it seems that the correct annotation is @JmixProperty (like @MetaProperty in CUBA).
So I added the following code to the entity:

    @JmixProperty
    public String testProp() {
        return "TEST !!!";
    }

When I add the computed value column to the DataGrid of the List View, I see the error “Property path ‘testProp’ is invalid for entity class…”

Thanks

Add @Transient on this method.

I get the same error.

    @Transient
    @JmixProperty
    public String testProp() {
        return "Test !!!";
    }

1

2

I created a demo project and added the property to the User table.
Same result

jmixtest4.zip (2.3 MB)

Ok, I fixed it. The problem was the method name. It needs to start with “get”.
So, in the example provided, it should be:

    @JmixProperty
    @DependsOnProperties({"username"})
    public String getTestProp() {
        return "TEST !!!";
    }
2 Likes