-->
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.  [ 11 posts ] 
Author Message
 Post subject: 1 to many with list gives me OutOfMemory
PostPosted: Sun Feb 29, 2004 10:57 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
I'm attempting to map a 1 to many using a List to contain the many end of my relationship. When I callthe session.load(), the CPU churns for a bit and I then get an OutOfMemory exception. It appears that don't have something mapped correctly, but I'm not sure what. I haven't run across working sample code that does the one to many with lists.

- Using Hibernate version 2.1.2

- Mapping documents follow

- Here's the code between the sessionFactory.openSession() and session.close():

session = HibernateLoader.getSession(HibernateLoader.HIB_SESS_ORACLE);
webRptRequest = new WebRptRequest();
session.load(webRptRequest, new Long(rptRequestId));
Collection args = webRptRequest.getArgList();
session.close();

- stack trace follows

- Using Oracle 9.2

Thanks for any assistance.

Bill Pfeiffer


---- mapping for the many side
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="org.arbfile.util.webrpt.WebRptArg"
table="A_WEB_RPT_REQ_ARGS"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="argId"
column="RPT_WEB_RPT_ARG_ID"
type="long"
>
<generator class="sequence">
<param name="sequence">A_WEB_RPT_REQ_ARGS_ID_SEQ</param>
</generator>
</id>

<property
name="requestId"
type="long"
update="true"
insert="true"
column="REQUEST_ID"
/>

<property
name="argOrder"
type="int"
update="true"
insert="true"
column="ARG_ORDER"
/>

<property
name="argValue"
type="string"
update="true"
insert="true"
column="ARG_VALUE"
/>

<property
name="argType"
type="string"
update="true"
insert="true"
column="ARG_TYPE"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-WebRptArg.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

---- mapping for the 1 side
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="org.arbfile.util.webrpt.WebRptRequest"
table="A_WEB_RPT_REQUEST"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="requestId"
column="request_id"
type="long"
>
<generator class="sequence">
<param name="sequence">A_WEB_RPT_REQUEST_ID_SEQ</param>
</generator>
</id>

<property
name="rptDefId"
type="long"
update="true"
insert="true"
column="RPT_DEF_ID"
/>

<property
name="statusCode"
type="string"
update="true"
insert="true"
column="STATUS_CODE"
/>

<property
name="userId"
type="long"
update="true"
insert="true"
column="USER_ID"
/>

<property
name="loginId"
type="string"
update="true"
insert="true"
column="LOGIN_ID"
/>

<property
name="email"
type="string"
update="true"
insert="true"
column="EMAIL"
/>

<property
name="outputType"
type="string"
update="true"
insert="true"
column="OUTPUT_TYPE"
/>

<property
name="browserType"
type="string"
update="true"
insert="true"
column="BROWSER_TYPE"
/>

<property
name="userRptDesc"
type="string"
update="true"
insert="true"
column="USER_RPT_DESC"
/>

<property
name="expireDate"
type="date"
update="true"
insert="true"
column="EXPIRE_DATE"
/>

<property
name="modDate"
type="date"
update="true"
insert="true"
column="MODDATE"
/>

<property
name="modLoginId"
type="string"
update="true"
insert="true"
column="MODLOGIN_ID"
/>

<property
name="modUserId"
type="long"
update="true"
insert="true"
column="MODUSER_ID"
/>

<list
name="argList"
lazy="false"
inverse="false"
cascade="none"
>

<key
column="REQUEST_ID"
/>

<index
column="RPT_WEB_RPT_ARG_ID"
/>

<one-to-many
class="org.arbfile.util.webrpt.WebRptArg"
/>
</list>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-WebRptRequest.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

---- stack trace of exception
Stack trace:
java.lang.Exception: STACKTRACE
at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:282)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:506)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:257)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3157)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3140)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:61)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:703)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:184)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:132)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2044)
at net.sf.hibernate.impl.SessionImpl.doLoadByObject(SessionImpl.java:1898)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1842)
at org.arbfile.ejb.webrpt.sb.SBWebRptRequestBean.getRptRequest(SBWebRptRequestBean.java:578)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:297)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:700)
at sun.reflect.GeneratedMethodAccessor162.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
at $Proxy677.getRptRequest(Unknown Source)
at org.arbfile.web.webrpt.retrieve.ReportRetrieveAction.execute(ReportRetrieveAction.java:87)
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.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.arbfile.web.filters.KillCacheFilter.doFilter(KillCacheFilter.java:87)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
at java.lang.Thread.run(Thread.java:534)
2004-02-29 09:22:28,962 ERROR [org.jboss.ejb.plugins.LogInterceptor] Unexpected Error:
java.lang.OutOfMemoryError
2004-02-29 09:23:24,162 DEBUG [net.sf.hibernate.impl.SessionImpl] running Session.finalize()

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 11:04 am 
Regular
Regular

Joined: Mon Nov 24, 2003 6:36 pm
Posts: 105
Bit of a guess here (i didn't see anything obviously wrong to me in the map) but are you using any of the BeanUtils stuff for ReflectiontoString?
I've seen cases where it causes issues due to endless recursion on printing to string from/to parent/child relationships.

Just a guess...

How many objects are in this collection?

James


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 3:23 pm 
Regular
Regular

Joined: Fri Jan 16, 2004 4:48 am
Posts: 56
Look in the toString of your Java persistence class. You may be including the Set/List in the toString which is probably going in a loop and you are getting the out of menory error. Remobe the external references to other classes from the toString and you should be okay.

Thanks
Shishir


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 11:15 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
No beanutils stuff is being used. The collection should rarely have more than 6 objects in it.

I don't think I'm doing anything out of ordinary here. My one object, a report request, has many report argument objects. I'm actually trying to shape my code so it will work best with hibernate and obviously I'm doing something wrong. My beans are just java beans with regular getter/setters.

Bill

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 11:21 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
I have not written a toString method for the two beans involved. The beans contain the instance data along with the getters and setters. Not much else.

Here's the code for the beans:

-----

package org.arbfile.util.webrpt;

import java.io.Serializable;
import java.util.Date;
import java.util.Collection;
import java.util.ArrayList;
import java.util.List;
import java.text.DecimalFormat;

/**
* @hibernate.class table="A_WEB_RPT_REQUEST"
*/
public class WebRptRequest implements Serializable
{
/** A collection of WebRptArg objects */
List argList = new ArrayList();

/** The request id for this request. This value maps to the row id in CCA.A_WEB_RPT_REQUEST. */
private long requestId;

/** The report type, a foriegn key from the CCA.R_WEB_RPT_DEF table. */
private long rptDefId;

/** The status code for this request which maps to the primary key in CCA.R_WEB_RPT_STATUS. */
private String statusCode;

/** The user id that requested this report. */
private long userId;

/** The login id of the user that requested this report. */
private String loginId;

/** The email address to mail the report to after processing. */
private String email;

/** The output type requested by the user. */
private String outputType;

/** The browser type the user will view the report with. */
private String browserType;

/** The user defined description for this report request. */
private String userRptDesc;

/** The user defined days in which to set the expire date for this report request. */
private int expireDays;

/** Date the report expires */
private Date expireDate;

/** moddate */
private Date modDate;

/** moduser */
private String modLoginId;

/** moduser */
private Long modUserId;

/**
* The timestamp when this Report Request was logged in the database.
* This will only be used when getting report requests from the database
* for management purposes and is not populated when the report request
* is generated by the user.
*/
private Date timeStamp;

/**
* Default constructor.
*/
public WebRptRequest()
{
requestId = 0;
rptDefId = 0;
statusCode = null;
userId = 0;
loginId = null;
email = null;
outputType = null;
browserType = null;
userRptDesc = null;
timeStamp = null;
expireDays = 10;
expireDate = null;
}

/**
* Constructor which populates the object.
* @param requestId The new request's request id.
* @param reportType The new request's type.
* @param statusCode The status of this request.
* @param userId The new user id that requested the report.
* @param loginId The login id that generated the request.
* @param email The email address the report is to be mailed to.
* @param outputType The format to output the report in.
* @param browserType The browser the user will view the report with.
*/
public WebRptRequest(long requestId, long reportType, String statusCode,
long userId, String loginId, String email,
String outputType, String browserType, int expireDays)
{
this.requestId = requestId;
this.rptDefId = reportType;
this.statusCode = statusCode;
this.userId = userId;
this.loginId = loginId;
this.email = email;
this.outputType = outputType;
this.browserType = browserType;
this.expireDays = expireDays;
}

/**
* Get the request Id.
* @return The request Id.
*
* @hibernate.id column="request_id"
* type="long"
* generator-class="sequence"
* @hibernate.generator-param name="sequence"
* value="A_WEB_RPT_REQUEST_ID_SEQ"
*/
public long getRequestId()
{
return this.requestId;
}

/**
* Set the request Id.
* @param requestId The new value for requestId.
*/
public void setRequestId(long requestId)
{
this.requestId = requestId;
}

/**
* Get the report type.
* @return The report type for this object.
*
* @hibernate.property column="RPT_DEF_ID"
* type="long"
*/
public long getRptDefId()
{
return this.rptDefId;
}

/**
* Sets the report type for this object.
* @param rptDefId The new value for the report type.
*/
public void setRptDefId(long rptDefId)
{
this.rptDefId = rptDefId;
}

/**
* Get the status code for this report request.
* @return The status code.
*
* @hibernate.property column="STATUS_CODE"
* type="string"
*/
public String getStatusCode()
{
return this.statusCode;
}

/**
* Sets the status code for this report request.
* @param statusCode The new value for the status code.
*/
public void setStatusCode(String statusCode)
{
this.statusCode = statusCode;
}

/**
* Get the userid that created this report request.
* @return The userid.
*
* @hibernate.property column="USER_ID"
* type="long"
*/
public long getUserId()
{
return this.userId;
}

/**
* Sets the userid for the report request.
* @param userId The new value for the userId.
*/
public void setUserId(long userId)
{
this.userId = userId;
}

/**
* Get the login id for the report request.
* @return The login id currently associated with this report request.
*
* @hibernate.property column="LOGIN_ID"
* type="string"
*/
public String getLoginId()
{
return this.loginId;
}

/**
* Sets the login id for this report request.
* @param loginId The login id to associate with this report request.
*/
public void setLoginId(String loginId)
{
this.loginId = loginId;
}

/**
* Get the email to send the report to.
* @return The email address for this report request.
*
* @hibernate.property column="EMAIL"
* type="string"
*/
public String getEmail()
{
return this.email;
}

/**
* Sets the email address to send the report to.
* @param email The email address for this report request.
*/
public void setEmail(String email)
{
this.email = email;
}

/**
* Get the output type for this report request.
* @return The output type.
*
* @hibernate.property column="OUTPUT_TYPE"
* type="string"
*/
public String getOutputType()
{
return this.outputType;
}

/**
* Sets the output type for this report.
* @param outputType The value to set the output type to.
*/
public void setOutputType(String outputType)
{
this.outputType = outputType;
}

/**
* Get the browser type for this report request.
* @return The browser type used to view the report.
*
* @hibernate.property column="BROWSER_TYPE"
* type="string"
*/
public String getBrowserType()
{
return browserType;
}

/**
* Sets the browser type for this report request.
* @param browserType The browser that will be used.
*/
public void setBrowserType(String browserType)
{
this.browserType = browserType;
}

/**
* Get the user defined report request description.
* @return The report description.
*
* @hibernate.property column="USER_RPT_DESC"
* type="string"
*/
public String getUserRptDesc()
{
return userRptDesc;
}

/**
* Sets the user defined report request description.
* @param userRptDesc The description entered by the user to associate with this request.
*/
public void setUserRptDesc(String userRptDesc)
{
this.userRptDesc = userRptDesc;
}

/**
* Get the time stamp when this request was created in the database.
* @return The time stamp.
*
*/
public Date getTimeStamp()
{
return timeStamp;
}

/**
* Sets the time stamp for when this request was created in the database.
* @param timeStamp The time stamp for when the request was created.
*/
public void setTimeStamp(Date timeStamp)
{
this.timeStamp = timeStamp;
}

/**
* Adds the given WebRptArg object to the collection of arguments
* @param arg The webRptArg to add to the collection of web report arguments
*/
public void addArg(WebRptArg arg)
{
this.argList.add(arg);
}

/**
* Get the number of days from the current request date when this report request will expire.
* @return The number of days from the report request until the report request expires.
*/
public int getExpireDays()
{
return expireDays;
}

/**
* Sets the number of days from the current request date when this report request will expire.
*/
public void setExpireDays(int expireDays)
{
this.expireDays = expireDays;
}

/**
* gets expire date
* @return expire date
* @hibernate.property column="EXPIRE_DATE"
* type="date"
*/
public Date getExpireDate()
{
return expireDate;
}

/**
* sets expire date
* @param expireDate
*/
public void setExpireDate(Date expireDate)
{
this.expireDate = expireDate;
}

/**
* gets mod date
* @return mod date
* @hibernate.property column="MODDATE"
* type="date"
*/
public Date getModDate()
{
return modDate;
}

public void setModDate(Date modDate)
{
this.modDate = modDate;
}

/**
* gets modLoginId
* @return modLoginId
* @hibernate.property column="MODLOGIN_ID"
* type="string"
*/
public String getModLoginId()
{
return modLoginId;
}

public void setModLoginId(String modLoginId)
{
this.modLoginId = modLoginId;
}

/**
* gets mod user id
* @return moduserid
* @hibernate.property column="MODUSER_ID"
* type="long"
*/
public Long getModUserId()
{
return modUserId;
}

public void setModUserId(Long modUserId)
{
this.modUserId = modUserId;
}

/**
* This contains a collection of all of the arguments used in this report request
* @return
* @hibernate.list lazy="false"
* name="argList"
* inverse="false"
* @hibernate.collection-one-to-many class="org.arbfile.util.webrpt.WebRptArg"
* column="REQUEST_ID"
* @hibernate.collection-key column="REQUEST_ID"
* @hibernate.collection-index column="RPT_WEB_RPT_ARG_ID" type="long"
*/
public List getArgList()
{
return argList;
}

public void setArgList(List argList)
{
this.argList= argList;
}

/**
* This method returns a file path based on the path and output type of the requested file
* @return The formatted file path including the directory mapping and file type
*/
public static String formatFilePath(String filePath, long requestId, String outputType)
{
String ret = "";

if (filePath != null && outputType != null)
{
// build the file name based on the id and type
DecimalFormat df = new DecimalFormat ("0000000000");
ret = filePath + df.format(requestId) + "." + outputType;
}

return ret;
}
}


-----

package org.arbfile.util.webrpt;

/**
* Web Report Argument Bean
*
* @hibernate.class table="A_WEB_RPT_REQ_ARGS"
*/
public class WebRptArg
{
long argId;
long requestId;
int argOrder;
String argValue;
String argType;

public WebRptArg(int argOrder, String argValue, String argType)
{
if (argOrder < 0)
{

}

if (! WebRptConstants.isValidArgType(argType))
{

}

this.argOrder = argOrder;
this.argValue = argValue;
this.argType = argType;
}

public WebRptArg()
{

}

/**
* @return arg order
*
* @hibernate.id column="RPT_WEB_RPT_ARG_ID"
* type="long"
* generator-class="sequence"
* @hibernate.generator-param name="sequence"
* value="A_WEB_RPT_REQ_ARGS_ID_SEQ"
*/
public long getArgId()
{
return argId;
}

public void setArgId(long argId)
{
this.argId = argId;
}

/**
* @return requestid
*
* @hibernate.property column="REQUEST_ID"
* type="long"
*/
public long getRequestId()
{
return requestId;
}

public void setRequestId(long requestId)
{
this.requestId = requestId;
}
// /**
// * @return arg order
// *
// * @hibernate.many-to-one column="REQUEST_ID"
// * not-null="true"
// * class="org.arbfile.util.webrpt.WebRptRequest"
// */
// public WebRptRequest getWebRptRequest()
// {
// return webRptRequest;
// }
//
// public void setWebRptRequest(WebRptRequest webRptRequest)
// {
// this.webRptRequest = webRptRequest;
// }

/**
* @return arg order
*
* @hibernate.property column="ARG_ORDER"
* type="int"
*/
public int getArgOrder()
{
return argOrder;
}

public void setArgOrder(int argOrder)
{
this.argOrder = argOrder;
}

/**
* @return arg order
*
* @hibernate.property column="ARG_VALUE"
* type="string"
*/
public String getArgValue()
{
return argValue;
}

public void setArgValue(String argValue)
{
this.argValue = argValue;
}

/**
* @return arg type
*
* @hibernate.property column="ARG_TYPE"
* type="string"
*/
public String getArgType()
{
return argType;
}

public void setArgType(String argType)
{
this.argType = argType;
}
}

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 29, 2004 11:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
What is the size of your index values - Hibernate expects it to start at 0 similar to an array. If there is a gap then it will create empty entry in the List. If you have index value of 1000000 then it will result in a very large list with only six very sparse valid entries. Just a guess.


Top
 Profile  
 
 Post subject: Solved!
PostPosted: Mon Mar 01, 2004 1:01 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
Thanks for the solution David. When I changed my example to use another column which is a counter type value per the 1 side of the 1-to-many relationship, all was good.

Can you tell hibernate just use a counter for index in a list rather than use a value pulled from the db?

Thanks Again!

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject: What the problem was...
PostPosted: Mon Mar 01, 2004 1:04 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
For anyone interested, I believe the problem I was encountering was due to the size of the value of the index that I was using when declaring my list. I used my object's primary key which is VERY large. It appears that hibernate was trying to allocate as many objects as the value of my index, which yeilded the OutOfMemory error.

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 3:47 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Sorry No. It uses the index as a direct index rather than a relative (such as in a sorted positon) location. You could map it as a set and sort the result using you index value.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 11:08 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
Do I understand you correctly that if a collection refers to a table that does not have a good candidate column for index, than I should rather use a set (ordered preferably)?

Thanks for the info

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 01, 2004 11:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes - it is an option.


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