In my anylogic-project i query datasets from the internal database. The table i want to query has following structure:
Name: product_innovation_level
--------------------------------
ID|level_customer|level_employee|
--|--------------|--------------|
1| 10| 14|
The only example i could find uses the Tuple-class as shown below. It works, but it feels quite clunky that i have to extract the needed values manually from the item.
Tuple innovationLevel = selectFrom(product_innovation_level).
where(product_innovation_level.id.eq(1)).
firstResult(product_innovation_level.level_customer, product_innovation_level.level_employee);
double ngEmployee = innovationLevel.get(product_innovation_level.level_employee);
double ngCustomer = innovationLevel.get(product_innovation_level.level_customer);
Is there a better way to select the values directly into an model class? I'm looking for something like this:
xxx innovationLevel = selectFrom(product_innovation_level).
where(product_innovation_level.id.eq(1)).
firstResult(xxx);
What class i schould use for xxx? I found an automatically created class Qproduct_innovation_level, but i didn't found a way to access the values of this dataset.
Qproduct_innovation_level innovationLevel = selectFrom(product_innovation_level).
where(product_innovation_level.id.eq(1)).
firstResult(product_innovation_level);
int i = innovationLevel.level_customer.intValue();
Error: Type mismatch: cannot convert from NumberExpression<Integer> to int
I tried to write a model-class on my own, but here i get type-mismatch error (cannot convert from Qproduct_innovation_level to InnovationLevelModel).