Jump to content
Changes to the Jaspersoft community edition download ×

wegnerk

Members
  • Posts

    80
  • Joined

  • Last visited

Community Answers

  1. wegnerk's post in Help with Hibernate was marked as the answer   
    here is a code fragment of another way to use hibernate:
     
    Code:Session session;SessionFactory sessionFactory;session.createSession();Map parameterMap = new HashMap();parameterMap.put(JRHibernateQueryExecuterFactory.PARAMETER_HIBERNATE_SESSION, session);try{Jasperprint jasperPrint = JasperFillManager.fillReportToFile("report.jasper", parameterMap);} catch(...){}[/code]
    with the createSession Method:
     
    Code:private Session createSession(){SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();return sessionFactory.openSession();[/code]and so on....
    the important thing is, that you must pass that parameter to the report for using hibernate. And if you use hibernate - queries in the report itself, you have to change your <querystring language="hql">...</querystring>
    for use of Hibernate, you can read the documentation of hibernate.org; and if you download the project.zip of jasperreports, you find a hibernate sample under demo/samples
    hope, that helps a bit, i am not so good in java or hibernate ;-), but i managed it too...
    Post edited by: wegnerk, at: 2006/09/25 12:41
×
×
  • Create New...