select « POJO « JPA Q&A





1. selecting from classes as a pojo    forum.hibernate.org

Hey all, I didnt find this in search: I want to select some field values in a plain old java object that I've defined as MyDTO. It has a constructor that accepts all the values I'm selecting and in that order: Code: select new MyDTO ( a.field1, a.field2, b.field1 ) from AClass a, ...

2. Select, tuples and POJOs    forum.hibernate.org

Hello! I have class Foo with three fields: 'a','b','c' and methods: setA, getA, setB, getB, setC, getC. when I create query "select a,b from Foo" I get Objet[2] as a result with Object[0]=a, and Object[1]=b. What I would like to achieve is to get instance of Foo with 'a' and 'b' fields properly set and empty 'c' (after query.iterate().next()) How am ...

3. SELECT NEW: unable to locate POJO class    forum.hibernate.org

I am executing a query as follows. It results in a compiler error because the POJO class is not found. Code: Query q = entityManager.createQuery("SELECT NEW org.domain.b1.ui.NonMappedClass(b.prop1, b.prop2) ... The compiler in eclipse finds an HQL Syntax Error: unable to locate class [org.domain.b1.ui.NonMappedClass]. The class exists and may be instantiated normally outside of a query. It's a POJO class that's not ...