java - spring apache phoenix integration on Hbase steps -


i new apache phoenix .how use apache phoenix spring.what steps connect spring , apache phoenix.how configure jdbc template phoenix connection details.

1) first of add specific apache phoenix dependency pom.xml file

2) create data source object this:

<bean id="datasource" class="org.apache.commons.dbcp.basicdatasource">     <property name="driverclassname" value="org.apache.phoenix.jdbc.phoenixdriver" />     <property name="url" value="jdbc:phoenix:localhost" /> </bean> 

3) inject datasource dao class

<bean id="somedao" class="com.stackoverlow.somedao">     <property name="datasource" ref="datasource" /> </bean> 

4) implement dao

 public class somedao extends namedparameterjdbcdaosupport  {          @override         public void insert(final someentity someentity) {             string sql = "upsert someentities(id, field) values (:id, :field)";             getnamedparameterjdbctemplate().update(sql, new beanpropertysqlparametersource(someentity));         }     } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -