I'm using the JdbcTmplate to query for rows like this:
Code:
jt = new JdbcTemplate(dataSource);
List rows = jt.queryForList("select * from Recipes");
This gives me back an ArrayList that contains a HashMap per row (just as it should). I can easily loop through the List and extract row data for each column. So far so good.
I have a column (called "NoteText')in the the queried table (called "Recipes") that's a MySQL LONGBLOB. The table definition is here:
Code:
CREATE TABLE Recipes
(
RecipeID INT NOT NULL AUTO_INCREMENT,
RecipeName CHAR(255) NOT NULL,
SequID CHAR(50),
ChefName CHAR(50),
Yield CHAR(50),
NoteTitle CHAR(50),
NoteText LONGBLOB,
ImageFilename CHAR(50),
MenuSectionID INT NOT NULL,
KEY (MenuSectionID),
PRIMARY KEY (RecipeID),
KEY (MenuSectionID),
KEY (RecipeID),
KEY (RecipeName),
KEY (SequID)
)\g
When I grab that column's value from the HashMap for a particular row using row.get("NoteText") what am I getting? If i cast the HashMap value for that column to a String I get something like:
Obviously not what I want. I'd guess that what I'm getting back is an object and the above is the objects toString result.
What's the best way to deal with LOB data coming back from a query through a JdbcTemplate?
Thanks!
- Gary