dea*_*mon 9 java hibernate jpa playframework
如果我保存包含以下列表的对象
@OneToMany(cascade=CascadeType.ALL, mappedBy="taskList")
@OrderColumn(name="position", nullable=false)
public List<Task> tasks = new ArrayList<Task>();
Run Code Online (Sandbox Code Playgroud)
我得到了例外
org.hibernate.HibernateException: Found two representations of same collection
Run Code Online (Sandbox Code Playgroud)
Play中的代码!控制器看起来像这样:
TaskList taskList = taskList.findById(taskListId);
taskList.add(position, task);
taskList.save();
Run Code Online (Sandbox Code Playgroud)
如果我taskList.refresh()在此块之前插入它可以工作,但位置信息丢失(这会导致其他错误).
这是一个Hibernate错误还是我的代码有问题?
| 归档时间: |
|
| 查看次数: |
25961 次 |
| 最近记录: |