V8.2.0

Warning ContextualGetterFactory signature has slightly changed

public interface ContextualGetterFactory<T, K> {
	<P> ContextualGetter<T, P> newGetter(final Type target, K key, MappingContextFactoryBuilder<?, K> mappingContextFactoryBuilder, Object... properties);
}

to

public interface ContextualGetterFactory<T, K> {
	<P> ContextualGetter<T, P> newGetter(final Type target, K key, MappingContextFactoryBuilder<?, ? extends FieldKey<?>> mappingContextFactoryBuilder, Object... properties);
}

That release fixes

  • #679 Discriminator on 2 different hierarchy same root type

Provide better matching

  • #691 property matching supports plural/singular matching
  • #479 PropertyFinder speculative matching on Object
  • #689 revisit the heuristic for field selection

And some better jOOQ support

  • #551 Jooq record unmapper
  • #690 Mapper verbosity with jooq

Matching

plurals support

now for the following object

class ObjectWithLabels {
    List<String> labels;
}

the label column will get mapped to the labels list avoiding the need to alias the column;

speculative matching on Object

that feature is disabled bu default to enable it just a SpeculativeObjectLookUpProperty.INSTANCE to the column property

    MapperFactory.newInstance()
            .addColumnProperty(ConstantPredicate.truePredicate(), SpeculativeObjectLookUpProperty.INSTANCE)

for the following objects

class Foo {
    Bar bar;
}
class Bar {
   String value;
}

without speculative enabled it will need to have the column name be bar_value, now value will also match.

jOOQ

RecordMapper/RecordUnmapper

we now have a RecordUnmapper available from the JooqMapperFactory.

		cfg.set(JooqMapperFactory.newInstance().newRecordUnmapperProvider(cfg));

SelectQueryMapper

select query mapper is a mapper that takes a SelectQuery in a will generated the mapper based on the model generated from jOOQ enabling the auto detection of keys. combined with speculative matching it allows for an easier mapping to dto

SelectQueryMapper<Author> authorMapper = SelectQueryMapperFactory.newInstance().newMapper(Author.class);

List<Author> authors = authorMapper.asList(DSL.using(connection)
        .select(AUTHOR.ID, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME, AUTHOR.DATE_OF_BIRTH,
                BOOK.ID, BOOK.TITLE)
        .from(AUTHOR).leftJoin(BOOK).on(BOOK.AUTHOR_ID.eq(AUTHOR.ID))
        .orderBy(AUTHOR.ID));

no need for key definitions or aliasing anymore.

Reminder from 8.0.0

  • Intellij use wrong classifier Rewrote the release process to remove the classifier as a way to deal with different jre version. Instead change the artifactId for jre6 and jre9 so that the full chain is set by the root import.

The dependencies are now included with the following :

Java 8, 9, 10 , 11 no module-info

<dependency>
    <groupId>org.simpleflatmapper</groupId>
    <artifactId>sfm-jdbc</artifactId>
    <version>8.2.1</version>
</dependency>

Java 6, 7

<dependency>
    <groupId>org.simpleflatmapper</groupId>
    <artifactId>sfm-jdbc-jre6</artifactId>
    <version>8.2.1</version>
</dependency>

Java 9, 10 , 11 with module-info

<dependency>
    <groupId>org.simpleflatmapper</groupId>
    <artifactId>sfm-jdbc-jre9</artifactId>
    <version>8.2.1</version>
</dependency>