Thursday, June 27, 2013

JPQL: parameter using LIKE clause

Example named query:

    @NamedQuery(
        name = "BismarkPlan.findBismarkPlanByClientIdAndBismarkPlanNameOrBismarkPlanCode"
        ,query  = "SELECT bp FROM BismarkPlan bp"
                    + ", BusinessProposalFormalization bpf"
                    + ", BusinessProposalFormalizationItem bpfi"        
                + " WHERE bpfi.businessProposalFormalizationId = bpf.id"
                    + " AND bpfi.bismarkPlanId = bp.id"
                    + " AND bpf.clientId =:clientId"
                    + " AND (bp.code LIKE :code OR bp.name LIKE :name)"
    )

then calling the query:

Long clientId = 2;
String bismarkPlanCode = "PB";
String bismarkPlanName = "Plan";
        
// TODO: use JPA querybuilder instead of namedqueries
Query query = em.createNamedQuery("BismarkPlan.findBismarkPlanByClientIdAndBismarkPlanNameOrBismarkPlanCode");
query.setParameter("clientId", clientId);
query.setParameter("code", "%" + bismarkPlanCode + "%");
query.setParameter("name", "%" + bismarkPlanName + "%");
List<BismarkPlan> returnList = query.getResultList();

Resource:
http://stackoverflow.com/questions/1341104/parameter-in-like-clause-jpql


XAMPP 1.8.1 Apache 2.4 AH00526: Syntax error ProxyPass worker name (...) too long. Bug

I was getting this error:

AH00526: Syntax error on line 228 of E:/Documents/Dropbox/Programs/windows7/xampp-win32-1.8.1-VC9/xampp/apache/conf/extr
a/httpd-proxy.conf:
ProxyPass worker name (http://localhost:8080/SIBismarkRestServer/webresources/com.expertix.bismark.si.entities.orderrequ
est/) too long

In this link https://issues.apache.org/bugzilla/show_bug.cgi?id=53218 Says that increasing in the mod_proxy.h file the PROXY_WORKER_MAX_NAME_SIZE value from 96 to a number that fits in your workername, ie

from
#define PROXY_WORKER_MAX_NAME_SIZE      96

to
#define PROXY_WORKER_MAX_NAME_SIZE      192

But I continue getting that error, no matter my url http://localhost:8080/SIBismarkRestServer/webresources/com.expertix.bismark.si.entities.orderrequ
est/ was 101 characters

So I had to make my url shorter