[BUG] @Column without name specified does not map anything

29 views
Skip to first unread message

medve...@gmail.com

unread,
Jun 16, 2018, 2:56:01 PM6/16/18
to SimpleFlatMapper
Hi,

trying to use JdbcTemplateMapperFactory....newRowMapper(MyPojo.class) and found a bug:

My pojo is defined as:

class MyPojo {
  @Column(length=5)
  String foo;
  @Column(length=5)
  String bar;
  //get/set
}

Note that no attribute "name" is defined in the @Column annotation.
Then the mapping just not work.

The explanation is that ObjectClassMeta.getAlias(..) will return "" (empty string) instead of the field name.
The reason is that  "fieldAliases" is populated with "" (empty string) because we found the @Column annotation but name is not set.
A possible patch is to modify ObjectClassMeta.getAlias(..) line 249 with something like:
if (columnName == null || columnName.isEmpty()) {

Maybe a better path is to populate "fieldAliases" in the right way.

Sorry, I have no github account neither the time to create a good test case right now.

Thank you for your work on such great and usefull project.


Christophe.

Arnaud Roger

unread,
Jun 16, 2018, 3:14:12 PM6/16/18
to medve...@gmail.com, SimpleFlatMapper
Thanks for that makes sense.. will create a issue should be able to release a fix quickly

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "SimpleFlatMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simpleflatmapp...@googlegroups.com.
To post to this group, send email to simplefl...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/simpleflatmapper/f78385a2-7cc6-4031-a2d4-3096b30d8963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arnaud Roger

unread,
Jun 17, 2018, 6:41:34 AM6/17/18
to medved utka, SimpleFlatMapper
released a fix in 3.18.1 could you try it out?

To unsubscribe from this group and stop receiving emails from it, send an email to simpleflatmapper+unsubscribe@googlegroups.com.
To post to this group, send email to simpleflatmapper@googlegroups.com.

medve...@gmail.com

unread,
Jun 17, 2018, 3:33:22 PM6/17/18
to SimpleFlatMapper
Release 3.18.1 works like a charm on my application.

Thank you very much for such reactivity !

Christophe
To unsubscribe from this group and stop receiving emails from it, send an email to simpleflatmapp...@googlegroups.com.
To post to this group, send email to simplefl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages