Hibernate, createCriteria and Jasper Report


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Hibernate, createCriteria and Jasper Report

  1. #1
    Join Date
    Apr 2006
    Posts
    1

    Hibernate, createCriteria and Jasper Report

    Hi
    I want to feed a Jasper Report with the join of two tables.
    I am using hibernate.
    My source code is like:

    public List view_report()
    {
    success=false;
    List results ;
    try
    {
    Session session = HibernateFactory.getSession();
    HibernateFactory.beginTransaction();
    results = HibernateFactory.getSession().createCriteria(Payroll.class).setFetchMode("employee",FetchM ode.JOIN).list();

    HibernateFactory.commitTransaction();
    HibernateFactory.closeSession();
    }
    catch (Exception ex)
    {
    ex.printStackTrace();
    return null;
    }
    return results;
    }

    Now when i run the Jasper Report, i get the error

    java.lang.NoSuchMethodException: Unknown property 'empid'.

    What should be done to correct this ?

  2. #2
    Join Date
    May 2006
    Posts
    23
    Its hard to tell -- might be a question you should post on hibernate.org. Having said that, does hibernate successfully persist the Payro II object without running it in JasperReport. The reason I ask is because there appears to be a space in your class named 'Payro ll.class' <--- Which I just copied and pasted from your reference. What class throws the exception? You might want to look at the fatal & error hibernates log stacks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center