[EJB 3.0] - Re: JbossQL and m.createQuery(.. OFFSET 5 LIMIT 23)
by laszlo.fogas
ok, i try again :)
So, i have an object with lots of lazy onetomany relations. I have second level cache enabled(TreeCache). I would like to use pagination with the setfirstresult/maxresult methods.
If i initialize the lazy collections with calling the size method, and use pagination the entity manager generates the limit/offset into the sql query.
(i set the a show sql param to true.)
But this way the cache does not operate as good as i expect: It's slower than dbhitting.
Here comes the sopution:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=88317
Which says that i should use fetching joins to initialize the collections, because the implementation likes that much more.. OK i did this.
But than the pagination breaks.. there's no limit and offset in my queries.
The documentation has a funny comment on this:
"Note that the fetch construct may not be used in queries called using scroll() or iterate(). Nor should fetch be used together with setMaxResults() or setFirstResult(). "
What does this mean?
Noone faced the same problem before me?
I have tested the cache with the fetching joins: i changed my query (id<10) in order to simulate the case with limit 10 to test the speed.. As the link said the cache working fine.. the query speed decreased after the first loading.
So there are two bugs(?) which prevent me to use EJB3 efficently!!
Any slutions? Workarounds?
regards, Lazlo
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970607#3970607
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970607
19 years, 7 months
[JBoss Seam] - Multiple roles and accessing the DataModel
by zzzz8
I'd like access a JSF DataModel from my JSP using EL. Normally, this is a very easy thing to when one doesn't use multiple roles. But in this case, I'm assigning multiple roles to a component and I can't seem to figure out the correct syntax for accessing the DataModel.
For example, here's a snippet of my source code:
@Name("component1")
| @Role(name="component2")
| @Stateful
| public class Test implements TestLocal {
| @DataModel
| List<Item> list;
|
| @DataModelSelection
| Item item;
| }
What is the correct EL for accessing the DataModel list associated with the component1 role and the component2 role?
I've tried:
#{component1.list}
| #{component2.list}
However, when I do this, I don't seem to be getting the DataModel, but rather the actual List itself. This is evidenced by the fact that a method in the class that uses the DataModelSelection is always stuck at pointing to the first item in the List list...
I've also tried modifying the source code to annotate with DataModel on the getter method:
List<Item> list;
|
| @DataModel
| public List<Item> getList() {
| return list;
| }
Also, is there a bug with using the DataModelSelection and DataModelSelectionIndex annotations in the same class?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970601#3970601
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970601
19 years, 7 months