I think you found a bug. I might have missed template.lookup when changing the code.
Can you raise a JIRA issue and until then use repository methods like Platform platform = repo.findByPlatformId(platformId) ? Am 20.03.2014 um 23:46 schrieb BtySgtMajor <[email protected]>: > I was hoping to avoid making two threads this week, but, oh well. :) > > This question applies to the SDN 3.0.1 release. > > I understand the switch to label-based indices and that @Indexed invokes just > that. For legacy indices, indexType should be set to SIMPLE (or FULLTEXT) > with an optional indexName. > > So, I think I might be missing something in my understanding of how SDN has > utilized label-based indices, or something with respect to how SDN uses > Neo4jTemplate, and am looking for some clarification. > > I have a POJO annotated thusly: > > @NodeEntity > public class Platform { > @GraphId > private Long nodeId; > > @Indexed > private String platformId; > ... > > Now, in some other code elsewhere, I'm having a Neo4jTemplate instance > perform a ".lookup(...) like so: > > Platform platform = template.lookup(Platform.class, "platformId", > platformId).to(Platform.class).singleOrNull(); > > platformId holds a legal value ("1", in fact). > > I get an exception thrown in IndexProvider (specifically in > IndexProviderImpl) in "getIndex" like so: > > if (providedIndexName==null || > providedIndexName.equals(defaultIndexName)) { > throw new IllegalStateException("Index name for "+property+" must > differ from the default name: "+defaultIndexName); > } > > > Now, providedIndexName *is* null since none was annotated in the POJO. The > defaultIndexName is, unsurprisingly, "Platform". In fact, the "property" > parameter into the method has the value "class java.lang.String platformId > rel: false idx: true" and the instanceType parameter is "class > com.proj.vonneumanns.entities.Platform". Seems about right. > > So, should I be using the .lookup(...) method? Or am I misunderstanding with > respect to how I should be annotating my POJO above? I do not want to use > the legacy indices, so I don't want to specify indexName or indexType, and > based on what I've seen so far from the blogs and updates, the POJO is > annotated correctly for the latest SDN (i.e. 3.0.1). > > Is it possible to have several indexed attributes in a POJO that all use the > new label-based indices (i.e. none of them would use the legacy indices)? > > I've checked the following links for possible solutions but don't think > they're quite the same issue/matter: > > http://stackoverflow.com/questions/22111928/index-name-for-class-java-lang-string-name-rel-false-idx-true-must-differ-from > https://jira.spring.io/browse/DATAGRAPH-437 > http://stackoverflow.com/questions/22022691/sdn-neo4j-3-0-release-index-strategy/22084251#22084251 > > ...and the respective related links. > > Any insight to help clarify would be greatly appreciated. Everything else > seems to be going decently so far in my diving into SDN 3.0.1 and several > other items I've explored work as expected. > > Thanks in advance! > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
