[Persistence, JBoss/CMP, Hibernate, Database] - With JPA, is there an easy way to force nested lazy collecti
by rickcr
I'm new to JPA (and Hibernate for that matter. Come from iBATIS background.)
Take a case where you have a Company object which contains a List of Employees, and each Employee object has List of Address objects and List of Preferences (Address and Preference would be other domain models.)
I obviously don't want to to return some of the nested items all of the time, so lazy seems to be fine, and typically I suppose I should join fetch to pull back some of the nested items. However, in the Employee object there are two Collections and I've read it's not a good idea (if even possible?) to join fetch two different collections within the same object.
My question is how can I force the lazy loading of some objects so that they are all populated without traversing the entire nested structure and having to call the getter on the lazy fields just to get them populated?
It looks like in Hibernate you can call Hibernate.initialize(yourObject.getYourCollection) and it will initialize the lazy load of the objects, which is bit cleaner than yourObject.getYourCollection.size(). But not sure how to accomplish the same thing with just standard JPA syntax?
Also how does this work if you are nested more than one level and I need my nested lazy collections also populated? (For example maybe I need the whole object tree populated before sending it to the web tier or off to some other business process outside of the scope of my EntityManager.)
Maybe I can manually set the fetch type to Eager for those domain models before performing my specific query? I haven't seen an example of that done though.
Thanks for any help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184663#4184663
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184663
17 years, 6 months
[Clustering/JBoss] - Clustering for financial optimization
by nibeTrap
Hi everybody,
i'm newbie about clustering JBoss.
I have done a software which runs on jboss and now I would like to cluster it.
I know it's quite easy to do that, but let me explain deeper what exactly does it.
In few words it just runs a method which will make a lot of math calculation.This calculation will not gain to be parallelized so it's ok it runs on a singol core (no need of gridgain or similar).
Now it runs on a quadcore CPU, If I run once it takes 25% of total CPU (25% for each core) If I run 4 method the CPU goes to 100%. I see that if I run 6-8 method, the resolution time doesn't increase a lot, anyway this is another problem.
I read jboss cluster is for a businness continuity scenario, that is good for me, but also to load balance a high number of requests, that is not my problem.
If I create a cluster, as example 2 node each quad core, and I run 2 method, which is the police of the cluster? I mean one node 25% and the other 25%?
I would like to fix the maximum number of optimization run at the same time, based on number of cores, in the above example let's say 8.
Will it balance the method automatically based upon cpu usage? Or it don't care?
Can I start method manully on a singol defined cluster?
I'm sorry about my question, I know it probably seems a little bit nebulous, I need just a good advice where to start (now of course reading Cluster documentation)
thanks a lot
nibe
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4184647#4184647
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4184647
17 years, 6 months