SimpleFlatMapper icon indicating copy to clipboard operation
SimpleFlatMapper copied to clipboard

java.lang.IllegalArgumentException: value null at org.simpleflatmapper.ow2asm.SymbolTable.addConstant(SymbolTable.java:515)

Open cdxf opened this issue 4 years ago • 3 comments

I'm using SFM v8.2.3 with Spring JDBC and Java 15 (hasn't tested with other JDK), for the first query I get this error message (even though everything works fine include the first query) image Am I missing something?

cdxf avatar Jan 25 '21 17:01 cdxf

No issues here, Spring boot 2.4.x, jdbcTemplate etc..

Not sure what your problem is though, but might not be related to JDK.

My jdk version (using debian):

openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode, sharing)

ltkn avatar Jan 31 '21 13:01 ltkn

@ltkn The error is at this line:

    private final RowMapper<Post> mapper =
            JdbcTemplateMapperFactory.newInstance()
                    .newRowMapper(Post.class);

If I set useAsm to false, it works without any errors

    private final RowMapper<Post> mapper =
            JdbcTemplateMapperFactory.newInstance()
                    .useAsm(false)
                    .newRowMapper(Post.class);


I use Zulu 15 too but this error also happens with other jvm (java 15) image

cdxf avatar Feb 07 '21 17:02 cdxf

No idea unfortunately, but it could help to see your entity class, the query and any nested object ;) Do you have some nested objects in Post entity? with "nestedId" present in Post class, and nested table named "nested" with "id" as primary key? sometimes I find this type of mapping ambiguous.

Also not sure if useAsm is failing with jdk15 because its an old ASM library version https://github.com/arnaudroger/SimpleFlatMapper/tree/master/ow2.asm and if upgrading it is just a matter of changing the version of if it'd come with breaking changes.

I don't think it's related but I'm using ResulsetExtractor instead of RowMapper

@Slf4j
@AllArgsConstructor
@Repository
public class RoleRepository {

    private final ResultSetExtractor<List<Role>> roleEntityRse =
            JdbcTemplateMapperFactory
                    .newInstance()
                    .ignorePropertyNotFound()
                    .unorderedJoin()
                    .addKeys("role_id")
                    .newResultSetExtractor(Role.class);

    private final JdbcTemplate jdbcTemplate;


    @Transactional(readOnly = true)
    public Role findByCode(final String code) {

        final String sql = """
                SELECT * from public.role where code= ?
                """;

        return DataAccessUtils.singleResult(jdbcTemplate.query(sql, roleEntityRse, code));
    }
}

ltkn avatar Feb 07 '21 23:02 ltkn