Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Reusable BeanItem

Deleted User
1 decade ago Mar 05, 2010 11:16am
Deleted User
1 decade ago Mar 10, 2010 11:37am
Deleted User
1 decade ago Mar 11, 2010 2:43pm

Suggested patch provided here: http://dev.vaadin.com/ticket/4302

Jonatan Kronqvist
1 decade ago Mar 15, 2010 6:46am
Deleted User
1 decade ago Mar 15, 2010 11:51am
Ingo van Lil
1 decade ago Jun 29, 2011 12:22pm

I've got another use case for the proposed changes: When working with Hibernate a detached instance (from a previous session) can be attached to the current session using the merge() method. This method returns a new reference to the same entity, and at the same time the old reference should be discarded. It's still valid and usable, but it's no longer kept up-to-date, e.g. new values of generated properties will not be reflected.

In this case it would be very helpful to have an item.setBean() method to update the BeanItem to use the new reference. All tables, forms and trees showing the item would be automatically updated. Without the method I have to either create a BeanItem for the new instance and replace the old item in all containers and forms, or simply reload the entire container contents from the database.