Overall test OpenJPA, HibernateJAP, EclipseLink and ObjectDB. No Problem with OpenJPA, HibernateJAP, EclipseLink
For ObjectDB there is one query in following method, where the full qualified class name is necessary. See method code - red part
Otherwise an error will occure.
[ObjectDB 2.4.7_17] select u from ==> User <== u where u.email = :email javax.persistence.PersistenceException Type User is not found (error 301) (position 14) at com.objectdb.jpa.JpaQuery.getResultList(JpaQuery.java:695) at at.sciencesoft.db.jpa.DAOjpa.query(DAOjpa.java:326) at at.sciencesoft.user.User.checkConstraints(User.java:11
This behaviour is very strange, because in the same method - other workflow - the query works with the simple class name. Breaking down the code for simple example would be little compilcated. Have you any idea, what is going wrong?
Code:
public void checkConstraints(DAOiface dao, UpdateMap update) throws Exception { List<Base> list = null; HashMap<String, Object> map = new HashMap<String, Object>(); if (update == null) { map.put("email", getEmail()); list = (List<Base>) dao.query( "select u from " + User.class.getCanonicalName() + " u where u.email = :email", map); } else { Update m = update.get(User.Fields.email); if (m != null) { map.put("histId", getHistId()); map.put("email", m.getString()); list = (List<Base>) dao.query( "select u from User u where u.email = :email and u.histId <> :histId", map); } } if (list != null && list.size() > 0) { throw new Exception( "User.checkConstraints(): Property email isn't unique!"); } }