Question On @Datamodel Outjection
hasc May 21, 2007 3:58 AMHello,
i have a problem outjecting a datamodel.
i have a class the holds the business logic for a calculation process. It holds the Entity Calculation.class where the data is stored. during the calculation i create another object that holds the response information.
@Stateful
@Scope(ScopeType.CONVERSATION)
@Name("scmanager")
public class CalculationManagerBean implements CalculationManager{
@In(create=true)
ExpressCalculator expresscalculator;
@Out(scope=ScopeType.CONVERSATION,required=false)
BudgetOverview budgetOverview;
...
@Create
public void init(){
log.debug("initialize new calculation entity");
calculation = new Calculation(user);
return;
}
/*** business logic ***/
public void executeExpressCalculation(){
budgetOverview = expresscalculator.calculate(calculation);
}
...
}@Stateless
@Name("expresscalculator")
public class ExpressCalculatorBean implements ExpressCalculator {
public BudgetOverview calculate(Calculation calculation) {
// initialise BudgetOverview
BudgetOverview budgetOverview = new BudgetOverview();
//some code
// this is the datamodel
Set<CostItem> costItems = calculateInstallationCosts();
budgetOverview.setCostItems(costItems);
return budgetOverview;
}
// some functions
}and here is the class BudgetOverview
@Name("budgetOverview")
@Scope(ScopeType.CONVERSATION)
public class BudgetOverview{
// some attributes
// the datamodel
@Datamodel
public Set<CostItem> costitems;
// getter and setter methods
}So the problem is:
In the view I can display all attributes from the budgetOverview except the datamodel selectitems. But i can e.g. display the size of the datamodel. So it is set properly just not outjected.
If i change the code and outject the datamodel in the CalculationManager class and initialize it via a getter method from the BudgetOberview it works fine.
I have no clue if i made a mistake or the overall concept of outjecting an object that outjects a datamodel doesnt work.
Help would be great. and i hope you could follow this explanation.
thanks,
hasc