*Create the class*

CREATE CLASS Computer extends V
create property Computer.hostname string
create property Computer.attributes embeddedmap

*Object in Java*

public class Computer {

private Map<String, String> attributes = new HashMap<String, String>();
private String version;

public Map<String, String> getAttributes() {
return attributes;
}

public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
}


*Same code *


Computer computer = new Computer();
computer.setHostname("localhost");
computer.getAttributes().put("name1","value1");
computer.getAttributes().put("name2","value2");


OCommandSQL insert = new OCommandSQL("insert into Computer (hostname, 
attributes) values (?,?)");
OrientGraph connection = = new OrientGraph(url, username, password);
OIdentifiable d = connection.command(insert).execute(
                                 computer.getHostname();
,computer.getAttributes()
);
String record = d.getIdentity().toString();

On Thursday, June 26, 2014 9:16:54 AM UTC-5, Dave wrote:
>
> Hi there!
>
> I'd like to use an embedded Map in my database. Unfortunately, i don't 
> know how the SQL Syntax for insertion in the Map is working.
>
> I use the following Model:
>
> class Page
>  attribute info:String
>  attribute translations:EmbeddedMap of PageInfo
>
> class PageInfo
>  attribute langCode:String
>  attribute translation:String
>
>
> I'd be really thankful if someone could show me how to put a new entry in 
> Page.translations using SQL as well as the Java API.
>
> Best wishes, 
>
> David
>

-- 

--- 
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