Hi Dharam,

Thanks for the info, yes, what you provided will work.  I'll add that
information to the ticket as it's not necessarily a pdxinstance issue.

-Jason

On Wed, Jan 4, 2017 at 9:59 PM Thacker, Dharam <dharam.thac...@jpmorgan.com>
wrote:

> Thank you Json!
>
>
>
> Below syntax seems to be working even with ValueConstraint, but not sure
> if that’s the right way to define!
>
>
>
> Could you help me to verify that?
>
> <geode:index id=*"event_indx"* expression=*"i.eventId"* from=*"/Event i"*
> cache-ref=*"geodeCache"*/>
>
> Thanks & Regards,
>
> Dharam
>
>
>
> *From:* Jason Huynh [mailto:jhu...@pivotal.io]
> *Sent:* Wednesday, January 04, 2017 11:53 PM
> *To:* user@geode.apache.org; u...@geode.incubator.apache.org
> *Subject:* Re: Issue with creating indexes in PdxIntance
>
>
>
> Hi Dharam,
>
>
>
> I believe this is due to having a value-constraint set on the region.  We
> validate the field exists on the value-constraint type before creating the
> index.  PdxInstance is a "special" type and should probably be ignored or
> treated as if it were not contrained.  I have created a ticket for the
> https://issues.apache.org/jira/browse/GEODE-2266.  Hopefully you can
> remove the value-constraint and get past this issue for the time being.
>
>
>
> -Jason
>
>
>
> On Wed, Jan 4, 2017 at 5:54 AM Thacker, Dharam <
> dharam.thac...@jpmorgan.com> wrote:
>
> Hi Team,
>
>
>
> I am trying to define index on replicated region defined as below where
> PdxInstance is created using JsonFormatter.fromJSON(jsonString)!
>
>
>
> Note : I don’t have any domain model called ‘Event.java’ which is being
> converted to JSON, but I am getting Event as json string from source &
> that’s what I am pushing to cache
>
>
>
> <geode:replicated-region id=*"Event"*
>
>                      cache-ref=*"geodeCache"*
>
>                      scope=*"distributed-ack"*
>
>                      key-constraint=*"java.lang.String"*
>
>                      value-constraint=*"org.apache.geode.pdx.PdxInstance"*
>
>                      shortcut=*"REPLICATE_PERSISTENT_OVERFLOW"*
>
>                      persistent=*"true"*
>
>                      disk-synchronous=*"false"*
>
>                      disk-store-ref=*"event_diskstore"*>
>
> </geode:replicated-region>
>
>
>
> <geode:index id=*"event_indx"* expression=*"eventId"* from=*"/Event"*
> cache-ref=*"geodeCache"*/>
>
>
>
>
>
> *Exception*:
>
>
>
> *org.apache.geode.cache.query.TypeMismatchException*: The attribute or
> method name ' eventId ' could not be resolved
>
>        at org.apache.geode.cache.query.internal.ExecutionContext.resolve(
> *ExecutionContext.java:228*)
>
>        at
> org.apache.geode.cache.query.internal.CompiledID.generateCanonicalizedExpression(
> *CompiledID.java:93*)
>
>        at
> org.apache.geode.cache.query.internal.index.FunctionalIndexCreationHelper.prepareIndexExpression(
> *FunctionalIndexCreationHelper.java:498*)
>
>        ... 27 common frames omitted
>
> Wrapped by: *org.apache.geode.cache.query.IndexInvalidException*: Invalid
> indexed expression : ' eventId '
>
>        at
> org.apache.geode.cache.query.internal.index.FunctionalIndexCreationHelper.prepareIndexExpression(
> *FunctionalIndexCreationHelper.java:513*)
>
>        at
> org.apache.geode.cache.query.internal.index.FunctionalIndexCreationHelper.<init>(
> *FunctionalIndexCreationHelper.java:112*)
>
>        at
> org.apache.geode.cache.query.internal.index.IndexManager.createIndex(
> *IndexManager.java:272*)
>
>        at
> org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(
> *DefaultQueryService.java:213*)
>
>        at
> org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(
> *DefaultQueryService.java:160*)
>
>        at
> org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(
> *DefaultQueryService.java:226*)
>
>        at
> org.apache.geode.cache.query.internal.DefaultQueryService.createIndex(
> *DefaultQueryService.java:128*)
>
>        at
> org.springframework.data.gemfire.IndexFactoryBean.createFunctionalIndex(
> *IndexFactoryBean.java:238*)
>
>        at org.springframework.data.gemfire.IndexFactoryBean.createIndex(
> *IndexFactoryBean.java:149*)
>
>        at
> org.springframework.data.gemfire.IndexFactoryBean.afterPropertiesSet(
> *IndexFactoryBean.java:98*)
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(
> *AbstractAutowireCapableBeanFactory.java:1642*)
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(
> *AbstractAutowireCapableBeanFactory.java:1579*)
>
>        ... 16 common frames omitted
>
> Wrapped by: *org.springframework.beans.factory.BeanCreationException*:
> Error creating bean with name ‘event_indx’: Invocation of init method
> failed; nested exception is
> *org.apache.geode.cache.query.IndexInvalidException*: Invalid indexed
> expression : ' eventId '
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(
> *AbstractAutowireCapableBeanFactory.java:1583*)
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(
> *AbstractAutowireCapableBeanFactory.java:545*)
>
>        at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(
> *AbstractAutowireCapableBeanFactory.java:482*)
>
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(
> *AbstractBeanFactory.java:306*)
>
>        at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(
> *DefaultSingletonBeanRegistry.java:230*)
>
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(
> *AbstractBeanFactory.java:302*)
>
>        at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(
> *AbstractBeanFactory.java:197*)
>
>        at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(
> *DefaultListableBeanFactory.java:732*)
>
>        at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(
> *AbstractApplicationContext.java:861*)
>
>        at
> org.springframework.context.support.AbstractApplicationContext.refresh(
> *AbstractApplicationContext.java:541*)
>
>        at
> org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(
> *EmbeddedWebApplicationContext.java:122*)
>
>        at org.springframework.boot.SpringApplication.refresh(
> *SpringApplication.java:761*)
>
>        at org.springframework.boot.SpringApplication.refreshContext(
> *SpringApplication.java:371*)
>
>        at org.springframework.boot.SpringApplication.run(
> *SpringApplication.java:315*)
>
>        at org.springframework.boot.SpringApplication.run(
> *SpringApplication.java:1186*)
>
>        at org.springframework.boot.SpringApplication.run(
> *SpringApplication.java:1175*)
>
>
>
> Thanks,
>
> Dharam
>
> This email is confidential and subject to important disclaimers and
> conditions including on offers for the purchase or sale of securities,
> accuracy and completeness of information, viruses, confidentiality, legal
> privilege, and legal entity disclaimers, available at
> http://www.jpmorgan.com/pages/disclosures/email
>
> This email is confidential and subject to important disclaimers and
> conditions including on offers for the purchase or sale of securities,
> accuracy and completeness of information, viruses, confidentiality, legal
> privilege, and legal entity disclaimers, available at
> http://www.jpmorgan.com/pages/disclosures/email
>

Reply via email to