> > I guess the real requirement is creating the ObjectAdapter (for the > > retrieved value object) to pass on to "initAssociation". > > I'm not sure that you do need to do this if you use VSPs, but to answer > your question: you can use: > > IsisContext().getPersistenceSession().getAdapterManager().adapterFor(object).
Thanks - I have used this method with a good degree of success, see below.. > > If you look at the implementation (AdapterManagerDefault) then you'll > see that we look for a ValueFacet on the spec of the provided object. > If so, we create a "standalone" adapter to wrap the value. > > > The same would go for the other values (e.g. Image), and extend to custom > > written value types (ValueSemanticsProvider? but I see that being handled > > by an AbstractJdbcFieldMapping class implementation). > I didn't write the AJFM, but as you've noted it's implementation is > hard-coded to only encode to strings, and it then leverages the > VSP#EncoderDecoder to do the heavy lifting. Creating the applib value type first, then using the ...adapterFor(object) method made adding support multi-column SQL object store support real easy. I was able to add support for the applib.value.Money value type quite easily, by extending AbstractJdbcFieldMapping to create a "AbstractJdbcMultiFieldMapping" type - which stores "currency" and "value" in separate columns.
