在这个基准测试中,ObjectDB是最快的数据库:http: //www.jpab.org/All/All/All.html
但我看不到ObjectDB的任何其他基准测试结果.是否有人使用ObjectDB?生产准备好了吗?有什么经历?
我是JPA/JDO和整个objectdb世界的新手.
我有一个带有一组字符串的实体,看起来有点像:
@Entity
public class Foo{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Key id;
private Set<String> bars;
public void setBars(Set<String> newBars){
if(this.bars == null)
this.bars = new HashSet<String>;
this.bars = newBars;
}
public Set<String> getBars(){
return this.bars;
}
public void addBar(String bar){
if(this.bars == null)
this.bars = new HashSet<String>;
this.bars.add(bar);
}
}
Run Code Online (Sandbox Code Playgroud)
现在,在代码的另一部分,我正在尝试做这样的事情:
EntityManager em = EMF.get().createEntityManager();
Foo myFoo = em.find(Foo.class, fooKey);
em.getTransaction().begin();
myFoo.addBar(newBar);
em.merge(myFoo);
em.getTransaction().commit();
Run Code Online (Sandbox Code Playgroud)
当然,当newBar是String时.
但是,我得到的是:
javax.jdo.JDODetachedFieldAccessException: You have just attempted to access field "bars" yet this field was not detached …Run Code Online (Sandbox Code Playgroud)