ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Вячеслав Коптилин <slava.kopti...@gmail.com>
Subject Re: no data by JDBC or Cache query!
Date Thu, 14 Mar 2019 14:49:04 GMT
Hi,

Please make sure that your types are registered as follows:
    CacheConfiguration<String, Person> ccfg = new
CacheConfiguration<>("PersonCache");
    ccfg.*setIndexedTypes*(String.class, Person.class);
    ...
    IgniteCache<String, Person> personCache =
igniteClient.getOrCreateCache(ccfg);

additional details can be found here:
https://apacheignite-sql.readme.io/docs/schema-and-indexes#section-registering-indexed-types

Thanks,
S.

чт, 14 мар. 2019 г. в 10:47, Aurora <2565003241@qq.com>:

> Ignite 2.7.0
> I poured data by the following code, but I didnt get  data after executing
> jdbc or cache query, while I just can see data by "cache -scan -c=@c4" by
> the command window: IgniteVisorCmd.sh. why?
>
> IgniteCache<String, Person> personCache =
> igniteClient.cache("PersonCache");
> Person person = new Person();
> person.setXXX
> personCache .put(person.getId(),person);
>
>
> IgniteClient:
>
> public class IgniteClient {
>     private final static Logger logger = LoggerFactory
>             .getLogger(IgniteClient.class);
>
>     private static Ignite client = null;
>
>     static {
>         logger.info("Initialize Ignite Client");
>         try {
>
>             // start client ignite
>             IgniteConfiguration config = new IgniteConfiguration();
>
> //            config.setClientMode(true);
>             // config.setGridName(CLIENT_GRID);
>             config.setPeerClassLoadingEnabled(true);
>
>             // Configure discovery SPI.
>             TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
>             TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
>
>
> ipFinder.setAddresses(Arrays.asList("192.168.100.105:47500..47509"));
>
>             discoSpi.setIpFinder(ipFinder);
>
>             config.setDiscoverySpi(discoSpi);
>
>             client = Ignition.start(config);
>
>         } catch (IgniteException e) {
>             e.printStackTrace();
>         }
>
>     }
>
>     public static Ignite getClient() {
>         return client;
>     }
>
> }
>
> thanks.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Mime
View raw message