Here is the snippet of code i'm processing
| Label l;
| for (Label newLabel : labels) {
| l = entityManager.createQuery(
| "from Label where name = :name and appId = :appId")
| .setParameter("name", newLabel.getName())
| .setParameter("appId", appId);
| l = (Label) q.getSingleResult();
| if (l != null) {
| l.setTrafficLight(tl);
| entityManager.merge(l);
| } else {
| newLabel.setTrafficLight(tl);
| newLabel.setAppId(appId);
| newLabels.add(newLabel);
| }
| }
|
|
The loop iterates once and merges the first existing 'Label'. I got the Exception
an next q.getSingleResult() ....
I did no flush between merge and getSingleResult () .....
Any ideas?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082975#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...