Jump to content

iReport&Hibernate JRRuntimeException [Solved]


quaternion

Recommended Posts

I have established a successful Hibernate Connection, the test button tell me so.

When I go to preview my report I get:

net.sf.jasperreports.engine.JRRuntimeException: Unknown HQL return alias "id".     at net.sf.jasperreports.engine.data.JRHibernateAbstractDataSource.getFieldReader(JRHibernateAbstractDataSource.java:185)     at net.sf.jasperreports.engine.data.JRHibernateAbstractDataSource.assignReaders(JRHibernateAbstractDataSource.java:128)

.....

The query is working fine in my program.  The xml files were constructed mostly by my IDE (Netbeans 6.9, although they've been using the same hibernate tools since 6.5)...

Here is the xml generated by iReports (no comments follow):

<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="MarnWHMISv1" language="groovy" pageWidth="792" pageHeight="612" orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <queryString language="hql">
        <![CDATA[        from Prprsnl snl
        join snl.prperson person
        where snl.plclas='WMS' and
          person.ppstat = 'A' and
           (person.id.pppgrp = 'RO' or
            person.id.pppgrp = '01')]]>
    </queryString>
    <field name="id" class="co88pxh.PrprsnlId"/>
    <field name="plclas" class="java.lang.String"/>
    <field name="plcom1" class="java.lang.String"/>
    <field name="plcom2" class="java.lang.String"/>
    <field name="pleddy" class="java.lang.Byte"/>
    <field name="pledmn" class="java.lang.Byte"/>
    <field name="pledyr" class="java.lang.Short"/>
    <field name="plevdy" class="java.lang.Byte"/>
    <field name="plevmn" class="java.lang.Byte"/>
    <field name="plevyr" class="java.lang.Short"/>
    <field name="plsrc1" class="java.lang.String"/>
    <field name="plsrc2" class="java.lang.String"/>
    <field name="plsrc3" class="java.lang.String"/>
    <field name="plstat" class="java.lang.Character"/>
    <field name="plstdy" class="java.lang.Byte"/>
    <field name="plstmn" class="java.lang.Byte"/>
    <field name="plstur" class="java.lang.String"/>
    <field name="plstyr" class="java.lang.Short"/>
    <field name="prperson" class="co88pxh.Prperson"/>
    <field name="address" class="co88dth.Dtname"/>
    <field name="pbtdy" class="java.lang.Byte"/>
    <field name="pbtmn" class="java.lang.Byte"/>
    <field name="pbtyr" class="java.lang.Short"/>
    <field name="pnseq" class="java.lang.String"/>
    <field name="ppagrp" class="java.lang.String"/>
    <field name="ppahc" class="java.lang.String"/>
    <field name="ppaid" class="java.lang.String"/>
    <field name="ppcls1" class="java.lang.String"/>
    <field name="ppcls2" class="java.lang.String"/>
    <field name="ppcls3" class="java.lang.String"/>
    <field name="ppdrlc" class="java.lang.String"/>
    <field name="ppdrvl" class="java.lang.String"/>
    <field name="ppfnam" class="java.lang.String"/>
    <field name="ppmnam" class="java.lang.String"/>
    <field name="ppmst" class="java.lang.Character"/>
    <field name="ppndep" class="java.lang.Byte"/>
    <field name="ppnfmt" class="java.lang.Character"/>
    <field name="ppnnam" class="java.lang.String"/>
    <field name="ppphar" class="java.lang.String"/>
    <field name="ppphex" class="java.lang.String"/>
    <field name="ppphnm" class="java.lang.String"/>
    <field name="ppsnam" class="java.lang.String"/>
    <field name="ppstat" class="java.lang.Character"/>
    <field name="ppstdy" class="java.lang.Byte"/>
    <field name="ppstmn" class="java.lang.Byte"/>
    <field name="ppstur" class="java.lang.String"/>
    <field name="ppstyr" class="java.lang.Short"/>
    <field name="pqualf" class="java.lang.String"/>
    <field name="prprsnls" class="java.util.Set"/>
    <field name="psin" class="java.lang.String"/>
    <field name="ptitle" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="99" splitType="Stretch">
            <image>
                <reportElement positionType="Float" x="288" y="0" width="217" height="99"/>
                <imageExpression class="java.lang.String"><![CDATA["/home/ken/Media/Pictures/Marnevic/MarnevicTransparent.jpg"]]></imageExpression>
            </image>
        </band>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="24" splitType="Stretch">
            <staticText>
                <reportElement x="0" y="0" width="93" height="20"/>
                <textElement/>
                <text><![CDATA[Employee #]]></text>
            </staticText>
            <staticText>
                <reportElement x="106" y="0" width="100" height="20"/>
                <textElement/>
                <text><![CDATA[Name]]></text>
            </staticText>
            <staticText>
                <reportElement x="243" y="0" width="100" height="20"/>
                <textElement/>
                <text><![CDATA[Course]]></text>
            </staticText>
            <staticText>
                <reportElement x="365" y="0" width="100" height="20"/>
                <textElement/>
                <text><![CDATA[Ticket #]]></text>
            </staticText>
            <staticText>
                <reportElement x="476" y="0" width="100" height="20"/>
                <textElement/>
                <text><![CDATA[Course Date]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="24" splitType="Stretch">
            <textField>
                <reportElement x="106" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{ppfnam} + " " + $F{ppmnam} + " " + $F{ppsnam}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="243" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{plcom1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="365" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{plcom2}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="476" y="0" width="100" height="20"/>
                <textElement/>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{plevyr} + "-" + $F{plevmn} + "-" + $F{plevdy}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
    <columnFooter>
        <band height="6" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="41" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="5" splitType="Stretch"/>
    </summary>
</jasperReport>
 

 



Post Edited by quaternion at 07/26/2010 23:28



Post Edited by quaternion at 07/26/2010 23:42
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Okay... I did change the query used by the report from the one used in my program.

The one in my program did a "left join fetch"

and when I copied the query in,  iReport told me it would not except the query... something to do with lists.

So I added the fetch back in by editing the xml... and I reduced the set of fields to just what I needed, and it's all working now!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...