> > In the SQL object store AbstractJdbcFieldMapping, the method
> > ...
> > to create an object adapter from the string.
> >
> > This is quite messy and obviously will kill anything like a BLOB (e.g. an
> > image!)
> Well, not necessarily.  There's nothing to prevent your value type to 
> encode itself as a string, eg using base 64 encoding.  

Eeek! Do you hear 30% data bloat? ;)

> > How do I directly create (for example) an ObjectAdapter containing an Isis
> > applib Date value, to pass on to
> > "((OneToOneAssociation) field).initAssociation(object, restoredValue);"
> >
> > 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'll give this a try. I'm assuming that the following'll work:

Date newDateValue = rs.getDate(columnName);

ObjectAdapter  restoredValue =  IsisContext(). \
        getPersistenceSession().\
        getAdapterManager(). \
        adapterFor(newDateValue);

((OneToOneAssociation) field).initAssociation(object, restoredValue)

> 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.

Something to keep in mind.


Thanks,
Kevin

Reply via email to