pojos with the graph db

122 views
Skip to first unread message

Aris Alexis

unread,
Feb 9, 2015, 10:15:34 AM2/9/15
to orient-...@googlegroups.com
Hi,

I am just starting to use orient so be easy on me. I am a bit confused about how to use the graph database.

What I want:

I have a POJO with references to other POJOS like:

User

String name
List<Notifications> notifications

Notification

String date
String type


I want this user connected to the graph with other entities(pojos). I was using titan with blueprints and titan could store a pojo by having a null constructor and an overriden equals function.

Also, can I retrieve a User from a Vertex much like I could map a document to this pojo? or is it only possible if you use the object or document version?

thanks

Luca Garulli

unread,
Feb 9, 2015, 10:44:58 AM2/9/15
to orient-database
Hi Aris,
Did you use Frames with Titan to map graphs to POJOs?

Lvc@

--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aris Alexis

unread,
Feb 9, 2015, 4:27:51 PM2/9/15
to orient-...@googlegroups.com
Hi,

no I didn't use frames, I used just my own methods to map all the properties of the vertex to the POJO. The difference was that in the example above, the TitanVertex implementation would accept :
vertex.setProperty(List<Notification>) and it could return it as such (with casting). These are objects that I do not need to look up values in queries etc, I just want them persisted.
Ok it is not a big deal, I can persist a JSON representation of the object and then convert it.
It is also a bit unclear when you first read the docs if you can use vertices as documents or documents/objects as vertices.

Luca Garulli

unread,
Feb 9, 2015, 5:12:13 PM2/9/15
to orient-database
On 9 February 2015 at 22:27, Aris Alexis <snowbo...@gmail.com> wrote:
Hi,

no I didn't use frames, I used just my own methods to map all the properties of the vertex to the POJO. The difference was that in the example above, the TitanVertex implementation would accept :
vertex.setProperty(List<Notification>) and it could return it as such (with casting). These are objects that I do not need to look up values in queries etc, I just want them persisted.
Ok it is not a big deal, I can persist a JSON representation of the object and then convert it.
It is also a bit unclear when you first read the docs if you can use vertices as documents or documents/objects as vertices.

Hi Aris,
You could use:

OrientVertex.setProperties(final Object... fields)

It accepts var-args:

v.setProperties("name", "Luca", "surname", "Garulli", "age", 38);

Or a Map of key/values:

Map<String,Object> map = new HashMap<String,Object>();
map.put("name", "Luca");
map.put("surname", "Garulli");
map.put("age", 38);
v.setProperties(map);

Lvc@

 



On Monday, February 9, 2015 at 4:44:58 PM UTC+1, Lvc@ wrote:
Hi Aris,
Did you use Frames with Titan to map graphs to POJOs?

Lvc@
On 9 February 2015 at 16:15, Aris Alexis <snowbo...@gmail.com> wrote:
Hi,

I am just starting to use orient so be easy on me. I am a bit confused about how to use the graph database.

What I want:

I have a POJO with references to other POJOS like:

User

String name
List<Notifications> notifications

Notification

String date
String type


I want this user connected to the graph with other entities(pojos). I was using titan with blueprints and titan could store a pojo by having a null constructor and an overriden equals function.

Also, can I retrieve a User from a Vertex much like I could map a document to this pojo? or is it only possible if you use the object or document version?

thanks

--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages