You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by ke...@kmz.co.za on 2017/03/12 19:45:48 UTC

Using a custom value type with @Version still supported?

Hi,

Is @Value(semanticsProviderClass=...) still supported?

I have a "Location" value semantics provider that represents a Location 
as 3 integers ("x;y;z"), but it does not seem to be used as I expect.

Do I need to do anything special, other than have the provider declared?

@Value(semanticsProviderClass = LocationSemanticsProvider.class)
public class Location implements Serializable {
   ...
}

After adding a "Location" property to the SimpleObject generated from 
the archetype I don't see it being picked up and used by DataNucleus...

@javax.jdo.annotations.Column(allowsNull = "true", length = 40)
@Property(editing = Editing.ENABLED)
@Setter @Getter
Location location;

The to/from string methods of the LocationSemanticsProvider are being 
called, but the property is not being persisted...

There is no corresponding column in the created table..

20:38:32,414  [Schema               main       DEBUG]  CREATE TABLE 
"simple"."SimpleObject"
(
     "id" BIGINT GENERATED BY DEFAULT AS IDENTITY,
     "map" VARCHAR(255) NULL,
     "name" VARCHAR(40) NOT NULL,
     "notes" VARCHAR(4000) NULL,
     "version" TIMESTAMP NOT NULL,
     CONSTRAINT "SimpleObject_PK" PRIMARY KEY ("id")
)

Cheers,
Kevin

Re: Using a custom value type with @Version still supported?

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Kevin,

Um, no, as you have probably surmized, @Value is not currently supported.

There are two reasons:
1. for the Wicket viewer, a custom component would need to be developed to
render the value by some means or other
2. for DataNucleus, an implementation of its JavaMapping is required [1,2,3]
3. the field may need additional DN annotations when in the domain model [4]

All of this makes our @Value annotation pretty redundant.  (There might,
still, be one part of Isis that has a vestigial dependency on the value
semantics facets; I could look up the details to double check if you want
to pursue).

HTH
Dan

[1]
https://github.com/apache/isis/blob/master/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisBlobMapping.java

[2]
http://www.datanucleus.org:15080/products/accessplatform_4_1/extensions/rdbms_java_types.html
[3]
https://github.com/apache/isis/blob/master/core/runtime/src/main/resources/plugin.xml#L28

[4]
https://isis.apache.org/guides/ugfun.html#__ugfun_how-tos_class-structure_properties_mapping-blobs-and-clobs


On Tue, 14 Mar 2017 at 02:50 <ke...@kmz.co.za> wrote:

Hi,

Is @Value(semanticsProviderClass=...) still supported?

I have a "Location" value semantics provider that represents a Location
as 3 integers ("x;y;z"), but it does not seem to be used as I expect.

Do I need to do anything special, other than have the provider declared?

@Value(semanticsProviderClass = LocationSemanticsProvider.class)
public class Location implements Serializable {
   ...
}

After adding a "Location" property to the SimpleObject generated from
the archetype I don't see it being picked up and used by DataNucleus...

@javax.jdo.annotations.Column(allowsNull = "true", length = 40)
@Property(editing = Editing.ENABLED)
@Setter @Getter
Location location;

The to/from string methods of the LocationSemanticsProvider are being
called, but the property is not being persisted...

There is no corresponding column in the created table..

20:38:32,414  [Schema               main       DEBUG]  CREATE TABLE
"simple"."SimpleObject"
(
     "id" BIGINT GENERATED BY DEFAULT AS IDENTITY,
     "map" VARCHAR(255) NULL,
     "name" VARCHAR(40) NOT NULL,
     "notes" VARCHAR(4000) NULL,
     "version" TIMESTAMP NOT NULL,
     CONSTRAINT "SimpleObject_PK" PRIMARY KEY ("id")
)

Cheers,
Kevin