I am using Vertica and MyBatis.
<resultMap id="data" type="some_table_name">
<result property="long_varibary_column" column="long_varibary_column" />
</resultMap>
<select id=“getlong_varibary_column” resultMap=“data”>
Select to_hex(long_varibary_column)
From some_table_name
Limit 1
</select>
Public class some_table_name{
String long_varibary_column;
Public void setLong_varibary_column(String long_varibary_column){this. long_varibary_column= long_varibary_column;}
}
I have used String in the model, as the query has to_hex(long_varibary_column)
even though the column
long_varbinary_column is actually a Long varbinary on the table.
When I fetch the data, I get Null.
I even tried with byte[] instead of String long_varibary_column
, still, I get Null.
Any clue what is going wrong?
To reference the result by the column name, you need to assign alias to it.
i.e.
select to_hex(long_varibary_column) long_varibary_column
from some_table_name
limit 1
Here is a demo.