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

Jooq mapping issue from #572 #602

Closed
arnaudroger opened this Issue Jan 4, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@arnaudroger
Copy link
Owner

arnaudroger commented Jan 4, 2019

@anuraaga just created a separate ticket

Hi @arnaudroger - I tried running this version of the mapper and mappers that used to work with JOOQ and sfm stopped working. Is it expected? Let me know if there's any other info I can provide.

 Caused

 by: org.simpleflatmapper.map.MapperBuildingException: Could not find Getter for 
 JooqFieldKey{field="stellarstationdb"."user"."id", index=0} returning type class com.stellarstation.userservice.api.UserProfile path {this}. See https://github.com/arnaudroger/SimpleFlatMapper/wiki/Errors_CSFM_GETTER_NOT_FOUND
	at org.curioswitch.common.server.framework.database.DatabaseUtil$1.accessorNotFound(DatabaseUtil.java:45)
	at org.simpleflatmapper.map.mapper.PropertyMappingsBuilder._addProperty(PropertyMappingsBuilder.java:106)
	at org.simpleflatmapper.map.mapper.PropertyMappingsBuilder.addProperty(PropertyMappingsBuilder.java:69)
	at org.simpleflatmapper.map.mapper.DefaultConstantSourceMapperBuilder.addMapping(DefaultConstantSourceMapperBuilder.java:160)
	at org.simpleflatmapper.jooq.JooqMapperBuilder.addField(JooqMapperBuilder.java:65)
	at org.simpleflatmapper.jooq.SfmRecordMapperProvider.provide(SfmRecordMapperProvider.java:53)
@arnaudroger

This comment has been minimized.

Copy link
Owner

arnaudroger commented Jan 4, 2019

@anuraaga so I'm assuming
you have a UserProfile object with an id field? what's the type of the id field in the UserProfile object? is it constructor injected? what's the setter or constructor signature?
in the jooq query have the field="stellarstationdb"."user"."id" what type and datatype is that?

Thanks for the report. I think it might be a conversion issue but won't know for sure until I can reproduce.

@anuraaga

This comment has been minimized.

Copy link

anuraaga commented Jan 6, 2019

Thanks for filing the issue, sorry for not following up with more details. I'll be able to provide more details about the data structure tomorrow. But thanks to your comment, I can provide some quick details about the code. The mapping code we use is this

https://github.com/curioswitch/curiostack/blob/master/common/server/framework/src/main/java/org/curioswitch/common/server/framework/database/DatabaseUtil.java

It is very common to map into a smaller type from a bigger one so we disabled the property check. But it seems that with the recent change, the accessor exception is being triggered for this case where the target type is smaller than the source. Does this mean we should disable the accessor check too?

@arnaudroger

This comment has been minimized.

Copy link
Owner

arnaudroger commented Jan 6, 2019

@arnaudroger arnaudroger added this to the 6.1.1 milestone Jan 6, 2019

arnaudroger added a commit that referenced this issue Jan 6, 2019

@arnaudroger

This comment has been minimized.

Copy link
Owner

arnaudroger commented Jan 6, 2019

just pushed 6.1.1 to maven central should be available in 20-30mn. the fix should restore the previous error handling behavior.
you can also use

SfmRecordMapperProviderFactory.newInstance().ignorePropertyNotFound().newProvider();

that will mark any column as optional and not fail if it can't map it.

@anuraaga

This comment has been minimized.

Copy link

anuraaga commented Jan 7, 2019

Thanks for the fix and the sample code!

@arnaudroger arnaudroger closed this Jan 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment