开发者

How to do ajax-lookup in edit screen in Wicket dropdown with hibernate?

开发者 https://www.devze.com 2023-03-09 04:16 出处:网络
I have the following structue: class A { B value } class B { } The relation between them in mapped bidirectionally in Hibernate, so I get use b.getListOfA() to retrieve all the A\'s referring B an

I have the following structue:

class A { B value }

class B { }

The relation between them in mapped bidirectionally in Hibernate, so I get use b.getListOfA() to retrieve all the A's referring B and vice versa.

I have a Wicket Application that has a edit screen to edit class A. This screen is initialized from a DataTable with the model that the DataRowProvider gives (it is a LoadableDetachableModel). When not using ajax, I can get a perfectly fine drop down list (the standard wicket component), that I fill by quering for all B's.

Now I'm trying to make the DropDownChoice a AutoCompleteTextBox. It al works fine, I can pick a B and it is filled correctly set in the model of A.

But when I try to save the edited instance of A, I get a hibernate exception:

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated开发者_开发百科 with the session

I use the OpenSessionInView Filter from Spring and the saveOrUpdate method to save my objects.

Any hints? Clues? Debugging tips?

0

精彩评论

暂无评论...
验证码 换一张
取 消