Search in sources :

Example 1 with ContainerAdapter

use of org.datanucleus.store.types.containers.ContainerAdapter in project datanucleus-rdbms by datanucleus.

the class SingleCollectionMapping method setObject.

@Override
public void setObject(ExecutionContext ec, PreparedStatement ps, int[] pos, Object container) {
    Object value = null;
    if (container != null) {
        ElementContainerHandler containerHandler = ec.getTypeManager().getContainerHandler(mmd.getType());
        ContainerAdapter containerAdapter = containerHandler.getAdapter(container);
        Iterator iterator = containerAdapter.iterator();
        value = iterator.hasNext() ? iterator.next() : null;
    }
    wrappedMapping.setObject(ec, ps, pos, value);
}
Also used : Iterator(java.util.Iterator) ContainerAdapter(org.datanucleus.store.types.containers.ContainerAdapter) ElementContainerHandler(org.datanucleus.store.types.containers.ElementContainerHandler)

Aggregations

Iterator (java.util.Iterator)1 ContainerAdapter (org.datanucleus.store.types.containers.ContainerAdapter)1 ElementContainerHandler (org.datanucleus.store.types.containers.ElementContainerHandler)1