Java Code Examples for com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx#newInstance()

The following examples show how to use com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx#newInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityAdapter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Add new entity.
 */
public ODocument addEntity(final ODatabaseDocumentTx db, final T entity) {
  checkNotNull(db);
  checkNotNull(entity);

  // new entity must either have no metadata or it should be a new record
  EntityMetadata metadata = entity.getEntityMetadata();
  checkState(metadata == null || recordIdentity(metadata.getId()).isNew());

  ODocument doc = db.newInstance(typeName);
  return writeEntity(doc, entity);
}
 
Example 2
Source File: BackupRestoreTrial.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private ODocument createPerson(final ODatabaseDocumentTx db) {
  ODocument doc = db.newInstance("Person");
  doc.field("name", "Luke");
  doc.field("surname", "Skywalker");
  doc.field("city", new ODocument("City")
      .field("name", "Rome")
      .field("country", "Italy"));
  doc.save();
  return doc;
}
 
Example 3
Source File: ExportImportTrial.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private ODocument createPerson(final ODatabaseDocumentTx db) {
  ODocument doc = db.newInstance("Person");
  doc.field("name", "Luke");
  doc.field("surname", "Skywalker");
  doc.field("city", new ODocument("City")
      .field("name", "Rome")
      .field("country", "Italy"));
  doc.save();
  return doc;
}
 
Example 4
Source File: OrientDbDocumentTrial.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
private ODocument createPerson(final ODatabaseDocumentTx db) {
  ODocument doc = db.newInstance("Person");
  doc.field("name", "Luke");
  doc.field("surname", "Skywalker");
  doc.field("city", new ODocument("City")
      .field("name", "Rome")
      .field("country", "Italy"));
  doc.save();
  return doc;
}