The Key class in Objectify 4 has this method:
public static <T> Key<T> create(T pojo)
therefore, if you have already read an object (called category in this example) from the data store, you can simply call
product.categoria = Key.create(category);
Martin trummer
source share