you can do neo4jTemplate.getInfrastructure().getTypeRepresentationStrategies().getJavaType(node);
I could imagine exposing this through the template, or the crud-repository (also a method like "isJavaType(node)" could be possible).
Please raise a JIRA issue for that with spring.neo4j.org/issues
Thanks a lot
Michael
Hello all:
Two questions here:
I'm running into a similar issue as Tero Paananen did back in December (I think his post describes it well so I'm going to include it below). Also relevant is the thread discussed here: http://forum.springsource.org/archive/index.php/t-123606.html
If I create extend a GraphRepository using GraphRepository<Individual> and use one of its built-in method like findOne(Long id), isn't it reasonable to expect to get back an object of type Individual that wraps a node that was originally of type Individual (i.e. __type__ == 'Individual')?
I understand that there may be a circumstance where one would want to get a node by ID and wrap it with a different type but it seems as if there should be something out-of-the-box that permits type enforcement as well.
If I don't care for the current implementation, would the recommended action be to extend AbstractGraphRepository and override the specific methods?
To work around this, I created a @Query in my repository that would take type into account. My query looks like this:
start n=node({id})
where n.__type__ = 'x.y.z.Individual'
return n
What struck me as strange is that if I specified an ID that didn't exist, the query wouldn't simply return null, it threw a DataRetrievalFailureException. This seems inconsistent with the behavior of findOne(Long id) which would quietly return null.
Is there a reason behind this? Shouldn't it simply return null as well?
Thanks,
-Steve
--
Michael:
I'll think about it and its effects a little more before I write something up.
I'll post the query exception issue tomorrow; also I posted something about repositories for abstract types a little while ago...
Thank you.
-Steve
--
--