Skip to content

Not persisting to JanusGraph #54

@oodles-arvind-das

Description

@oodles-arvind-das

I am trying to use ferma ORM for my project . Current problem is, I am not able to persist my entities to JanusGraph DB.
Here is my code Required :
Entity Class




public abstract class Person extends AbstractVertexFrame {
    private String id;
    private String name;
    private int age;
    private String mobile;

    @Property("age")
    public abstract int getAge();

    @Property("age")
    public abstract void setAge(int age) ;

    @Property("mobile")
    public abstract String getMobile();

    @Property("mobile")
    public abstract void setMobile(String mobile) ;

    public String getId() {
        return id;
    }

    @Property("name")
    public abstract String getName() ;

    @Property("name")
    public abstract  void setName(String name);

    public String toString(){
        return this.name+" has Id"+this.getId();
    }
}

This is how I create/initialize my DelegatedFramedGraph bean:

@Bean
    FramedGraph framedGraph(JanusGraph graph,GremlinBeanPostProcessor gremlinBeanPostProcessor){
        return new DelegatingFramedGraph(graph,true,gremlinBeanPostProcessor.getEntityClasses());
    }

JanusGraph is initialized :

@Bean
    JanusGraph graph(JanusGremlinGraphFactory janusGremlinGraphFactory){
        JanusGraph janusGraph = null;
        janusGraph = janusGremlinGraphFactory.openGraph();
        return janusGraph;
    }

    @Bean
    JanusGremlinGraphFactory janusGremlinGraphFactory(){
        JanusGremlinGraphFactory jggf;
        jggf = new JanusGremlinGraphFactory();
        jggf.setConfiguration(getConfiguration());
        return jggf;
    }

When I try to persist it:

 @Autowired
    private FramedGraph framedGraph;

public String savePerson(String name,int age,String mobile){
        Person person =  framedGraph.addFramedVertex(Person.class);
        person.setName(name);
        person.setAge(age);
        person.setMobile(mobile);
        System.out.println(person.getName()+"and person id is"+person.getId());
        return person.toString();
    }

Nothing is stored to JanusGraph, not sure where is the problem.

Can somebody help me ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions