[JBoss Seam] - Question On @Datamodel Outjection
by hasc
Hello,
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047125#4047125
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047125
18 years, 11 months
[JBoss Seam] - Exception while generation the jasper Reports using Seam
by d.solasa
Hi
I am trying to generate jasper reports using seam.for that i have used the following code
InputStream input = this.getClass().getClassLoader().getResourceAsStream(reportName);
JasperDesign design = JRXmlLoader.load(input);
JasperReport report = JasperCompileManager.compileReport(design);
InitialContext initialContext = new InitialContext();
DataSource ds = (DataSource) initialContext.lookup("java:/claims");
conn = ds.getConnection();
JasperPrint print = JasperFillManager.fillReport(report, parameters, conn);
String fileName = "D:/downloads/ireport/" + showType;
OutputStream output = new FileOutputStream(new File(fileName));
JasperExportManager.exportReportToPdfStream(print, output);
FileInputStream fis = new FileInputStream(fileName);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
and when i tried to rum i am getting the following exception as
12:18:41,966 INFO [JasperReporter] Exceptionnet.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports
ngine.JRException: Class "net.sf.jasperreports.engine.query.JRJdbcQueryExecuterFactory" should be compatible with "net.sf.jasperreports.engine.query.JRQue
ExecuterFactory"
Then i changed the code i tried it by setting jdt-compiler-4.1.1 .jar to the class path
FacesContext facesCtx = FacesContext.getCurrentInstance();
Map parameters = new HashMap();
InputStream input = this.getClass().getClassLoader().getResourceAsStream(reportName);
JasperDesign design = JRXmlLoader.load(input);
JasperReport report = JasperCompileManager.compileReport(design);
log.info("jasper design is"+design);
log.info("inputStream is" + input);
// get a database connection
InitialContext initialContext = new InitialContext();
DataSource ds = (DataSource) initialContext.lookup("java:/claims");
conn = ds.getConnection();
JasperPrint print = JasperFillManager.fillReport(report, parameters, conn);
String fileName = "D:/downloads/ireport/" + showType;
OutputStream output = new FileOutputStream(new File(fileName));
//System.setProperty("jasper.reports.compiler.class","org.eclipse.jdt.internal.compiler.Compiler");
//JasperRunManager.runReportToPdfStream(input,facesCtx.getResponseStream(),parameters,conn);
facesCtx.getResponseStream().flush();
facesCtx.getResponseStream().close();
facesCtx.responseComplete();
String destFileNamePdf = "opencclaimdecission.pdf";
// create JasperPrint using fillReport() method
JasperPrint print = JasperFillManager.fillReport(reportName, parameters, conn);
JasperExportManager.exportReportToPdfFile(print, destFileNamePdf);*/
Even now i am getting the Exception as
12:26:30,884 INFO [JasperReporter] Exceptionnet.sf.jasperreports.engine.JRException: Could not instantiate report compiler : net.sf.jasperreports.engine.
sign.JRJavacCompiler
So plz help me what s the solution to generate the jasper Reports....NEed to implement in my roject so urgently..
Thanx in Advance for any type of suggestions
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047116#4047116
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047116
18 years, 11 months