Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-14-2021 05:35 AM
I need to declare a member variable List propertyNodes in my Procedure class, as shown in the code below. But below code gives me an error while running unit test case (error starting Neo4j database...) While if I initialize the variable inside the procedure function, it works perfectly fine.
Any solution/help will be deeply appreciated.
public class connectToActivities {
@Context
public Transaction tx;
//this is the member variable I am refering to - Property is a class.
public List<Node> propertyNodes = new Property().getProperty(tx);
enum MyRelationshipTypes implements RelationshipType
{
input
}
@Procedure(mode = Mode.WRITE )
@Description("Connect Inputs To Activities")
public void connectInputsToActivities(@Name("node") Node n)
{
//Property property = new Property();
//List<Node> propertyNodes = property.getProperty(tx);
}
}// end of class
07-15-2021 05:32 AM
Those procedure classes are stateless holders of methods for the procedures. They cannot have member variables.
If you need intermediate classes for operations/state during the procedure execution, you need to declare those classes separately.
Please note that for writing stored procedures you should have a good understanding and skill in Java development, otherwise you might trip over a lot of things.
07-16-2021 02:19 AM
Thankyou for the information.
All the sessions of the conference are now available online