spring - neo4j Error mapping GraphModel to instance -
i have problem neo4j , spring. want use ogm create endpoint managing entities.
the following lines controller:
@controller @enableautoconfiguration @requestmapping("/customer") public class mainapp { @requestmapping(method = requestmethod.get) @responsebody string customerinfo(){ return "uuid fehlt"; } @requestmapping(path="/{id}", method = requestmethod.get) public customer getbyid(@pathvariable long id) { customerservice customerservice = new customerservice(); return customerservice.find(id); } @requestmapping("/create") @responsebody customer home() { customerservice customerservice = new customerservice(); customer c=new customer("peter"); c=customerservice.createorupdate(c); return c; } public static void main(string[] args) throws exception { springapplication.run(mainapp.class, args); } creation works fine , responds proper json, containing information new generated node.
when try query node using id, receive error: error mapping graphmodel instance of datahandler.entities.customer
the problem seems somewhere in method find:
abstract class genericservice<t extends entity> implements service<t> { private static final int depth_list = 0; private static final int depth_entity = 1; protected session session = neo4jsessionfactory.getinstance().getneo4jsession(); @override public iterable<t> findall() { return session.loadall(getentitytype(), depth_list); } @override public t find(long id) { return session.load(getentitytype(), id, depth_entity); } @override public void delete(long id) { session.delete(session.load(getentitytype(), id)); } @override public t createorupdate(t entity) { session.save(entity, depth_entity); return find(entity.getid()); } abstract class<t> getentitytype(); }
Comments
Post a Comment