JNDI数据源 < bean id ="dataSource" class ="org.springframework.jndi.JndiObjectFactoryBean" > < property name ="jndiName" > < value > xb2datasource </ value > </ property > </ bean > SessionFactory < bean id ="sessionFactory" class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" > < property name ="dataSource" > < ref bean ="dataSource" /> </ property > < property name ="hibernateProperties" > < props > < prop key ="hibernate.dialect" > org.hibernate.dialect.SybaseDialect </ prop > < prop key ="hibernate.show_sql" > true </ prop > < prop key ="hibernate.cache.use_query_cache" > true </ prop > < prop key ="hibernate.cache.provider_class" > org.hibernate.cache.HashtableCacheProvider </ prop > </ props > </ property > </ bean > JdbcTemplate < bean id ="jdbcTemplate" class ="org.springframework.jdbc.core.JdbcTemplate" > < description > Config jdbcTemplate </ description > < property name ="dataSource" > < ref bean ="dataSource" /> </ property > </ bean >