Hi all!
I have two entities User and Product. I added a third - which connects the first two - UserProduct.
package com.company.upgrade.V1.entity;
import com.company.impl.upgrade.V1.entity.User;
import com.company.impl.upgrade.V1.entity.Product;
or
import com.company.impl.entity.User;
import com.company.impl.entity.Product;
@Preload
public interface UserProduct extends Entity {
User getUser();
void setUser(User user);
Product getProduct();
void setProduct(Product product);
}
I have dragged entities into the task upgrade folder. Imports to other items were displayed as follows:
import com.company.impl.entity.User;
import com.company.impl.entity.Product;
I want to add one product for all users (a bad example - I know). But I cannot do it because it looks like:
private void setProduct(ActiveObjects ao) {
Product[] products = ao.find(Product.class, Query.select().where("NAME = ?", "smth"));
Product product = products[0];
User[] users= ao.find(User.class);
for (User user: users) {
UserProduct userProduct = ao.create(UserProduct.class);
userProduct .setProduct(product);
userProduct .setUser(user);
}
}
I mean: UserProduct_V1 = {User + Product}
(User and Product without V1)
Should I swap imports like this? :
import com.company.impl.upgrade.V1.entity.User;
import com.company.impl.upgrade.V1.entity.Product;
In the tasks preceding the upgrade, I did not change the imports. Everything works. But there was no need to create linked objects.