[jboss-user] [JBoss Seam] - Re: 2 DataModel questions
bfo81
do-not-reply at jboss.com
Thu Aug 31 07:31:05 EDT 2006
better idea for deleteSelected, with a real delete query (that's faster):
Vector idsToDelete = new Vector();
|
| for (Item item: listOfItems)
| if(item.isDelete())
| idsToDelete.add(item.getId());
|
| if (idsToDelete.size() == 0)
| return null;
|
| String ids = idsToDelete.toString(); //e.g. [1,4,5]
| ids = ids.substring(1, ids.length()-1); //e.g. 1,4,5 (brackets removed)
|
| String query = "delete from Item where id in (" + ids + ")";
| em.createQuery(query).executeUpdate();
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968601#3968601
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968601
More information about the jboss-user
mailing list