我正在编辑ravenDB实例中的现有文档。 我面临的主要问题是我没有错误但没有保存更改。 我正在使用以下代码:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter: InvocationTargetException: Unable to find: checkstyle-suppressions.xml -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project webservices.rest: Failed during checkstyle configuration
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed during checkstyle configuration
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module SuppressionFilter - Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Cannot set property 'file' to 'checkstyle-suppressions.xml' in module SuppressionFilter
感谢
编辑:在此代码中添加了session.save_changes()。测试,但我在另一个项目中有这条线,我面临同样的问题。
答案 0 :(得分:2)
我认为您必须调用 session.save_changes()方法,以便数据库事务完成:
#in init method
self.store = document_store.documentstore(url=self.dbURL, database=self.dbInUse)
self.store.initialize()
def someMethodToSaveData(self, id, newTextField="")
with self.store.open_session() as session:
doc = session.load(id)
doc.newTextField=newTextField
session.store(doc,id)
session.save_changes() # this call is important
我在官方 RavenDB documentation:
中找到了这些信息