I have a criteria for a search method,
Code:
Criteria criteria = session
.createCriteria(PurchaseOrder.class)
.add(Restrictions.eq("companyCode", code) )
.add(Restrictions.eq("poNumber", poNumber)) ;
Where poNumber is a Long value and companyCode is a object I wrote on my own. I've noticed that when I send in the second restriction in this manner, I get zero results ( there's at least one row in the table).
However if I submit it in this fashion :
Code:
Criteria criteria = session
.createCriteria(PurchaseOrder.class)
.add(Restrictions.eq("companyCode", code) )
.add(Restrictions.eq("poNumber", new Long(9552118900099L))) ;
This returns exactly the result I want (1 row, criteria.list()). My question is: Am I doing something wrong in adding the criteria for the Long value?
I've tried looking at the contents of the criteria after adding the criteria and it looks all right (using toString()). I've tried looking at the generated sql but all I see are question marks in the binded parameters.
Also I've copied out the generated SQL statement and replaced the '?' with the correct values and run it against the database and it seemed all right.
Anyone have any ideas or help on this ? [/code]