Relationship properties with Neo4j plugin for Grails

251 views
Skip to first unread message

Alessandro Mazzotti

unread,
Mar 1, 2012, 11:44:52 AM3/1/12
to ne...@googlegroups.com
Hello,

is it possible to access relationship properties using the neo4j GORM plugin in Grails? Looking to the documentation I'd say no, but maybe I didn't see something. If not, what would be the best way to access them, considering that I'm using the GORM plugin to persist domain objects?

Thanks

Alessandro

Stefan Armbruster

unread,
Mar 2, 2012, 5:19:24 AM3/2/12
to ne...@googlegroups.com
Hi,

as of now the mapping of domain class to the nodespace does not use any
properties on relationships.
Domain classes have a injected method "getNode()" to have access to the
node representing the domain class instance. So you might use:

def myDomainInstance = DomainClass.findByXXXXXX
def rel = myDomainInstance.node.getRelationship(type, direction)
rel.setProperty("mykey","myvalue")

where type and direction depend on the domain class relation you want to
follow.

If you have a generic use case for this, please file a feature request
at https://github.com/SpringSource/grails-data-mapping/issues.

Regards,
Stefan

Alessandro Mazzotti

unread,
Mar 2, 2012, 5:44:47 AM3/2/12
to ne...@googlegroups.com
Thanks Stefan,

I wrote also on the grails user list but your answer here solve my problem

Regards

Alessandro

Alex Frieden

unread,
Mar 29, 2013, 9:33:08 AM3/29/13
to ne...@googlegroups.com
This allows you to get the relationship, how do you create one?
Reply all
Reply to author
Forward
0 new messages