JPAContainer and Tree drag and drop.

Hi,

I have a database with hierarchy. I use a parent is for this.
I load the JPAContainer in a Tree UI and that works. But when I drag and drop and try setting the parent to the target I get a new entry in the database. What am I missing here?

// Allow the tree to receive drag drops and handle them
        groupTree.setDropHandler(new DropHandler() {
            public AcceptCriterion getAcceptCriterion() {
                return AcceptAll.get();
            }

            public void drop(DragAndDropEvent event) {
                // Wrapper for the object that is dragged
                Transferable t = event.getTransferable();

                // Make sure the drag source is the same tree
                if (t.getSourceComponent() != groupTree)
                    return;

                TreeTargetDetails target = (TreeTargetDetails) event
                        .getTargetDetails();

                // Get ids of the dragged item and the target item
                Object sourceItemId = t.getData("itemId");
                Object targetItemId = target.getItemIdOver();

                // On which side of the target the item was dropped
                VerticalDropLocation location = target.getDropLocation();

                HierarchicalEntityContainer<Creator> container = (HierarchicalEntityContainer<Creator>) groupTree
                        .getContainerDataSource();

                EntityItem<Creator> sourceItem = container.getItem(sourceItemId);
                EntityItem<Creator> targetItem = container.getItem(targetItemId);

                System.out.println("source:" + sourceItem.getItemProperty("name"));
                System.out.println("target:" + targetItem.getItemProperty("name"));

                // Drop right on an item -> make it a child
                if (location == VerticalDropLocation.MIDDLE) {
                    Object parentId = container.getParent(targetItemId);
                    EntityItem<Creator> parentItem = container.getItem(sourceItemId);
                    sourceItem.getItemProperty("parent").setValue(parentItem);
                } 
            }
        });
        setFirstComponent(groupTree);
    }