////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

GORM for Neo4j will map each Grails domain instance to a Node in the node space. For example given the following domain class:


[source,groovy]
----
class Pet {
    String name
}
----

Each domain class will implement the link:../api/grails/neo4j/Neo4jEntity.html[Neo4jEntity] trait. You can define this explicitly if you prefer (the `Node` trait is a subtrait of `Neo4jEntity`):

[source,groovy]
----
import grails.neo4j.Node

class Pet implements Node<Pet> {
    String name
}
----

When an instance of `Pet` is saved:

[source,groovy]
----
def p = new Pet(name:"Dino")
p.save(flush:true)
----

Then the following Cypher `CREATE` is issued:

[source,groovy]
----
CREATE (n2:Pet {props})
----

The properties of the class are converted to native Neo4j types and set as the `props` parameter to the query.

NOTE: If you want to see what queries GORM for Neo4j generates, enabling logging for the `org.grails.datastore.gorm.neo4j` package
