Hi Strub,
I looked through the SVN repo but i can't figure out where the
documentation is located. can you point me in the right direction?
Matt
On 24/07/2017 07:01, Mark Struberg wrote:
Hi!
You mind to send a patch?
txs and LieGrue,
strub
Am 21.07.2017 um 23:50 schrieb Matthew Broadhead
<matthew.broadh...@nbmlaw.co.uk>:
Hi Rob,
yes thanks in the end i did this
Join<EntityZ, Detail> detail = entity.join(EntityZ_.details);
the documentation page linked in my first email
(https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/jpa_overview_criteria.html)
is for 2.4.2 which is what i am using bundled in TomEE 7.0.3. the examples
on the page should be updated to reflect what we are saying here?
Matt
On 21/07/2017 19:32, Rob Scala wrote:
Matthew,
I haven't done this yet, but the documentation states that join returns a Join<X,Y> object,
not a Root<X>. I think in your case, it returns a Join<EntityZ,Detail>.
Where does the documentation need to be updated?
Rob
On 07/21/2017 12:50 PM, Matthew Broadhead wrote:
Thanks Rob, this works:
criteriaQuery.where(criteriaBuilder.equal(entity.get(EntityZ_.id), entityId));
maybe the documentation needs updating?
On 21/07/2017 12:49, Rob Scala wrote:
Matthew,
On your second point, expression methods (equal, gt, etc) belong to the
CriteriaBuilder, not to the expressions.
cb.equal(exp1, exp2)
http://docs.oracle.com/javaee/7/api/javax/persistence/criteria/CriteriaBuilder.html
Rob
On 07/21/2017 05:03 AM, Matthew Broadhead wrote:
Following the example on page
https://openjpa.apache.org/builds/2.4.2/apache-openjpa/docs/jpa_overview_criteria.html
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<EntityZ> criteriaQuery =
criteriaBuilder.createQuery(EntityZ.class);
Root<EntityZ> entity = criteriaQuery.from(EntityZ.class);
Root<Detail> detail = entity.join(entity.get(EntityZ_.details));
results in
Type mismatch: cannot convert from Expression<List<Detail>> to SingularAttribute<?
super EntityZ,Y>
also is there a typo?
qdef.where(customer.get(Customer_.name).equal("John
Doe").and(order.get(Order_.status).equal(OrderStatus.DELIVERED).not()));
there is no such function as equal? should it be equals? also in my case:
criteriaQuery.where(entity.get(EntityZ_.id).equals(entityId));
results in:
The method where(Expression<Boolean>) in the type CriteriaQuery<EntityZ> is not
applicable for the arguments (boolean)
--
*Rob Scala*
Director of Information Technology
Buyers Edge, Inc
351 N. Frontage Road, Suite A210
New London, CT 06320
Phone - 860-865-2127
Fax - 860-701-0576