Hello Willi,
Suppose your container is PDMLinkProduct and the object is WTPart.
Then you can do it like.
ReferenceFactory factory = new ReferenceFactory();
ObjectReference objRef = (ObjectReference)factory.getReference("OR:wt.pdmlink.PDMLinkProduct:162524”);
PDMLinkProduct product=(( PDMLinkProduct) objRef.getObject());
part.setContainer(product);
Where "wt.pdmlink.PDMLinkProduct:162524" is the object reference or OR of the product.
To use the setContainer method you have to give the object of WTContainer.
If you know only the name of the container then you can also use QuerySpec to get the object