-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Middlegen generated *.hbm.xml cause ArrayIndexOutOfBoundsExc
PostPosted: Fri Jan 16, 2004 1:59 pm 
Newbie

Joined: Fri Jan 16, 2004 1:28 pm
Posts: 1
Hi,

I'm starting out with Hibernate 2.0.3 by reverse engineering a 100+ table MsSQL database using Middlegen. When building the SessionFactory I get an ArrayIndexOutOfBoundsException (appended below).

I know that incorrect mapping causes the problem, but I have no clue as to which entity is the culprit. I guess I can find the problem by a process of elimination, but with around 130 *.hbm.xml files it may take a while - plus many of the entities are related and must be deployed together.

The whole point of using Middlegen was to automate the metadata and POJO generation, but now it looks like I will spend as much time debugging the generated meta as I would writing it by hand.

Question:

Is there a quick way of finding out which outer join caused the ArrayIndexOutOfBoundsException?

Could removing the inverse bi-directional association elements fix this?

Is there a way to disable the inverse bi-directional association generation in Middlegen? Going through hundreds of files is not my idea of time well spent.

many thanks,

Greg


THE EXCEPTION:

Error: java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.ArrayIndexOutOfBoundsException: 1
at net.sf.hibernate.util.ArrayHelper.slice(ArrayHelper.java:59)
at net.sf.hibernate.loader.OuterJoinLoader.walkComponentTree(OuterJoinLoader.java:230)
at net.sf.hibernate.loader.OuterJoinLoader.walkClassTree(OuterJoinLoader.java:191)
at net.sf.hibernate.loader.OuterJoinLoader.walkTree(OuterJoinLoader.java:74)
at net.sf.hibernate.loader.OneToManyLoader.<init>(OneToManyLoader.java:57)
at net.sf.hibernate.collection.CollectionPersister.createCollectionQuery(CollectionPersister.java:277)
at net.sf.hibernate.collection.CollectionPersister.<init>(CollectionPersister.java:268)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:216)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
at com.genesys.confmgr.controller.action.GregDemoAction.testHibernate(GregDemoAction.java:73)
at com.genesys.confmgr.controller.action.GregDemoAction.execute(GregDemoAction.java:134)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6310)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 17, 2004 8:54 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Try Hibernate 2.1, Error description is better in some cases

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 17, 2004 5:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
There is not enough information to work this one out so try 2.1 maybe it will provide more specific clues. Middlegen will will do its best to get it right but you can use the GUI to fine tuine it. This same process has the capability to both improve the mapping as well as break it. The GUI can be used to change the relationships alternatively you can change the velocity script to generate the mappings differently, eg, remove inverse="true" on bi-directional mappings.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.