Menu

#32 query with constructor - not work

0.4.1
closed-fixed
nobody
None
5
2014-10-03
2014-10-02
Marcin
No

Integration jpasecurity with playframework (2.3) does an issue when I use constructor in query (SELECT new xx.xx.User(u.id, u.name) FROM User u).
Without jpasecurity this query works.
This query also works fine with 0.4.0.
For me problem is in class net.sf.jpasecurity.jpql.compiler.JpqlCompiler.ConstructorArgReturnTypeVisitor.visit and method Class.forName in line: valueHolder.setValue(Class.forName(node.toString()));

I propose:
valueHolder.setValue(Thread.currentThread().getContextClassLoader().loadClass(node.toString()));

or using two of them in this method (Class.forName and Thread.currentThread().getContextClassLoader().loadClass).

witch works fine for me (integration with playframework)

javax.persistence.PersistenceException: Mapping not found for type

Related

Bugs: #32

Discussion

  • Arne Limburg

    Arne Limburg - 2014-10-03

    Thanks for reporting this. I applied your suggested change to trunk.

     
    • Marcin

      Marcin - 2014-10-03

      Wow. Thank you for very the very quick response!
      Now, for me, is well!

      2014-10-03 15:54 GMT+02:00 Arne Limburg arnelim@users.sf.net:

      Thanks for reporting this. I applied your suggested change to trunk.

      Status: open
      Group: 0.4.1
      Created: Thu Oct 02, 2014 01:07 PM UTC by Marcin
      Last Updated: Thu Oct 02, 2014 01:07 PM UTC
      Owner: nobody

      Integration jpasecurity with playframework (2.3) does an issue when I use
      constructor in query (SELECT new xx.xx.User(u.id, u.name) FROM User u).
      Without jpasecurity this query works.
      This query also works fine with 0.4.0.
      For me problem is in class
      net.sf.jpasecurity.jpql.compiler.JpqlCompiler.ConstructorArgReturnTypeVisitor.visit
      and method Class.forName in line:
      valueHolder.setValue(Class.forName(node.toString()));

      I propose:

      valueHolder.setValue(Thread.currentThread().getContextClassLoader().loadClass(node.toString()));

      or using two of them in this method (Class.forName and
      Thread.currentThread().getContextClassLoader().loadClass).

      witch works fine for me (integration with playframework)

      javax.persistence.PersistenceException: Mapping not found for type

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/jpasecurity/bugs/32/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #32

  • Arne Limburg

    Arne Limburg - 2014-10-03
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB