Getting a value from a table with no relation to it

What should I do if I want to get the value from a table with no relation to it.
In my design I have a table which is called Constants, which have all the constant saved in it. How can I pick on of them and use it in one of the other tables. I have tried making a CollectionDatasource and then get the value in the file, but for some reason the CollectionDatasource always came to be empy, even thought the table itself is not empty and when I tried to display it on the screen in a table the CollectionDatasource seemed to work fine. So why isn’t the data availiable in the CollectionDatasource when I use it in the file.

Why are you using table with constants.
Constants is non changeable in Java.
What are you trying to make?

You may use Enumeration to hold static values or
Declare them staticly in your code.

I thought about using Enumerations, but then will I be able to update them later on, or will they be constant forever?

Enumeration is key/value pairs you create from within cuba-studio or IDE.
They can only be created or updated in development time. Is sort of static in runtime.
They is easy to create and maintain if you want to change them later on.
Enumerators can also use Localized values so you can change the name but not value.
If you shall only use the constants in code. I recomment you to create a static Class with constants


public final Myclass{
      public static final String myConstant = "Constant";

      public static final Integer myIntConstant = 10;

If you are looking for other Attributes Cuba has the Attribute which you can define at runtime.
Entites (datatables) is for live data CRUD. Don’t use database tables to store constants.

CollectionDatasource always came to be empy

If a CollectionDatasource is not used by visual components, it does not load data automatically - for performance reasons. But you can manually make it load: call its refresh() method in the init() method of your controller.

Alternatively, you can load entities on the client tier using DataManager.