English 中文(简体)
最新参考文献
原标题:Grails update references

我怎么能对关系提出反对,并坚持这一关系?

如果是这样的话,

registrationInstance.addToActionType(id:id)

我仅举一个例外。

Unique index or primary key violation: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)"; SQL statement: insert into action_type_registrations (action_type_id, registration_id) values (?, ?) [23001-147]

EDIT:

如果是,

registrationInstance.addToActionType(ActionType.get(id))

我也看到同样的错误,但这种错误依然存在——因此我如何能够消除这一错误?

EDIT:

如果我试图删除一个物体:

registrationInstance.removeFromActionType(ActionType.get(id))

我收到以下错误(有时,不是所有途径)

Eindeutiger Index oder Primarschlüssel verletzt: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)" Unique index or primary key violation: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)"; SQL statement: update action_type_registrations set action_type_id=? where registration_id=? and action_type_idx=? [23001-147]
最佳回答

您必须加入这一关系:

registrationInstance.addToActionType(ActionType.load(id))
registrationInstance.save()
问题回答

它不认为本案已经收集。 实施可见<代码>hashCode和qualitys <代码>行动方法 类型如此之六能够发现它已经存在,而不是试图在<代码>上制造重复记录。 行动:请参见表格。





相关问题
Multiple Hibernate instances using C3P0

I am facing a weird problem and it seems to be c3p0 related. I am starting two instances of an app in the same java vm which interact with each other. After some operations "APPARENT DEADLOCK" ...

Hibernate vs Ibatis caching

We can speed up a hibernate app easyly with 2nd level cache using infinispan or ehcache/terracotta,... but ibatis only have a simple interface to implement for caching. And hibernate knows more ...

Using annotations to implement a static join in hibernate

I m relatively new to hibernate and was wondering if someone could help me out. While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I m ...

Hibernate query with fetch question

I have a 2 entities in a One-To-Many relationship: OfficeView.java: public class OfficeView implements java.io.Serializable { private Integer officeId; private String addr1; private ...

hibernate interceptors : afterTransactionCompletion

I wrote a Hibernate interceptor : public class MyInterceptor extends EmptyInterceptor { private boolean isCanal=false; public boolean onSave(Object entity, Serializable arg1, Object[] arg2, String[]...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....

Hibernate Criteria API equivalent for "elements()"

Is it possible to implement the following query using Criteria API? select order from ORDER as order,ITEM as item where item.itemID like ITM_01 and item in elements(order.items)

热门标签