-->
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.  [ 4 posts ] 
Author Message
 Post subject: Table name too long ?
PostPosted: Wed Apr 21, 2004 5:50 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
I have a table in an Oracle database by the name of :

POLICY_ACC_YEAR_SNAPSHOT_FACT

This table has a M-1 relationship to the POLICY table (one POLICY can have many of these snapshots)

When I query a POLICY and get the Policy class, I now want to get all the PolicySnapshots. When I call collection.iterator, I get this stacktrace :

<Apr 21, 2004 4:18:31 PM GMT-05:00> <Warning> <WLW> <000000> <Id=top-level; Meth
od=controls.FYLSearchControl.getInitialSummaryReport(); Failure=net.sf.hibernate
.LazyInitializationException: Failed to lazily initialize a collection [ServiceE
xception]>
[/hubzilla] Unhandled exception caught in Global.app:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a coll
ection
at net.sf.hibernate.collection.PersistentCollection.initialize(Persisten
tCollection.java:206)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentColle
ction.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at com.accidentfund.common.db.dao.FYLInitialDataGenerator.computeInitial
SummaryReport(FYLInitialDataGenerator.java:97)
at com.accidentfund.common.db.dao.ReportDAO.getFYLInitialSummaryReport(R
eportDAO.java:322)
at controls.FYLSearchControlImpl.getInitialSummaryReport(FYLSearchContro
lImpl.jcs:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java
:367)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:42
3)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:39
6)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:24
8)
at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(JcsContainer.ja
va:84)
at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(BaseContai
nerBean.java:198)
at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(SLSBContainerB
ean.java:103)
at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(StatelessCont
ainer_ly05hg_ELOImpl.java:153)
at com.bea.wlwgen.GenericStatelessSLSBContAdpt.invokeOnBean(GenericState
lessSLSBContAdpt.java:62)
at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.runAsInvoke(BaseDisp
atcherBean.java:153)
at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.invoke(BaseDispatche
rBean.java:54)
at com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(SyncDispatche
rBean.java:160)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Syn
cDispatcher_k1mrl8_EOImpl.java:100)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatc
her.java:161)
at com.bea.wlw.runtime.core.dispatcher.ServiceHandleImpl.invoke(ServiceH
andleImpl.java:414)
at com.bea.wlw.runtime.core.dispatcher.WlwProxyImpl._invoke(WlwProxyImpl
.java:275)
at com.bea.wlw.runtime.core.dispatcher.WlwProxyImpl.invoke(WlwProxyImpl.
java:264)
at $Proxy30.getInitialSummaryReport(Unknown Source)
at pageFlows.lossRuns.LossRunsController.fylSearchAction(LossRunsControl
ler.jpf:421)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.bea.wlw.netui.pageflow.FlowController.invokeActionMethod(FlowCont
roller.java:1495)
at com.bea.wlw.netui.pageflow.FlowController.getActionMethodForward(Flow
Controller.java:1430)
at com.bea.wlw.netui.pageflow.FlowController.internalExecute(FlowControl
ler.java:761)
at com.bea.wlw.netui.pageflow.PageFlowController.internalExecute(PageFlo
wController.java:211)
at com.bea.wlw.netui.pageflow.FlowController.execute(FlowController.java
:591)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:274)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowR
equestProcessor.java:651)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegi
sterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActi
onServlet.java:152)
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:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:402)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at com.bea.p13n.servlets.PortalServletFilter.doFilter(PortalServletFilte
r.java:313)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
va:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6356)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: net.sf.hibernate.JDBCException: could not initialize collection: [com
.accidentfund.common.db.hibernate.PolicyDim.policySnapshotFacts#6]
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(Ab
stractCollectionPersister.java:287)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.ja
va:3226)
at net.sf.hibernate.collection.PersistentCollection.initialize(Persisten
tCollection.java:200)
... 58 more
Caused by: java.sql.SQLException: ORA-00904: "POLICYSNAP0_"."ACCIDENT_YEAR_CLAIM
_COUNT": invalid identifier


at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1983)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:
877)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
a:2513)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:2857)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
edStatement.java:608)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:536)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:795)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:910)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:885)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.ja
va:80)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(Ab
stractCollectionPersister.java:284)
... 60 more



-------------------

As you can see towards the bottom of the trace, it's trying to get the ACCIDENT_YEAR_CLAIM_COUNT column from the snapshot table and is using "POLICYSNAP0_" instead of POLICY_ACC_YEAR_SNAPSHOT_FACT. Why is that ???

Is there an internal limit to the name of a table in hibernate ? If not, how do I bypass this problem ?

Please help....


Suman


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 6:51 pm 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
Table name doesn't seem long to me, seems more likely your mapping files aren't quite right. Can you show us the map files- at least the <list>
or <set> part of Policy, and the "child" side identifier?

James


Top
 Profile  
 
 Post subject: My mapping files
PostPosted: Wed Apr 21, 2004 11:39 pm 
Beginner
Beginner

Joined: Sun Mar 28, 2004 7:18 pm
Posts: 26
POLICY
---------

<!-- bi-directional one-to-many association to PolicySnapshotFact -->
<set
name="policySnapshotFacts"
lazy="true"
inverse="true"
>
<key>
<column name="POLICY_DIM_KEY" />
</key>
<one-to-many
class="com.accidentfund.common.db.hibernate.PolicySnapshotFact"
/>
</set>


POLICY_SNAPSHOT
-----------------------

This has a composite PK


<class
name="com.accidentfund.common.db.hibernate.PolicyAccYearSnapshotFact"
table="POLICY_ACC_YEAR_SNAPSHOT_FACT"
>

<composite-id name="comp_id" class="com.accidentfund.common.db.hibernate.PolicyAccYearSnapshotFactPK">
<key-property
name="accidentYear"
column="ACCIDENT_YEAR"
type="short"
length="4"
/>
<!-- bi-directional many-to-one association to PolicyDim -->
<key-many-to-one
name="policyDim"
class="com.accidentfund.common.db.hibernate.PolicyDim"
>
<column name="POLICY_DIM_KEY" />
</key-many-to-one>
<!-- bi-directional many-to-one association to AsOfDateDim -->
<key-many-to-one
name="asOfDateDim"
class="com.accidentfund.common.db.hibernate.AsOfDateDim"
>
<column name="AS_OF_DATE_KEY" />
</key-many-to-one>
</composite-id>

<property
name="totalAccidentYearLosses"
type="java.math.BigDecimal"
column="TOTAL_ACCIDENT_YEAR_LOSSES"
not-null="true"
length="13"
/>

.............. other properties


Any idea why I'm getting the SQL exception in RED shown above ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 22, 2004 3:58 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
POLICYSNAP0_ is an alias as per the SQL language.

ACCIDENT_YEAR_CLAIM_COUNT does not appear in the mapping you 've given.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.