事务提交期间出错。空值

时间:2015-04-21 22:47:40

标签: graph-databases orientdb

更新:我发现这是因为我的架构中有一个'链接',我希望字段'createdBy'链接到用户的OUser类,但我似乎无法建立该链接。不知何故,当函数创建V时,它不会从类继承字段类型。有什么想法吗?

-

我在使用函数编写时遇到了问题。我想写入数据库,但我不能。如果我使用正常的orient.getGraph()提交,我会收到以下错误:(OrientDB Version 2.0.7)

Error on parsing script at position #0: Error on execution of the script
Script: newConcept
------^
sun.org.mozilla.javascript.WrappedException: Wrapped com.orientechnologies.orient.core.exception.OStorageException: Error during transaction commit. (
<Unknown source>#26) in 

    <Unknown source> at line number 26
Wrapped com.orientechnologies.orient.core.exception.OStorageException: Error during transaction commit. (
        <Unknown source>#26)
Error during transaction commit.
null

如果我用非事务性尝试它就不会写。

我发送了一个帖子请求,我尝试启用Javascript服务器端脚本,但这不是问题。

这是我的全部功能:

var graph = orient.getGraph();
var currentUserId = getCurrentUserId();
var currentTimeStamp = getCurrentDateString();

//Check if the className is not specified or if the class does not exist.
if(graph.getVertexType(className)==null){
 //return an Error message
 return response.send(500, 'Class does not exist', "application/json", '{ "error": "Class does not yet exist or a blank class was specified, please create the class first." }' );
}

//The var v wraps OrientVertex class
var v = graph.addVertex('class:' + className);

if (label) { v.setProperty('label', label); }
if (value) { v.setProperty('value', value); }
v.setProperty('createdBy', currentUserId);
v.setProperty('createdAt', currentTimeStamp);

//Commit
graph.commit();

return v;

0 个答案:

没有答案