TwinColSelect: Property for selection data and another for value

Hi there

This question might be similar to this one
https://vaadin.com/forum/#!/thread/264632/264631
- but I didn’t find the fitting solution there.

Let’s say I have an object “Clazz” and another one “Student”. (I’ve cut away all the getters and setters for simplicity)

[code]
@Entity
public class Clazz {

@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
protected long id;
protected String name;

}

@Entity
public class Student{
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
protected long id;
protected String firstName;
protected String lastName;
protected Clazz clazz;

}
[/code]I’m creating a Window where you can edit the properties of a class.
So there’s a TextField for the description and a TwinColSelect to select all the students who should be in this class. So far so good.

How can I fetch all the possible students from my EntityManager (using JPAContainer) while binding the real value of the selected students to the property of Student.clazz?

Means: if you modify the TwinColSelect, changes should be reflected in the student’s class property.
Is it even possible without a lot of modifications?

Thanks and best regards
Tobias