May 6, 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 ” +

Avoid Object Instantiation Within Loops

Avoid defining new objects within loop structures. Doing so hampers performance significantly, due to object creation overhead. Instead, define objects outside the loop and then use them inside the loop.