[jira] [Created] (IGNITE-10195) Cannot create caches with different names but with same indexed types and schema name

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (IGNITE-10195) Cannot create caches with different names but with same indexed types and schema name

Anton Vinogradov (Jira)
Alexey Platonov created IGNITE-10195:
----------------------------------------

             Summary: 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


Cannot create caches with different names but with same indexed types and schema name. For example, such code will throw exception "javax.cache.CacheException: Table already exists: VALUE".

 

{color:#9876aa}node{color}.createCache({color:#cc7832}new {color}CacheConfiguration<PersonKey{color:#cc7832}, {color}Person>()
 .setName({color:#9876aa}"PERSON_1"{color})
 .setIndexedTypes(Key.{color:#cc7832}class,{color} Person.{color:#cc7832}class{color})
 .setSqlSchema(QueryUtils.{color:#9876aa}DFLT_SCHEMA{color})){color:#cc7832};
{color}{color:#cc7832}
{color}{color:#9876aa}node{color}.createCache({color:#cc7832}new {color}CacheConfiguration<PersonKey{color:#cc7832}, {color}Person>()
 .setName({color:#9876aa}"PERSON_2"{color})
 .setIndexedTypes({color:#cc7832}Key.class, Person.class{color})
 .setSqlSchema(QueryUtils.{color:#9876aa}DFLT_SCHEMA{color})){color:#cc7832};{color}

 

If I set table name manually by setQueryEntities(...) then "javax.cache.CacheException: Index already exists: PERSON_ORGID_IDX" wil be thrown (Value has field with "origId" and annotation {color:#bbb529}@QuerySqlField{color}({color:#d0d0ff}index {color}= {color:#cc7832}true{color})). Here is definition of Person class:

 

{color:#cc7832}public static class {color}PersonKey {
 {color:#bbb529}@QuerySqlField
{color} {color:#cc7832}public long {color}{color:#9876aa}id{color}{color:#cc7832};
{color}{color:#cc7832}
{color} {color:#629755}/**
{color}{color:#629755} * Constructor.
{color}{color:#629755} *
{color}{color:#629755} * {color}{color:#629755}@param {color}{color:#8a653b}id {color}{color:#629755}ID.
{color}{color:#629755} */
{color} {color:#ffc66d}PersonKey{color}({color:#cc7832}long {color}id) {
 {color:#cc7832}this{color}.{color:#9876aa}id {color}= id{color:#cc7832};
{color} }

 {color:#629755}/** {{color}{color:#629755}@inheritDoc{color}{color:#629755}} */
{color} {color:#bbb529}@Override {color}{color:#cc7832}public int {color}{color:#ffc66d}hashCode{color}() {
 {color:#cc7832}return {color}({color:#cc7832}int{color}){color:#9876aa}id{color}{color:#cc7832};
{color} }

 {color:#629755}/** {{color}{color:#629755}@inheritDoc{color}{color:#629755}} */
{color} {color:#bbb529}@Override {color}{color:#cc7832}public boolean {color}{color:#ffc66d}equals{color}(Object obj) {
 {color:#cc7832}return {color}obj != {color:#cc7832}null {color}&& obj {color:#cc7832}instanceof {color}PersonKey && (F.eq({color:#9876aa}id{color}{color:#cc7832}, {color}((PersonKey)obj).{color:#9876aa}id{color})){color:#cc7832};
{color} }
}

 

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)