MySQL で JPA を使用すると、以下のクエリが正常に機能します。しかし、ObjectDB で使用すると、以下の例外がスローされます。
public Friendship getFriendship(String username) {
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Friendship> query = criteriaBuilder.createQuery(Friendship.class);
Root<Friendship> root = query.from(Friendship.class);
Path<String> path = root.<String>get("username");
query.where(criteriaBuilder.equal(path, username));
return em.createQuery(query).getSingleResult();
}
ブラウザからのエラー
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: com.objectdb.o._PersistenceException: Unexpected query token 'FROM' (SELECT is expected)
root cause
com.objectdb.o._PersistenceException: Unexpected query token 'FROM' (SELECT is expected)
root cause
com.objectdb.o.UserException: Unexpected query token 'FROM' (SELECT is expected)