openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Criteria API; AND 1 = 1 in WHERE Clause
Date Tue, 28 Jun 2011 16:42:01 GMT
Hi,

   Please post UnternehmenUrv_ and other such *_ classes. I know where is
the 1 = 1 clause is introduced but can not figure out why exactly.
  
   Nits:
   1.    Join&lt;UnternehmenUrv, Adresse&gt; adresseJoin = untRoot.join(
                UnternehmenUrv_.adressen.getName(), JoinType.INNER); 

       A simpler (and slightly more effective) form would be to get rid of
.getName(). Actually by calling getName(), the code is loosing type-safety
and OpenJPA is working twice to restore it !

     Join&lt;UnternehmenUrv, Adresse&gt; adresseJoin = untRoot.join(
                UnternehmenUrv_.adressen, JoinType.INNER); 

   2. cq.where(cb.and(predicates.toArray(new Predicate[0]))); 

      A better form would be (would save JVM to instantiate an extra array
unnecessarily)

      cq.where(cb.and(predicates.toArray(new
Predicate[predicates.size()]))); 


-----
Pinaki 
--
View this message in context: http://openjpa.208410.n2.nabble.com/Criteria-API-AND-1-1-in-WHERE-Clause-tp6373899p6525633.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message