In ireportDesigner 5.6.0, I am adding an image from database. When I add that image,in xml it is shown as java.lang.Object
and I have changed it to java.a
With additional info that you added this is what I would do:
The correct field class should be java.sql.Blob
(corrispond to the database mapping)
<field name="companyLogo" class="java.sql.Blob">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
The image expression should be (On the Blob
we call the getBinaryStream()
that gives us a java.io.InputStream
)
<image>
<reportElement x="0" y="0" width="107" height="79" uuid="fba6c6a9-42a2-4ffb-9d80-f0721728a7b6"/>
<imageExpression class="java.io.InputStream"><![CDATA[$F{companyLogo}.getBinaryStream()]]></imageExpression>
</image>
To improve code some it would be great to check that $F{companyLogo}!=null
,
a small note... why not pass it as parameter, hence load it in your java and pass it as a java.io.InputStream or java.io.Image... this way maybe also your jasper gets cleaner...