RE: helpmeeee

Please don’t ask the same question multiple times in separate threads. Now,
this
and
this
thread contain the exact same question.

Also, you should state the question in the thread title. Just saying “help” only reduces your chances of getting an answer, and nobody else will find the answer later if they would need it.

For your question, if I understood correctly, you have something like this:

class BeanA {
  private BeanB bean;
  ...
}

and you want to display

  • the name of BeanB in a table that shows BeanA instances
  • the name of BeanB in a Select component (or something like that) on a form

For the table, you can

  • implement toString() in BeanB or
  • override Table.formatPropertyValue() or
  • define a generated column that does the formatting, and give the generated column the same name as the property name so it will replace the automatically generated column

For the form saving to work, you can

  • use a FieldWrapper or a CustomField from the
    CustomField add-on
    to do conversions between the item ID and the bean B or
  • use a container like BeanItemContainer for the select - then the item ids are the beans themselves, but if you override BeanB.equals() and BeanB.hashCode(), they have to be suitable for BeanItemContainer or
  • declare a constructor for BeanB that takes a String parameter (item id) and constructs a correct BeanB instance, so that equals() returns true when comparing to the original one - this approach is often not so simple to do correctly

If you do not implement BeanB.toString(), you can use AbstractSelect.setItemCaptionPropertyId() to tell how to show them in the selection component.

There might be other solutions as well.