OGlobalConfiguration.CACHE_LEVEL1_ENABLED.setValue(false);
OGlobalConfiguration.DB_USE_DISTRIBUTED_VERSION.setValue(false);
OGlobalConfiguration.NON_TX_RECORD_UPDATE_SYNCH.setValue(true);
OGlobalConfiguration.TX_LOG_SYNCH.setValue(true);
graph = new OrientGraph(location);
here is a database started
vertex = graph.getVertices(itemType.getClassName()+"."+key.name(), "admin")
vertex = current user (#12:0)
private GremlinPipeline<Vertex, Vertex> getPipe(Relationship relation) {
GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex,
Vertex>();
pipe.start(vertex).out(relation.toString().toLowerCase(Locale.ENGLISH));
System.out.println( ((OrientVertex)vertex).getRecord().toJSON() );
return pipe;
}
public void deleteTag(Tag tagDelete) throws DatabaseException,
ItemNotFoundException {
for (TagItem tag : getTagItems()) {
if (tag.getName().equals(tagDelete.getName())) {
database.deleteItem( tag );
}
}
}
where
@Override
public void deleteItem(Item item) throws DatabaseException,
ItemNotFoundException {
Vertex vertex = (Vertex) item.getRawElement();
graph.removeVertex(vertex);
graph.commit();
}
to insert tag to user
@Override
public TagItem addTag(Tag tag) throws DatabaseException {
Logger logger = LoggerFactory.getLogger(database
.getApplication().getLoggerName()+"."+BluePrintFolderItem.class);
TagItem tagItem = null;
tagItem = (TagItem) database.insertItem(Database.ItemType.TAG,
IndexedProperty.OID, tag.getID());
tagItem.setName(tag.getName());
try {
database.associateItem(ItemType.USER, getName(), ItemType.TAG, tag.getID(),
Relationship.TAGS);
} catch (ItemNotFoundException e) {
throw new DatabaseException("cant associate items", e, logger);
}
tagItem.addBlobIDs(tag);
return tagItem;
}
private Vertex addVertex(ItemType type) {
return graph.addVertex(type.getObjectClassNameId());
}
@Override
public synchronized TreeItem insertItem(ItemType type, IndexedProperty key,
String id) throws DatabaseException {
if (!connected.get()) {
throw new DatabaseException("cannot insert tree item. not connected to
database");
}
try {
Vertex vertex = getVertex(type, id);
return getItem(vertex);
} catch (DatabaseException de) {
// vertex doesn't exist, so create!
} catch (ItemNotFoundException e) {
// vertex doesn't exist, so create!
}
Vertex vertex = addVertex(type);
TreeItem item = newItem(vertex, type, id);
if ( key != null ) {
item.setProperty(key.toString(), id);
}
return item;
}
четверг, 3 апреля 2014 г., 14:07:19 UTC+4 пользователь Andrey Lomakin
написал:
>
> Hi,
> Sorry could you provide more details.
> Code snippets and so on ...
>
>
> On Thu, Apr 3, 2014 at 1:06 PM, Valentin Popov
> <[email protected]<javascript:>
> > wrote:
>
>> Hello everybody
>>
>> When I do some DB tasks on a record, and after on for loop trying to get
>> such record from DB always get different record version
>>
>> here is a row representation of a record
>>
>> {"@type":"d","@rid":"#12:0","@version":13,"@class":"v_user","USER_NAME":"admin","EMAIL":"[]","in_user":"#27:0"}
>>
>> (1st time)
>>
>>
>> {"@type":"d","@rid":"#12:0","@version":22,"@class":"v_user","USER_NAME":"admin","EMAIL":"[]","in_user":"#27:0","out_tags":"#28:2"}
>>
>>
>> {"@type":"d","@rid":"#12:0","@version":22,"@class":"v_user","USER_NAME":"admin","EMAIL":"[]","in_user":"#27:0","out_tags":"#28:2"}
>>
>>
>> {"@type":"d","@rid":"#12:0","@version":11,"@class":"v_user","USER_NAME":"admin","EMAIL":"[]","in_user":"#27:0","out_tags":"#28:0"}
>>
>> {"@type":"d","@rid":"#12:0","@version":14,"@class":"v_user","USER_NAME":"admin","EMAIL":"[]","in_user":"#27:0"}
>>
>> (last time)
>>
>>
>> Regards,
>>
>> Valentin
>>
>>
>> --
>>
>> ---
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Best regards,
> Andrey Lomakin.
>
> Orient Technologies
> the Company behind OrientDB
>
>
--
---
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.