Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Cannot set the string value (a) to parameter 1.
nhew
Hi All,<br />
<br />
I was wondering if someone can help me with this issue. I'm quite sure this kind of question would have been answered before however I've tried searching the forums and its quite difficult to search for related strings, hence my posting.<br />
<br />
A little background. So far I've managed to get an oda hibernate driver successfully integrated with my app. I can pull out very simple result sets via the ui.<br />
eg <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>From TokyoData</pre>
<br />
However, I'm not able to get parameters to work.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>From TokyoData where TokyoId = ?</pre> <br />
where TokyoId is of type Long<br />
<br />
<br />
Here is error message below....<br />
Caused by: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: Cannot set the decimal value (28,934) to parameter 1.<br />
IQuery.setBigDecimal( int parameterId, BigDecimal value )<br />
<br />
I've also tried other combinations, such as setting Parameters to String <br />
<br />
<br />
This is my second implementation. The first implementation was using a straight jdbc data source which did not have this issue.<br />
<br />
Would anyone be able to point me to the right direction or know of a link to a topic that had been answered previously.
Find more posts tagged with
Comments
CBR
I m assuming that TokyoId is of database data type long
Can you try datatype Integer in the parameters tab of the data set?
String won't work and decimal neither because JDBC is checking that the incoming data type is matching the one in the database.
nhew
Cbrell, Thank you for replying.
The help you gave me led me to solving the true nature of the problem.
If anyone else is interested, here is the solution.
The reason for the failure was not due to using Integer or String or Decimal, although using Integer as the datatype is more accurate.
As i was trying to create an oda hibernate driver, the implementation for IQuery.SetDecimal was not implemented and was throwing Unsupported Exception. (which was the real cause and sorry i didn't notice it earlier)
After implementing it (and a few code massages here and there) it works now.
One other question that i have, If anyone can answer, is there any real benefit to creating you own oda plugin vs scripted POJOs. As i'm plugging in BIRT into my app's infrastructure (spring, hibernate, jsf) I would not be able to leverage the existing infrastructure but to rely on ODA plugin which to me is another set of code to maintain. If anyone has thoughts or experience on this, i would like to hear it.
CBR
Hi,
i m not sure how you implemented your ODA plugin but for me a generic ODA plugin is always better then the scripted data set approach.
Reasons:
1) Scripted Data Sets are often implemented using Rhino. Rhino is about 10 times slower then pure Java (depending on what you do)
2) Scripted Data Sets add heavy logic to the reports. This code is even much worse to maintain then something written in Java.
3) It is often required to implement different data sets so the code differs from one report to another report. Again you have even more code to maintain
4) Reports are more instable because they are often maintained/changed by non developers (so they most likely break something in a complex report that contains code they do not understand)
5) Working with scripted data sets isn't fun at all. It might become really time consuming in case there is an error. Finding a problem in Rhino is like finding a needle inside of an haystack.
This is just my 2 cents. If other people have a different opinion i would be happy to hear about it! Perhaps we can start a little flamewar about the pros and cons (which would be fun)
nhew
Christian, thanks so much for that input.<br />
<br />
I have been doing some more reading and for me creating an ODA plugin to leverage hibernate<br />
was the wrong track for me. (Although great experience)<br />
<br />
As I'm already using JSF, it would seem the only way to leverage existing POJO via backing bean is by<br />
using scripted Data Set + JSF4Birt. (correct me if I'm wrong)<br />
<br />
Here is a link i found to use Pojos...<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/wiki/index.php?title=BIRT:Data_Access#Q:_How_do_I_get_data_from_a_POJO_.28Plain_Old_Java_Object.29.3F'>http://www.birt-exchange.org/org/wiki/index.php?title=BIRT:Data_Access#Q:_How_do_I_get_data_from_a_POJO_.28Plain_Old_Java_Object.29.3F</a><br
/>
<br />
...and here is how i would get a handle on my backing beans.<br />
When i create the report in "beforeOpen"<br />
I would use something like this to get a handle of the backing bean.<br />
Which i can then use to retrieve my list of POJOs to iterate.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(javax.faces.context.FacesContext)
public static <T> T findBean(String managedBeanName) {
FacesContext context = FacesContext.getCurrentInstance();
return (T) context.getApplication().evaluateExpressionGet(context, "#{" + managedBeanName + "}", Object.class);
}
</pre>
<br />
There aren't many examples out there so I had piece the information from various sources but would like to know of any other ways.