Can i transfer Integer to ItemID?

Hello, i have Integer field in db table - parentID. I want built tree, where parentID equal this field.
But vaadin dont transfer integer to ItemID directly.
Can i solved this problem?

Can you box it with Integer object?

What does it mean “box it with integer object” - give me example please…

I mean to use Java autoboxing and put integer as an Integer. Container API and Tree component support adding an item with a type of Object so the integer should be usable.

My variable which getting value from db is Object type

if i adding hierarchy Items manually with integer id like in the Vaadin Book - all OK, if Items from SQL container with integer column - not work

Code below not work

Object parentID = it.getItemProperty("hierarhy").getValue();
ttable.setParent(itemId, parentID);

What is the error it is producing?

I have no error in this case, but items dont want conect in hierarchy

if i find parent item with Equal filter then after that all ok

Are you using addItem(Object) and not addItem() method when adding items?

i dont using additem function.
i doing next :

  1. Connect SQL container to db table
  2. Create TreeTable object
  3. Connect TreeTable with SQL container
  4. Loop on TreeTable’s items and connect it in hierarchy

I’m sure, you don’t want to use SQLContainer for anything.

I would query the ResultSet from the database and fill TreeTable manually.

(EDIT: I don’t think SQLContainer supports hierarchical)

Here’s a very good blog about that:

i know about manually creation items approach, but i thing that itemID is integer type wrapping in object type, but it is wrong definition in real situation.