Package info.archinnov.achilles.internal.metadata.holder

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMetaRowExtractor


    }

    public void setPropertyToEntity(Row row, EntityMeta meta,PropertyMeta pm, Object entity) {
        log.debug("Set property {} value from fetched CQL row", pm.getPropertyName());
        if (row != null) {
            final PropertyMetaRowExtractor rowExtractor = pm.forRowExtraction();
            if (pm.structure().isEmbeddedId()) {
                Object compoundKey = rowExtractor.extractCompoundPrimaryKeyFromRow(row, meta, MANAGED);
                pm.forValues().setValueToField(entity, compoundKey);
            } else {
                Object value = rowExtractor.invokeOnRowForFields(row);
                pm.forValues().setValueToField(entity, value);
            }
        }
    }
View Full Code Here


    @Test
    public void should_set_compound_key_to_entity() throws Exception {
        //Given
        EmbeddedKey embeddedKey = new EmbeddedKey();
        PropertyMetaRowExtractor rowExtractor = mock(PropertyMetaRowExtractor.class);
        when(pm.forRowExtraction()).thenReturn(rowExtractor);
        when(pm.structure().isEmbeddedId()).thenReturn(true);
        when(rowExtractor.extractCompoundPrimaryKeyFromRow(row, entityMeta, MANAGED)).thenReturn(embeddedKey);

        //When
        entityMapper.setPropertyToEntity(row, entityMeta, pm, entity);

        //Then
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.internal.metadata.holder.PropertyMetaRowExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.