0 Replies Latest reply on Nov 10, 2009 9:59 PM by Eder Baum

    JPQL returning JSON / Add NamedQueries dynamically

    Eder Baum Newbie

      Imagine a JPQL query like this:

      SELECT JSON{id : p.id, name : p.name, age : p.age} FROM Person p WHERE id=?1


      Ok, i know this is impossible (Actually).
      But if i could find a Way to Add NamedQueries dynamically to the EntityManagerFactory , i could implement this by Myself.

      Someone here know how to do that?

      I'm actually adding Annotated Classes and generating the EntityManagerFactory dynamically doing this:

      Ejb3Configuration ejb3conf = new Ejb3Configuration();
      .....
      ejb3conf.addAnnotatedClass(aClass);
      ...
      EntityManagerFactory emf = ejb3conf.buildEntityManagerFactory();



      p.s: Sorry, i'm brazilian, and my english isn't so good.