I have a row in my DB enter image description here
And java function
@Select("<script>\n" +
"SELECT TARIFF FROM MY_TABLE WHERE ROW_ID = #{id}\n" +
"</script>\n")
List<String> findTariffById(@Param("id") String id);
If I add @ResultType(String.class)
, i get list with 1 element: "classic;premium;my-conversation"
But i need to get list with 3 element:
"classic"
"premium"
"my-conversation"
If i have POJO class Tariff
@Data
public class Tariff{
private List<String> name;
}
Than i can change my function to
@Select("<script>\n" +
"SELECT TARIFF FROM MY_TABLE WHERE ROW_ID = #{id}\n" +
"</script>\n")
@Results({
@Result(property = "name", column = "TARIFF", typeHandler = StringArrayListTypeHandler.class)}
)
Tariff findTariffById(@Param("id") String id);
And be happy..
But, I need to get List<String>
Can I get List<String>
without creating POJO?
P.S. StringArrayListTypeHandler parse String to List