Hi,
I tried to inject the metadata and entity-UDC into the service bean. I can assemble project successfully in CUBA studio. But when I run the program, the login screen never show in chrome. If I remarked these four lines, it works fine. Isn’t it supported by CUBA?
@Service(CitService.NAME)
public class CitServiceBean implements CitService {
//Remark from here.
@Inject
private Metadata metadata;
@Inject
private UDC udc;
//Remark to here.
@Override
public void GetCITItem() {
}
}
What behavior you expect, when you are trying to inject an Entity? It doesn’t make sense. Entity can have lots of instances, and you can load them from database, using DataManager or Persistence. You also can create it through the Metadata.create(UDC.class).
If you want to have single instance of the entity per application, I’d advise you to manually add it in database and load it after application initialization.