我的实体中有多对多的双向关系.请参阅以下示例:
public class Collaboration {
@JsonManagedReference("COLLABORATION_TAG")
private Set<Tag> tags;
}
public class Tag {
@JsonBackReference("COLLABORATION_TAG")
private Set<Collaboration> collaborations;
}
Run Code Online (Sandbox Code Playgroud)
当我尝试将其序列化为JSON时,我遇到以下异常:`
"java.lang.IllegalArgumentException:无法处理托管/后向引用'COLLABORATION_TAG':后引用类型(java.util.Set)与托管类型(foo.Collaboration)不兼容.
实际上,我知道这是有道理的,因为javadoc明确声明你不能在集合上使用@JsonBackReference.我的问题是,我应该如何解决这个问题?我现在所做的是删除父端的@JsonManagedReference注释,并在子端添加@JsonIgnore.有人能告诉我这种方法有什么副作用吗?还有其他建议吗?
似乎Neo4J高可用性仅适用于付费的企业版 - 是否有另一种替代方案可以在没有该模块的情况下实现复制?(即没有成本).谢谢你的帮助!
我计划将Web应用程序与mysql服务一起移动到cloudfoundry.但我收到了以下错误.
它与当地环境合作良好.日志文件也生成了.
以下是错误日志:
Jan 5, 2013 7:35:59 AM org.cloudfoundry.reconfiguration.AbstractServiceConfigurer configure
INFO: No beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory found in application context
Jan 5, 2013 7:35:59 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jan 5, 2013 7:35:59 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
log4j:WARN Continuable parsing error 109 and column 23
log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appender*,plugin*,(category|logger)*,root?,(categoryFactory|loggerFactory)?)".
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /logs/abc-web.log (No such file or directory)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:177) …Run Code Online (Sandbox Code Playgroud) 我需要设置闪电战JavaSpaces (这里).在Blitz安装指南中,其中一个必需的软件包是JINI 2.1的入门套件,但提供的链接已损坏,我似乎无法在其他任何地方找到它.我一直在看Apache River Project,¿我应该安装这个而不是缺少JINI 2.1吗?根本没有或几乎没有任何文档,这真的让我觉得闪电战正在破坏其先决条件之一的链接.这让我想到了另一个问题 - 闪电战的实施是否可靠?
非常感谢
当我使用Spring Data Neo4j(SDN)查找节点实体时,我遇到了一些奇怪的行为.如果我使用GraphRepository.findOne(long),它将返回具有该标识符的实体,即使该实体的类型不同.
这就是我(非常)简化的实体结构:
@NodeEntity
protected abstract class BaseEntity {
@GraphId
private Long id;
@JsonIgnore
@RelatedTo(type = RelationType.ENTITY_AUDIT)
private Audit audit;
}
@NodeEntity
public final class Person extends BaseEntity {
@Indexed(indexType = IndexType.FULLTEXT)
private String firstName;
@Indexed(indexType = IndexType.FULLTEXT)
private String lastName;
}
@NodeEntity
public class Audit extends BaseEntity {
@RelatedTo(type = RelationType.ENTITY_AUDIT, direction = Direction.INCOMING)
private BaseEntity parent;
private Long date;
private String user;
}
Run Code Online (Sandbox Code Playgroud)
对于每种实体类型,我都创建了这样的存储库:
@Repository
public interface PersonRepository extends GraphRepository<Person> {}
@Repository
public interface AuditRepository extends GraphRepository<Audit> …Run Code Online (Sandbox Code Playgroud) 我在Spring Data Neo4j项目中使用了Neo4j的简单和高级映射模式.由于我已经从简单映射切换到高级映射,因此该项目的性能非常好,我的意思是真的比以前好多了.我没有确切的数字,但肯定是众多.有人可以澄清为什么高级映射模式优于简单映射吗?
我已经阅读了SDN文档中的Prorgramming Model页面,但我找不到确切的原因.
为了记录,我正在使用Spring的@Transactional支持.
有没有办法将所有项目集合复制到新集合而不循环所有项目?我找到了一种通过 DBCursor 进行循环的方法:
...
DB db = mongoTemplate.getDb();
DBCursor cursor = db.getCollection("xxx").find();
//loop all items in collection
while (cursor.hasNext()) {
BasicDBObject b = (BasicDBObject) cursor.next();
// copy to new collection
service.createNewCollection(b);
}
...
Run Code Online (Sandbox Code Playgroud)
你能建议在java中复制而不循环所有项目吗?
(不在 mongo shell 中,使用 java 实现)Tnx。
我目前正在开发一个使用Spring Data Neo4j的项目.每当创建NodeEntity时,我想创建一个包含创建日期和用户的引用的Audit NodeEntity.
我提出的解决方案是编写一个AOP Aspect,它挂钩我的服务层的create方法.这适用于没有级联的实体,但级联的实体呢?这没有在我的服务层中明确传递,所以我的AOP类不会拦截它们.是否有像JPA中的实体侦听器这样的概念,或者我如何挂钩到这个机制?
我的项目是spring-data-neo4j,当运行mvn clean install时,会出现maven构建错误.
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.sun.jersey:jersey-project:pom:1.9
Reason: Cannot find parent: net.java:jvnet-parent for project: com.sun.jersey:jersey-project:pom:1.9 for project com.sun.jersey:jersey-project:pom:1.9
Run Code Online (Sandbox Code Playgroud) 在 Sesame 2.8.1 存储库的帮助下,我无法将 Topbraid Composer 4.6.3 连接到 Stardog 3.0。这些是我正在遵循的步骤:


另外值得一提的是,Stardog 中启用了安全性。因此,我在芝麻工作台的 SPARQL 查询端点 URL 中添加了凭据 (http;//admin:admin@url)。没有为芝麻配置安全性。
我想知道哪个工具将成为瓶颈。有没有人做过类似的事情?
java ×5
neo4j ×5
nosql ×2
spring-data ×2
collections ×1
entity ×1
graph ×1
jackson ×1
javaspaces ×1
jini ×1
json ×1
log4j ×1
many-to-many ×1
maven ×1
mongodb ×1
performance ×1
rdf ×1
sesame ×1
sparql ×1
spring ×1
stardog ×1