如何在没有java文件的情况下将MyBatis配置为一个Ignite XML配置

时间:2017-06-30 09:51:11

标签: rest mybatis ignite

我使用docker点燃安装库ignite-zookeeper,ignite-rest-http和外部https://github.com/mybatis/ignite-cache/releases/download/mybatis-ignite-1.0.5/mybatis-ignite-1.0.5.jar

所有节点都有此配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
  <!-- Configuring cache. -->
  <property name="cacheConfiguration">
     <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
           <property name="name" value="Person" />
           <property name="cacheMode" value="PARTITIONED" />
           <property name="atomicityMode" value="TRANSACTIONAL" />
           <property name="writeSynchronizationMode" value="FULL_SYNC" />
           <property name="queryEntities">
              <list>
                 <bean class="org.apache.ignite.cache.QueryEntity">
                    <property name="keyType" value="java.lang.Long" />
                    <property name="valueType" value="Person" />
                    <property name="fields">
                       <map>
                          <entry key="firstName" value="java.lang.String" />
                          <entry key="lastName" value="java.lang.String" />
                          <entry key="resume" value="java.lang.String" />
                          <entry key="salary" value="java.lang.Integer" />
                       </map>
                    </property>
                    <property name="indexes">
                       <list>
                          <bean class="org.apache.ignite.cache.QueryIndex">
                             <constructor-arg value="salary" />
                          </bean>
                       </list>
                    </property>
                 </bean>
              </list>
           </property>
        </bean>
     </list>
  </property>
  <property name="discoverySpi">
     <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="ipFinder">
           <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.zk.TcpDiscoveryZookeeperIpFinder">
              <property name="allowDuplicateRegistrations" value="false" />
              <property name="basePath" value="/ignite" />
              <property name="serviceName" value="Service" />
              <property name="zkConnectionString" value="zk.zookeeper:2181" />
           </bean>
        </property>
     </bean>
  </property>
</bean>
</beans>

是否可以在同一个配置文件中创建sql查询,然后通过rest api调用它们? 例如:

curl http://host:port/ignite?cmd=exe&name=getUser&id=1

和rest api执行sql查询SELECT * FROM PERSON WHERE _key = #{id}并返回结果

1 个答案:

答案 0 :(得分:0)

不,这是不可能的。 SQL查询的REST API在此处描述:https://apacheignite.readme.io/docs/rest-api#sql-query-execute

相关问题