• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My query is null

 
Alan Duke
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My query is not executed. The result is NULL, but the log GlassFish, it is mounted and if I run on direct Postgresql she returns the list. But in the app it comes null. Below my query.
 
Paul Clapham
Sheriff
Pie
Posts: 20724
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can you test the query when you don't know what it is???

This is not a query:

It's Java code which generates a query based on some unknown data. You can't test it unless you know what "login.getPessoa().getIdPessoa()" returns.
 
Alan Duke
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The query result is:


This login.getPessoa().getIdPessoa() returns idpessoa wich case it is 1.

if I make , I have the same result.
 
Alan Duke
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the glassfish log.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that the stack trace tells you exactly where the problem happens. In this case, it is in line 43 of ListaEscola.java, in the method br.com.mosaicodigital.modelo.ListaEscola.findAll (which is called from line 37 of MostraEscolaAtiva.java).

Go to that place in your source code and try to see what is null there that should not be null. When you call a (non-static) method on a variable that is null, or when you try to access a member variable on a variable that is null, you will get a NullPointerException.
 
Alan Duke
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My FactorySingleton

The qury work on postgresql. It returns 2 records. The query from glassfish work too. But in app do not work. The return is null.
 
Alan Duke
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is error:


I don't know resolve. How can I get a logged user?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic