File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CriteriaBuilder - I need help converting sql statement

 
Brian Storenson
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to understand how CriteriaBuilder works. I am trying to implement a createPerson() that creates a record for a new person. The method below will be used to check and see if there is 1 or more records that have the same first and last name of the person that I want to add to my database. I want to convert the following sql statement into the Criteria API syntax:

SELECT COUNT( * )
FROM Person p
WHERE UPPER(p.FIRST_NAME) = UPPER('type.firstName') AND UPPER(P.LAST_NAME) = UPPER('type.lastName');




Can you help? I have been looking at the Criteria API, and the JEE tutorial on JPA. Now I am stuck.
 
Brian Storenson
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is supposed to be a good tutorial on JPA Criteria API:
http://www.ibm.com/developerworks/java/library/j-typesafejpa/

I will start reading that now.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic