|
Hi All, There is a problem in DaoJpa if you are using a primitive number (int, double, float, long) @Id the method save always will call merge because the objId value will return 0, not null... That's the solution that I finded Object objId = DaoUtils.getPersistentId(o); if (objId == null || (objId instanceof Integer && objId.equals(0)) || (objId instanceof Long && objId.equals(0L)) || (objId instanceof Float && objId.equals(0F)) || (objId instanceof Double && objId.equals(0D))) { this.entityManager.persist(o); } else { this.entityManager.merge(o); } Regards, André Faria |
- [appfuse-user] DaoJpa Merge with Primitive Values... André Faria
