toplink-essentials

JPA - saving changes without persist() invoked

≯℡__Kan透↙ 提交于 2019-11-27 16:21:54
问题 We are using Toplink implementation of JPA + Spring + EJB. In one of our EJBs we have something like this: public void updateUser(long userId, String newName){ User u = em.get(User.class, userId); u.setName(newName); // no persist is invoked here } So, basically this updateUser() method is supposed to update the name of a user with the given userId . But the author of this method forgot to invoke em.persist(u) . And the strangest thing is that it works fine. How can it be? I was 100% sure

Setting a parameter as a list for an IN expression

岁酱吖の 提交于 2019-11-27 08:17:18
Whenever I try to set a list as a parameter for use in an IN expression I get an Illegal argument exception. Various posts on the internet seem to indicate that this is possible, but it's certainly not working for me. I'm using Glassfish V2.1 with Toplink. Has anyone else been able to get this to work, if so how? here's some example code: List<String> logins = em.createQuery("SELECT a.accountManager.loginName " + "FROM Account a " + "WHERE a.id IN (:ids)") .setParameter("ids",Arrays.asList(new Long(1000100), new Long(1000110))) .getResultList(); and the relevant part of the stack trace: java

Setting a parameter as a list for an IN expression

流过昼夜 提交于 2019-11-26 14:07:07
问题 Whenever I try to set a list as a parameter for use in an IN expression I get an Illegal argument exception. Various posts on the internet seem to indicate that this is possible, but it's certainly not working for me. I'm using Glassfish V2.1 with Toplink. Has anyone else been able to get this to work, if so how? here's some example code: List<String> logins = em.createQuery("SELECT a.accountManager.loginName " + "FROM Account a " + "WHERE a.id IN (:ids)") .setParameter("ids",Arrays.asList