Set default entity on linked tables

Hi, i have table VENDOR, and TABLE CUSTOMER, with relation ManyToOne .

How and where can i programm to, if only exists ONE VENDOR, when i create a new CUSTOMER, put in linked field automatically them ?

Thanks!

You can do it in the following ways:

  • In a @PostConstruct annotated method in the entity class. Use DataManager to load the Vendor.
  • In a Customer browser by providing the Vendor to the CreateAction.
  • In the initNewItem() method of the Customer editor.
  • In a BeforeInsertEntityListener for Customer entity. In this case, you will not see the reference in UI until the entity is committed.