Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Advanced
May 5, 2009

Writing a Parameterized SQL Query in EJB 3.0

protected EntityManager manager;
...
String ejbqlDelete = "delete from ClientTicket p where " + 
   "p.closed = :paramClosed and " + 
   "p.department = :paramDepartment and " + 
   "p.ticketUserID = :paramTicketUserID and " + 
   "p.ticketName = :paramTicketName";

int deletedEntities = manager.createQuery(ejbqlDelete).
   setParameter("paramClosed", Boolean.TRUE).
   setParameter( "paramDepartment", adminid).
   setParameter( "paramTicketUserID", userID ).
   setParameter( "paramTicketName", delTicket ).
   executeUpdate();
Leonard Anghel
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap