[jboss-user] [JBoss Seam] - Same ResultList as return value of an entityQuery

abra do-not-reply at jboss.com
Mon Jan 28 10:22:05 EST 2008

Hi all

I just came across a strange "feature". I'm not sure if I'm missing something but think it could help others struggling with the same kind of problem.
My setup is the following:

- One EntityQuery
- One example object used in the query
- One method executing the query multiple times

In my method, I call the query with some different example objects and store the results in different Lists to merge them in certain circumstances into one of them. The result was not as expected: I had objects in my list I haven't copied into, so the question was: "How did they come in my list?" After debugging the problem and it's solution was clear: The EntityQuery method getResultList() works just with one single List instance and therefore all resultLists were merged together. The solution was to instantiate each time a new list and copy the ResultList into it.

>From my point of view, the EntityQuery should return for each method call a new List but I'm open for arguments against.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124096#4124096

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124096

More information about the jboss-user mailing list