ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Ignatenko (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (IGNITE-10195) Cannot create caches with different names but with same indexed types and schema name
Date Tue, 27 Nov 2018 09:11:00 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-10195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Ignatenko resolved IGNITE-10195.
-------------------------------------
       Resolution: Duplicate
    Fix Version/s: 2.8

> Cannot create caches with different names but with same indexed types and schema name
> -------------------------------------------------------------------------------------
>
>                 Key: IGNITE-10195
>                 URL: https://issues.apache.org/jira/browse/IGNITE-10195
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Alexey Platonov
>            Priority: Major
>             Fix For: 2.8
>
>
> Cannot create caches with different names but with same indexed types and schema name.
In this case "javax.cache.CacheException: Index already exists: PERSON_ORGID_IDX" wil be thrown
(Value has field with "origId" and annotation @QuerySqlField(index = true)). 
>  
> {code:java}
> node.createCache(new CacheConfiguration<PersonKey, Person>()
>  .setName("PERSON_1")
>  .setQueryEntities(Arrays.asList(new QueryEntity(PersonKey.class, Person.class).setTableName("PERSON_1")))
>  .setSqlSchema(QueryUtils.DFLT_SCHEMA));
> node.createCache(new CacheConfiguration<PersonKey, Person>()
>  .setName("PERSON_2")
>  .setQueryEntities(Arrays.asList(new QueryEntity(PersonKey.class, Person.class).setTableName("PERSON_2")))
>  .setSqlSchema(QueryUtils.DFLT_SCHEMA));
> {code}
>  
> Here is definition of Person class:
>  
> {code:java}
> public static class PersonKey {
>     @QuerySqlField
>     public long id;
>     /**
>      * Constructor.
>      *
>      * @param id ID.
>     */
>     PersonKey(long id) {
>         this.id = id;
>     }
>     /** {@inheritDoc} */
>     Override public int hashCode() {
>         return (int)id;
>     }
>     /** {@inheritDoc} */
>     @Override public boolean equals(Object obj) {
>         return obj != null && obj instanceof PersonKey && (F.eq(id,
((PersonKey)obj).id));
>     }
> }{code}
> Such behavior seems to be usability bug. Why I cannot create two caches with different
names but with same indexed values?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message