The code should create all the constraints one by one, since I'm using a new session object for each call. Shouldn't each Session.close commit the transaction?
After the first constraint is created, I get:
error : Neo4jError: Database constraints have changed (txId=26) after this transaction (txId=1) started, which is not yet supported. Please retry your transaction to ensure all constraints are executed.