Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OConifigurationException: Can't retrieve pojo [moved] #156

Closed
lvca opened this issue Dec 10, 2012 · 0 comments
Closed

OConifigurationException: Can't retrieve pojo [moved] #156

lvca opened this issue Dec 10, 2012 · 0 comments

Comments

@lvca
Copy link
Member

lvca commented Dec 10, 2012

This is Issue 156 moved from a Google Code project.
Added by 2010-11-24T11:35:49.000Z by [email protected].
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Defect, Priority-Medium, v0.9.24

Original description

Error produced using Version 0.9.24-SNAP
<b>What steps will reproduce the problem?</b>
1. Create new ODatabaseGraph and open it.
2. Create an OClass (Entity) using schema api and save.
3. Create an OClass (Person) that inherits from above class (Entity) using schema api and save.
4. Create a vertex from OClass (Person) in step 3
5. Run query on database.
    Runs as expected!
6. close database
7. Open same database
8. Create a vertex from OClass (Person) in step 3
9. Run query on database.
    Fails with the following error:
Exception in thread &quot;main&quot; com.orientechnologies.orient.core.exception.OConfigurationException: Can't retrieve pojo from the record Person@8:0{name:Joe}
    at com.orientechnologies.orient.core.db.ODatabasePojoAbstract.getUserObjectByRecord(Unknown Source)
    at com.orientechnologies.orient.core.db.ODatabasePojoAbstract.getUserObjectByRecord(Unknown Source)
    at com.orientechnologies.orient.core.db.ODatabasePojoAbstract.query(Unknown Source)
    at test.Start.main(Start.java:44)
Caused by: com.orientechnologies.orient.core.exception.OGraphException: Unrecognized class: Person
    at com.orientechnologies.orient.core.db.graph.ODatabaseGraphTx.newInstance(Unknown Source)
    at com.orientechnologies.orient.core.db.graph.ODatabaseGraphTx.newInstance(Unknown Source)
    at com.orientechnologies.orient.core.db.ODatabasePojoAbstract.getUserObjectByRecord(Unknown Source)
    ... 3 more

My code is below and also attached.

public class Start {

    /**
     * @param args
     */
    public static void main(String[] args) {
        String db_name = &quot;/tmp/graph2/graph.db&quot;;
        new ODatabaseGraphTx(&quot;local:&quot; + db_name).create().close();
        ODatabaseGraphTx database0 = new ODatabaseGraphTx(&quot;local:&quot; + db_name);
        database0.open(&quot;admin&quot;, &quot;admin&quot;);
        OClass entity = database0.getMetadata().getSchema().
                createClass(&quot;Entity&quot;).setSuperClass(database0.getMetadata().
                            getSchema().getClass(OGraphVertex.class));
        entity.createProperty(&quot;name&quot;, OType.STRING);
        entity.save();
        database0.getMetadata().getSchema().createClass(&quot;Person&quot;).
          setSuperClass(database0.getMetadata().getSchema().getClass(&quot;Entity&quot;));
        database0.getMetadata().getSchema().save();

        database0.createVertex(&quot;Person&quot;).set(&quot;name&quot;, &quot;Joe&quot;).save();
        database0.createVertex(&quot;Person&quot;).set(&quot;name&quot;, &quot;Matt&quot;).save();
        List<OGraphVertex> results = database0.
            query(new OSQLSynchQuery<OGraphVertex>(&quot;select from Person&quot;) );

        for (OGraphVertex oGraphVertex : results) {
            System.out.println(oGraphVertex.get(&quot;name&quot;));
        }
        database0.close();

        ODatabaseGraphTx database1 = new ODatabaseGraphTx(&quot;local:&quot; + db_name);
        database1.open(&quot;admin&quot;, &quot;admin&quot;);
        database1.createVertex(&quot;Person&quot;).set(&quot;name&quot;, &quot;Fred&quot;).save();
        database1.createVertex(&quot;Person&quot;).set(&quot;name&quot;, &quot;Mark&quot;).save();
        List<OGraphVertex> results1 = database1.
            query(new OSQLSynchQuery<OGraphVertex>(&quot;select from Person&quot;) );

        for (OGraphVertex oGraphVertex : results1) {
            System.out.println(oGraphVertex.get(&quot;name&quot;));
        }
        database1.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant