-
1. Re: Performance problem with mapping -
epbernard Nov 28, 2005 7:26 AM (in response to markbrazil)fetch=LAZY
-
2. Re: Performance problem with mapping -
markbrazil Nov 28, 2005 5:40 PM (in response to markbrazil)"epbernard" wrote:
fetch=LAZY
Thanks for the reply.
I have put the following
@OneToOne(targetEntity=apps.ejb3.par.Bale.class, fetch=FetchType.LAZY)
@JoinColumn(name="baleid_fk")
public Bale getBale() {
return bale;
}
public void setBale(Bale bale) {
this.bale=bale;
}
On the parent side I have
@OneToOne(mappedBy="bale", targetEntity=apps.ejb3.par.Neps.class, fetch=FetchType.LAZY)
public Neps getNeps() {
return neps;
}
public void setNeps(Neps neps) {
this.neps = neps;
}
I have tried with and without the targetEntity (makes no difference!)
I get the following error
Exception in thread "pool-8-thread-2" java.lang.NoClassDefFoundError: net/sf/cglib/proxy/MethodInterceptor
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at com.sun.jnlp.JNLPClassLoader.defineClass(JNLPClassLoader.java:314)
at com.sun.jnlp.JNLPClassLoader.access$100(JNLPClassLoader.java:53)
at com.sun.jnlp.JNLPClassLoader$1.run(JNLPClassLoader.java:254)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.jnlp.JNLPClassLoader.findClass(JNLPClassLoader.java:247)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at com.sun.jnlp.JNLPClassLoader.loadClass(JNLPClassLoader.java:600)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at org.hibernate.proxy.SerializableProxy.readResolve(SerializableProxy.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
However I can see from the server.log that all the records where loaded just failed trying to send to the remote client.
I can't see what I'm doing wrong, but I'm sure its something simple.
Any ideas ?
Thanks,
Mark. -
3. Re: Performance problem with mapping -
markbrazil Nov 29, 2005 4:01 PM (in response to markbrazil)Anyone any ideas ?
-
4. Re: Performance problem with mapping -
markbrazil Nov 30, 2005 1:48 AM (in response to markbrazil)Found the answer, missing another few library's for the remote client.
For anyone interested :
I added cglib-2.1_2jboss.jar to the remote clients list of jar's (getting big now!) and the error went away. -
5. Re: Performance problem with mapping -
markbrazil Nov 30, 2005 2:15 AM (in response to markbrazil)"epbernard" wrote:
fetch=LAZY
Finally now in a position to test this LAZY option.
I have the following
Neps - OneToOne mapping to bale
bale - ManyToOne mapping to module
LAZY fetch turned on for neps to bale and bale to neps
EAGER fetch turned on for bale to module and module to bale
(also tried
LAZY fetch turned on for bale to module and module to bale )
I'm getting the follow error
30/11/2005 18:00:22 org.hibernate.LazyInitializationException
SEVERE: could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:98)
at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:133)
at apps.ejb3.par.Bale$$EnhancerByCGLIB$$9018b5df.getModule()
at apps.client.NepsClient$TableModel.getValueAt(Unknown Source)
at apps.TableSorter.getValueAt(Unknown Source)
at javax.swing.JTable.getValueAt(JTable.java:1852)
at javax.swing.JTable.prepareRenderer(JTable.java:3902)
at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:1985)
at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1887)
at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1810)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:742)
at javax.swing.JComponent.paint(JComponent.java:1005)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JViewport.paint(JViewport.java:728)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) -
6. Re: Performance problem with mapping -
markbrazil Nov 30, 2005 6:05 PM (in response to markbrazil)Am I doing something wrong. It seems this should be simple ?
Simply trying to have
A mapped to B
B mapped to C
B mapped to D
Querying C and getting details from B and A.
Fetch=EAGER gives terrible response times, i.e. a couple of minutes for a simple query. Or Fetch=LAZY throws exception !
Anyone ? -
7. Re: Performance problem with mapping -
markbrazil Dec 1, 2005 7:45 PM (in response to markbrazil)I know now that fetch=LAZY is not an option for remote clients.
However I still have the following
A mapped to B
A mapped to F
B mapped to C
B mapped to D
B mapped to E
Querying C and getting details from B and A.
When I run this query it fetches 1696 rows. This however issues 3392 sql queries one for C-b-a and one for the other joins from b.
Is there a way I can fetch groups of records with ejb3. I could do this with xdoclet & ejb2.1 with the read-ahead page-size option.
Is there a similar option for ejb3 ?
I don't really want to be excuting this number of sql statments against the database.
Regards,
Mark. -
8. Re: Performance problem with mapping -
markbrazil Dec 1, 2005 8:52 PM (in response to markbrazil)"markbrazil" wrote:
I know now that fetch=LAZY is not an option for remote clients.
However I still have the following
A mapped to B
A mapped to F
B mapped to C
B mapped to D
B mapped to E
Querying C and getting details from B and A.
When I run this query it fetches 1696 rows. This however issues 3392 sql queries one for C-b-a and one for the other joins from b.
Is there a way I can fetch groups of records with ejb3. I could do this with xdoclet & ejb2.1 with the read-ahead page-size option.
Is there a similar option for ejb3 ?
I don't really want to be excuting this number of sql statments against the database.
Regards,
Mark.
@BatchSize(size=100)
This has helped but there are still 1716 sql statments issued.
and each statment includes all tables a,b,c,d,e,f (with outer joins).
I also changed my query to include the 3 tables I want
"select c from C as c join c.b as b left join b.a as a"
Is it possible to limit the query to just this, rather than jboss adding in all outer joins to tables d,e,f ? -
9. Re: Performance problem with mapping -
gavin.king Dec 1, 2005 8:57 PM (in response to markbrazil)You need to learn Hibernate.
I recommend you just get Hibernate in Action and save yourself hours of randomly pressing different switches without really understanding how the whole machine fits together. -
10. Re: Performance problem with mapping -
markbrazil Dec 1, 2005 10:45 PM (in response to markbrazil)"gavin.king@jboss.com" wrote:
You need to learn Hibernate.
I recommend you just get Hibernate in Action and save yourself hours of randomly pressing different switches without really understanding how the whole machine fits together.
rtfm in the user forum, that's helpful. -
11. Re: Performance problem with mapping -
darranl Dec 2, 2005 10:31 AM (in response to markbrazil)"markbrazil" wrote:
rtfm in the user forum, that's helpful.
Just because this is a user forum does not mean you should skip reading the manual. -
12. Re: Performance problem with mapping -
markbrazil Dec 2, 2005 8:36 PM (in response to markbrazil)fyi, I've read what's available online, I searched forums I've googled. The book mentioned is not available.
Our app works we just have a few performance problems with ejb3.
I though the thing to do was to post a question on the user forum, after all most other people do the same !
But instead of getting help we get nothing.
Whats the point in having a user forum if a user cannot post a question without getting told to read the damn manual."darranl" wrote:
"markbrazil" wrote:
rtfm in the user forum, that's helpful.
Just because this is a user forum does not mean you should skip reading the manual. -
13. Re: Performance problem with mapping -
starksm64 Dec 3, 2005 3:19 PM (in response to markbrazil)As a guide to what is required to get more than an rtfm, see:
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHelp -
14. Re: Performance problem with mapping -
epbernard Dec 30, 2005 7:30 PM (in response to markbrazil)The book is actually available
http://www.amazon.com/gp/product/193239415X/002-5439773-1264020?v=glance&n=283155