You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Oleg Ignatenko (JIRA)" <ji...@apache.org> on 2018/11/13 15:56:00 UTC
[jira] [Commented] (IGNITE-10195) Cannot create caches with
different names but with same indexed types and schema name
[ https://issues.apache.org/jira/browse/IGNITE-10195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16685403#comment-16685403 ]
Oleg Ignatenko commented on IGNITE-10195:
-----------------------------------------
comments in the code of the test related to this issue ({{SqlSchemaSelfTest#_testTypeConflictInPublicSchema}}) for some reason referred IGNITE-5380 (introduced in [commit 6f1a900|https://github.com/gridgain/apache-ignite/commit/6f1a900fcf40c780769befd897742206455128ac])
> 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
>
> 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)