File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes code review: JPA criteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "code review: JPA criteria" Watch "code review: JPA criteria" New topic
Author

code review: JPA criteria

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

I was working on some JPA code here at CodeRanch. There's a lot of boilerplate code in using the Criteria API so I wanted to do something about that before creating a second use of it. Anything in here that is wrong/could be better? It does compile and run correctly. I just find it hard to believe this is the best way of using the API. And I couldn't find anything better to express the common code in the middle. I want to be able to call multiple Criterias from different methods in the same DAO so I was stuck with the anonymous inner class.

Superclass has:


And subclass has:


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code review: JPA criteria
 
Similar Threads
Searching row in database by a column which is not a primary key
JSF 2.0 selectOneMenu control not populated
Can anyone tell why is this query not valid?
How to count the number of rows of a JPA 2 CriteriaQuery in a generic JPA DAO?
JPA criteriaBuilder method not found