hi all,

Reading the wiki about learning how to save, update my Java object to my 
OrientDB graph (1.7-SNAPSHOT), I am a little bit disappointed...

Let say I have two Java classes "Person" (with name, address, ...) and 
"Knows" (with some string attributes).
I would like to have a graph where Person objects are vertex and Knows 
objects are edges:
Vertex  <- Edge -> Vertex
Person::toto <-  Knows::knowTotoTiti -> Person::titi

Reading 
wiki/Object-Database<https://github.com/orientechnologies/orientdb/wiki/Object-Database>,
 
I can understand that I can add an object to the DB as following:

>    OObjectDatabase db = new 
> OObjectDatabaseTx("remote:localhost/petshop").open("admin", "admin");
>     db.getEntityManager().registerEntityClass(Person.class);
>     Person person = db.newInstance(Person.class);
>     person.setName( "Antoni" );
>     person.setSurname( "Gaudi" );
>     db.save( person );

1°)
Here is my first questions: how to access to the EntityManager or the 
OObjectDatabase when I use OrientGraphFactory to access to my DB?

OrientGraphFactory factory = new OrientGraphFactory(DB_PATH);
> ODatabaseDocumentTx database = factory.getDatabase(); //PB: does not 
> provide with an entity manager
> OrientGraph graph = factory.getTx(); 


2°)
How to specify that Person objects are vertex and Knows objects are edges?
Do I need to create a full schema that correponds to my Person and Knows 
classes as mentionned on 
wiki/Graph-Schema<https://github.com/orientechnologies/orientdb/wiki/Graph-Schema>
?

OObjectDatabase db = new 
> OObjectDatabaseTx("remote:localhost/petshop").open("admin", "admin");
> OrientGraph graph = new OrientGraph("local:/temp/db");
> OrientVertexType personV = graph.createVertexType("Person");
> personV.createProperty("name", OType.STRING);
> personV.createProperty("birthDate", OType.DATE);


Could you please help me to understand how to manage custom classes with 
OrientDB graph?
Does anyone have a full sample about adding custom vertex and edges in a 
graph with the Java API?

Thank you

-- 

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

Reply via email to