This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes SimpleJdbcDaoSupport Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "SimpleJdbcDaoSupport" Watch "SimpleJdbcDaoSupport" New topic
Author

SimpleJdbcDaoSupport

Mark Hughes
Ranch Hand

Joined: Jul 14, 2006
Posts: 146
Hey Guys,

Im a newbie to SimpleJdbcDaoSupport, and am trying to do a simple select statement from my database table to get one field and return a string as follows.

<blockquote>code:
<pre name="code" class="core">
String query = "SELECT id FROM table WHERE name = 'test'";
ps = getConnection().prepareStatement(query);
rs = ps.executeQuery();
if (rs.next())
{
strResult = rs.getString("id");
}
</pre>
</blockquote>

Now i want to convert the above to use SimpleJdbcDaoSupport and i see SimpleJdbcDaoSupport has getSimpleJdbcTemplate() and getJdbcTemplate() which gives methods such as query but each query method seems to take 2 or more arguemts such as sql and mapping object and returns an object or list, Is there the ability to just give an sql statement and get the returned result as a string?? or equivelent??

best
Mark
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

No, the purpose of these helper classes is to allow you to map the result set back to a java Object. So they will all expect some sort of RowMapper implementation to do this.


GenRocket - Experts at Building Test Data
Mark Hughes
Ranch Hand

Joined: Jul 14, 2006
Posts: 146
ok Thanks for your help.

Best
Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SimpleJdbcDaoSupport
 
Similar Threads
Insert a 7k String into Oracle CLOB?
Named query for stored procedure
EJB QL & heterogeneous relationships
doubt on object
doubt in select statement in mysql database