Hi there,

I have a big project coming up and i consider Neo4j as my primary database. 
My problem is, that i hit a wall right at the start of my evaluation ..

Technology:
Java

Neo4j Community Server 2.3.2
neo4j-ogm 1.1.4 library to access the database 
javaee-api 7.0

payara 4.1.1 server (basically glassfish)


it's a minimal POC project with just 1 entity class.

-----
@NodeEntity(label = "Account")
public class Account {
    
    @GraphId
    public Long id;

    @Property(name = "first_name")
    public String firstname;
    @Property(name = "last_name")
    public String lastname;

    // getters and setters
}

and a sessionFactory, mostly 1:1 as on all the neo4j tutorials:

public class Database{
    
    String username = "neo4j";
    String password = "neo4jj";
    private static Database factory = new Database();
    private final static SessionFactory sessionFactory = new 
SessionFactory("foobar.domain");

    public static Database getInstance() {
                return factory;
        }
    
    private Database() {
    }

    public Session getNeo4jSession() {
            return sessionFactory.openSession("http://localhost:7474";, 
username, password);
    }
}


and a store/service class for that entity

@Named
@Stateless
public class AccountStore{

    private static final int DEPTH_LIST = 0;
    private static final int DEPTH_ENTITY = 1;
    private Session session = Database.getInstance().getNeo4jSession();

    public Iterable<Account> findAll() {
        return session.loadAll(Account.class, DEPTH_LIST);
    }

    public Account find(Long id) {
        return session.load(Account.class, id, DEPTH_ENTITY);
    }

    public void delete(Long id) {
        session.delete(session.load(Account.class, id));
    }

    public Account createOrUpdate(Account entity) {
        session.save(entity, DEPTH_ENTITY);
        return find(((Account) entity).getId());
    }
}


and a small bean that triggers all of that : 

@Named(value = "mockBean")
@SessionScoped
public class MockBean {
    
    @Inject
    AccountStore accStore;
    
    public void startMock(){
        
        Account acc = new Account();
        acc.setFirstname("Foo " + System.currentTimeMillis());
        acc.setLastname("Bar " + System.currentTimeMillis());
        
        Account storedAcc = accStore.createOrUpdate(acc);
        System.out.println("Account created with id: " + storedAcc.getId());
    }
}

and i always get this error:

Caused by: org.neo4j.ogm.session.result.ResultProcessingException: 
"errors":[{"code":"Neo.ClientError.Statement.InvalidType","message":"Expected 
a numeric value for empty iterator, but got null"}]}
at 
org.neo4j.ogm.session.response.JsonResponse.parseErrors(JsonResponse.java:165)
at 
org.neo4j.ogm.session.response.JsonResponse.parseColumns(JsonResponse.java:139)
at 
org.neo4j.ogm.session.response.JsonResponse.initialiseScan(JsonResponse.java:75)
at 
org.neo4j.ogm.session.response.GraphModelResponse.initialiseScan(GraphModelResponse.java:69)
at 
org.neo4j.ogm.session.response.GraphModelResponse.<init>(GraphModelResponse.java:39)
... 99 more

what can i do ? with this error message, there is just 1 stackoverflow 
result in google (3 google results overall !!)
and this stackoverflow error is related to Relationships .. so this does 
not apply here.

What am i doing wrong ?

Best regards

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to