Hi,
I wrote a dyanamic query using JPA 2 Criteria API. At present i have
implemented it below:
Root<Certificate> cert = cq.from(Certificate.class);
Join<Certificate, Loan> l = cert.join("loan");
SetJoin<Loan, Borrower> lb = l.joinSet("loanBorrowers");
Join<Loan, Branch> b = l.join("branch1");
Join<Branch, Customer> cu =
b.join("FK__Branch__Customer");
//then list of predicate
Predicate predicate = cb.equal(lb.get("number"),number.toString());
predicateList.add(predicate);
cq.where(predicates);
cq.multiselect(cert.get("Cert_Number"), cu.get("Cust_Number"),
b.get("Branch_Seq_ID"), b.get("Branch_Check_Digit")).distinct(true);
TypedQuery<Object[]> typedQuery = em.createQuery(cq);
Other way is to use metamodel entities.like instead of Join<Certificate,
Loan> l = cert.join("loan")
Join<Certificate, Loan> l = cert.join(Certificate_.loan");
This creates metamodel classes (i.e. with _). When i execute code, i am
getting error saying these classes are not enhanced. so how to enhance these
classes. Second question is, if i use enhanced classes then are there any
performance issues?
Thanks
Chintan--
View this message in context:
http://openjpa.208410.n2.nabble.com/Need-suggestion-on-Metamodel-usage-tp6317331p6317331.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.