Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map property - nested case not working properly #752

Open
Abishek1726 opened this issue Jan 19, 2021 · 2 comments
Open

Map property - nested case not working properly #752

Abishek1726 opened this issue Jan 19, 2021 · 2 comments

Comments

@Abishek1726
Copy link

Hi can someone help me out? I am facing an issue in the map property matching nested case.

Mapper object (in Kotlin)
class Project {
    var name: String? = null
    var projectId: String? = null
    var customFields: Map<String,Any>? = null
    var ref: List<Project>? = null
}
Sql query
select 
  `ac1234`.`projectId` as `projectId`,
  `ac1234`.`name` as `name`, 
  `customFields`.`text1` as `customFields.text1`, 
  `customFields`.`text2` as `customFields.text2`, 
  `ref_ac456.customFields`.`udf12text` as `ref_ac456.customFields.udf12text`, 
  `ref_ac456.customFields`.`udf13text` as `ref_ac456.customFields.udf13text`
from `Project` as `ac1234`
  left outer join ac1234 as `customFields`
    on `ac1234`.`projectId` = `customFields`.projectId`
  left outer join ProjectMapping as `ref_ac456-0`
    on `ac1234`.`projectId` = `ref_ac456-0`.`rightprojectId`
  left outer join Project as `ref_ac456-1`
    on `ref_ac456-0`.`leftprojectId` = `ref_ac456-1`.`projectId`
  left outer join ac456 as `ref_ac456`
    on `ref_ac456-1`.`projectId` = `ref_ac456`.`projectId`
  left outer join ac456 as `ref_ac456.customFields`
    on `ref_ac456`.`projectId` = `ref_ac456.customFields`.`projectId`
where `ac1234`.`projectId` = 100

The following error is being throw by the simpleflatmapper

java.lang.NullPointerException: null
	at org.simpleflatmapper.reflect.meta.PropertyFinder.manualMatch(PropertyFinder.java:262)
	at org.simpleflatmapper.reflect.meta.PropertyFinder.manualMatch(PropertyFinder.java:262)
	at org.simpleflatmapper.reflect.meta.ObjectPropertyFinder.manualMatch(ObjectPropertyFinder.java:429)
	at org.simpleflatmapper.reflect.meta.PropertyFinder.manualMatch(PropertyFinder.java:262)
	at org.simpleflatmapper.reflect.meta.PropertyFinder.manualMatch(PropertyFinder.java:262)
	at org.simpleflatmapper.map.mapper.PropertyMappingsBuilder.addProperty(PropertyMappingsBuilder.java:198)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.addMapping(DefaultConstantSourceMapperBuilder.java:706)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.subPropertyMapper(DefaultConstantSourceMapperBuilder.java:1015)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.fields(DefaultConstantSourceMapperBuilder.java:752)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.targetFieldMappers(DefaultConstantSourceMapperBuilder.java:710)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.sourceFieldMapper(DefaultConstantSourceMapperBuilder.java:229)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.mapper(DefaultConstantSourceMapperBuilder.java:166)
	at org.simpleflatmapper.map.mapper.SetRowMapperBuilderImpl.sourceFieldMapper(SetRowMapperBuilderImpl.java:196)
	at org.simpleflatmapper.map.mapper.SetRowMapperBuilderImpl.mapper(SetRowMapperBuilderImpl.java:109)
	at org.simpleflatmapper.map.mapper.MapperBuilder.mapper(MapperBuilder.java:42)
	at org.simpleflatmapper.jdbc.JdbcMapperFactory$SetRowMapperFactory.newInstance(JdbcMapperFactory.java:353)
	at org.simpleflatmapper.jdbc.JdbcMapperFactory$SetRowMapperFactory.newInstance(JdbcMapperFactory.java:339)
	at org.simpleflatmapper.map.mapper.DynamicSetRowMapper.getMapper(DynamicSetRowMapper.java:104)
	at org.simpleflatmapper.map.mapper.DynamicSetRowMapper.getMapperFromSet(DynamicSetRowMapper.java:94)
	at org.simpleflatmapper.map.mapper.DynamicSetRowMapper.stream(DynamicSetRowMapper.java:70)
	at org.simpleflatmapper.jdbc.JdbcMapperFactory$DynamicJdbcSetRowMapper.stream(JdbcMapperFactory.java:292)

But mapping works fine when only one field is selected in Project inside ref object.

@arnaudroger
Copy link
Owner

Will have a look thanks for the report

@Abishek1726
Copy link
Author

Hi @arnaudroger , it will be nice if I know when this issue will be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants