Hi all,

Im having problems with my EJB QL statements. Im using MySQL as my database..

The SQL statement below works perfectly on MySQL:

  | select o.dateArrived, o.custName , o.IDCategory
  | from tblMessages AS o WHERE o.IDCategory =  "+categoryId+"  and DATE_SUB( 
'"+dateReceived+"' , INTERVAL 2 DAY )  <= o.datArrived ORDER BY o.datArrived 
DESC


When transfered the statements to my facade:

  | public List getData(String categoryId, String dateReceived){
  |         
  |         return em.createQuery
  |        ("select o.dateArrived, o.custName , o.IDCategory"+                
  |        "from TblMessages AS o WHERE o.IDCategory = "+categoryId+" and "+
  |         "and DATE_SUB( '"+dateReceived+"' ,     INTERVAL 2 DAY )  <= 
o.dateArrived,              
  |         ORDER BY o.datReceived DESC").getResultList();
  |       
  | }



It produce an exception: javax.ejb.EJBException: 
javax.persistence.PersistenceException: 
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 2

Any suggestions?

Thanks. :)

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997761#3997761

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997761
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to