How to get Column DataTypes from DatatablesCriterias

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to get Column DataTypes from DatatablesCriterias

SaiRam
Hi ,
  I am new to this forum and new to Dandellion. I try best to articulate the
issue we are facing in our project and hope you can help us in driving to the solution.
Thanks

Issue:
we are using JSP , Tomcat AppServer , Servlet API 3.0 , IE browser, Spring and Hibernate in Application

In the existing application we are using datatables in JSP , using DatatablesCriterias in controller and calling
service & DAO layers. In DAO we are using Hibernate Query  by passing the QueryString StringBuffer , due to this we have SQLInjection issues and we are trying to work to alter this now by changing it to use the Query.SetParameter.
But the problem here is from DatatablesCriterias I am able to fetch the columnnames but not the Column datatypes
and due to this when I use query.setParameter which always use String and its throwing ClassCastexceptiion as being some of the columns are long datatype.

I would like to is there any way to fetch/determine the ColumnDatatype from DatatablesCriterias or through any other object of Dandellion.

Any direction on this will be a great help

datatables in JSP

<datatables:column title="Action" property="id">


In the controller using  (@DatatablesParams DatatablesCriterias criterias)

in DAO
queryString - StringBuffer
Query query = sessionFactory.getCurrentSession().createQuery(queryString+"");

ColumnDef columnDef : DatatablesCriterias.getColumnDefs()
String currColumnName = columnDef.getName();
query.setParameter(currColumnName,"%'"+criterias.getSearch().toLowerCase().toString()+"'%")