From spring2.5 & 3.0 version simplejdbctemplate has namedparameterjdbctemplate support.
Ø simplejdbctemplate are wrapped through simplejdbcdaosupport
Ø ParametrizedRowmapper interface is used for retrieveing objects(mapRow should be overriden)
Ø using namedparameters in queries- provided through :name,:dob- pass value through hashmap(setting string,object-string will be name,dob..)
Datasource can be configured in following ways
1)jndi-Jee:jndi-lookup tag with resource-ref attribute set to true, which says that its an java application server and java:com/env/ is preappended before the jndi-name.
2)connection pooling through commons-dbcp- basicdatasource
3)jdbc datasource - singleconnectiondatasource(only one instance of datasource available),drivermanagerdatasource(connection not pooled)
jdbctemplates are as follows
jdbctemplate,simplejdbctemple,namedparameterjdbctemplate.
Exception
DataAccessException-wraps all other exceptions such as sqlexception,databaseerrorexception,readexception and so on
DataAccessException is runtime exception
No comments:
Post a Comment