Hi,
I am writing a subquery that look like this:
select * from SUPPLIER where trim(suppProdId) IN (SELECT ProdId FROM PRODUCT)
The 'suppProdId' in SUPPLIER table is of char(20) data type.
The 'ProdId' in PRODUCT table is of varchar(40) data type
So in order to retrieve the records, I will need to do a trim to the 'suppProdId'.
Below is part of my code using detached criteria expression:
q = session.createCriteria(Supplier.class);
DetachedCriteria p = DetachedCriteria.forClass(Product.class)
.setProjection(Property.forName("ProdId"));
q.add(Property.forName("suppProdId").in(p));
However, there is no records retrieved when I used the detached criteria expression.
Is there a way where I can trim the data of the 'suppProdId'?
Thanks in advance.
|