Note that there are some explanatory texts on larger screens.

plurals
  1. POArrayList to Json
    primarykey
    data
    text
    <p>Receive result from query in SessionBean</p> <pre><code>public List getUserTransaction(User user, Balancestatus status) { return em.createNamedQuery("Balance.findLastFiveTransaction").setParameter("user", user).setParameter("status", status).getResultList(); </code></pre> <p>My query </p> <pre><code>select b from Balance b join b.typecategory t where b.user = :user and b.typecategory = t and b.status = :status </code></pre> <p>Getting data in servlet and passed to Json</p> <pre><code>PrintWriter out = response.getWriter(); user = userHandler.userCheck("mail@mail.com"); List&lt;Balance&gt; userTransaction = balance.getUserTransaction(user, outStatus); Gson gson = new Gson(); String json = gson.toJson(userTransaction); out.write(json); </code></pre> <p>Try parse using JQuery and output in console</p> <pre><code>............. $.each(data, function(index, element) { console.log(element); }); .............. </code></pre> <p>and get the error</p> <blockquote> <p>TypeError: invalid 'in' operand obj [Break On This Error]</p> <p>typeof length === "number" &amp;&amp; length > 0 &amp;&amp; ( length - 1 ) in obj );</p> </blockquote> <p>My Json from ArrayList to Json </p> <blockquote> <p>[{"id":"7","description":"evil data show","sum":666.00,"category":{"id":"1","name":"Wallet"},"typecategory":{"id":"4","name":"Home"},"user":{"id":"1","created":"Jun 5, 2013 1:44:45 PM","email":"mail@mail.com","pass":"mail","updated":"Jun 5, 2013 1:44:45 PM"},"status":{"id":"2","statusName":"out"}} ...........]</p> </blockquote> <p>How correct passed ArrayList to Json? Use JBoss AS 7.1</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload