jpacontainer manytomany throws ClassCastException

hi,

i have a problem with jpacontainer and manytomany relation.

I have 2 entities… first is an entity like tasks … second is users.

so a task could be done by more than one user. and a user can work on more than one task.

and i`ve created an editor for tasks… with fields like taskName,taskStartDate, taskEndDate, etc… and a table for the manytomany-relation with users. in my fieldfactory the manytomany-table looks like this:



@Override
	public Field createField(Item item, Object propertyId, Component uiContext) {
		Field field = DefaultFieldFactory.get().createField(item, propertyId,
				uiContext);

		if ("user".equals(propertyId)) {
			field = createUserTable(propertyId);
		}
		if ("taskStartDate".equals(propertyId)) {
			DateField field = (DateField) field;
			field.setDateFormat("dd.MM.yyyy");
		}
		if (field instanceof TextField) {
			((TextField) field).setNullRepresentation("");
		}
		return field;
	}

	private Field createUserTable(Object propertyId) {
		userTable = new Table();
		userTable.setSelectable(true);
		userTable.setMultiSelect(true);

		userContainer = JPAContainerFactory.makeReadOnly(User.class,em);

		userContainer.sort(new String[] { "lastname" }, new boolean[]
 { true });

		userTable.setPropertyDataSource(new MultiSelectTranslator(userTable));

		userTable.setCaption(DefaultFieldFactory
				.createCaptionByPropertyId(propertyId));
		userTable.setContainerDataSource(userContainer);
		userTable.setVisibleColumns(new Object[] { "lastname", "firstname",
				"phone" });
		userTable.setColumnHeader("lastname", "Nachname");
		userTable.setColumnHeader("firstname", "Vorname");
		userTable.setColumnHeader("phone", "Telefon");
		userTable.setImmediate(true);

		return userTable;
	}

this works fine, if i update an existing task, which i have inserted via mysql workbench. i can save the task and if i select some users for this task, they are saved too.

but if i try to create a new task and select some users, this exception is thrown:

com.vaadin.data.Property$ConversionException: java.lang.ClassCastException: com.vaadin.data.util.MethodProperty cannot be cast to com.vaadin.addon.jpacontainer.EntityItemProperty
at com.vaadin.addon.jpacontainer.fieldfactory.PropertyTranslator.setValue(PropertyTranslator.java:220)
at com.vaadin.ui.AbstractField.commit(AbstractField.java:268)…

is this a problem because the existing task item is from table.getValue() and the new task is created in this way:
Task newTask = new Task();
BeanItem newTaskItem = new BeanItem(newTask);

my environment is jboss with eclipselink and mysql. let me know if you need further information…!

thank you!!