7MB field limitation
clovis Dec 19, 2003 10:14 AMHello,
I'm currently having problems with a cmp bean used to store files. it only have an id field and a java.lang.object field (mapped to ms-sql image type).
Everything goes ok when the file is small, but when using files near 5mb I get an Out of memory expection from jboss.
I'm currently using min 256mb/max 512mb on vm options.
Is this a limitation or bug ?
A simple servlet calling only home.create(text); without any transaction causes the problem.
Anyone have an idea of what's going on ?
Here is a code sample:
package teste;
import javax.naming.NamingException;
import cds.cadastro.SequenceSessionLocal;
import cds.cadastro.SequenceSessionUtil;
/**
 * Bean implementation class for Enterprise Bean: TesteText.
 *
 * @author Clóvis Yutaka Harada.
 *
 * @ejb.bean
 * type="CMP"
 * cmp-version="2.x"
 * name="TesteText"
 * jndi-name="teste.TesteText"
 * local-jndi-name="teste.TesteTextLocal"
 * view-type="both"
 * primkey-field="idTesteText"
 *
 * @ejb.finder
 * signature="java.util.Collection findAll()"
 * query="SELECT OBJECT(o) FROM TesteText o"
 *
 * @ejb.persistence table-name="TesteText"
 *
 * @ejb.ejb-ref
 * ejb-name="SequenceSession"
 * ref-name="ejb/SequenceSessionLocal"
 * view-type="local"
 *
 * @jboss.persistence datasource="java:/cdsDS"
 * datasource-mapping="MS SQLSERVER2000"
 * create-table="true"
 * remove-table="false"
 * table-name="TesteText"
 */
public abstract class TesteTextBean implements javax.ejb.EntityBean {
 private javax.ejb.EntityContext myEntityCtx;
 /**
 * setEntityContext
 */
 public void setEntityContext(javax.ejb.EntityContext ctx) {
 myEntityCtx = ctx;
 }
 /**
 * getEntityContext
 */
 public javax.ejb.EntityContext getEntityContext() {
 return myEntityCtx;
 }
 /**
 * unsetEntityContext
 */
 public void unsetEntityContext() {
 myEntityCtx = null;
 }
 /**
 * @ejb.create-method
 * view-type="both"
 */
 public java.lang.Integer ejbCreate(
 java.lang.String texto
 ) throws javax.ejb.CreateException {
 try {
 SequenceSessionLocal sequenceGen = SequenceSessionUtil.getLocalHome().create();
 setIdTesteText(new java.lang.Integer(
 sequenceGen.getNextSequenceNumber("cds.teste.TesteText.idTesteText" ))
 );
 } catch (NamingException ne) {
 ne.printStackTrace();
 throw new javax.ejb.CreateException("Erro ao tentar acessar gerador de sequenciais.");
 }
 setTexto(texto);
 return null;
 }
 /**
 * ejbPostCreate
 */
 public void ejbPostCreate(
 java.lang.String texto
 ) throws javax.ejb.CreateException {
 }
 /**
 * ejbActivate
 */
 public void ejbActivate() {
 }
 /**
 * ejbLoad
 */
 public void ejbLoad() {
 }
 /**
 * ejbPassivate
 */
 public void ejbPassivate() {
 }
 /**
 * ejbRemove
 */
 public void ejbRemove() throws javax.ejb.RemoveException {
 }
 /**
 * ejbStore
 */
 public void ejbStore() {
 }
 /**
 * Get accessor for persistent attribute: idTesteText.
 * @ejb.pk-field
 * @ejb.interface-method
 * view-type="both"
 * @ejb.persistence
 * column-name="idTesteText"
 * sql-type="int"
 * jdbc-type="INTEGER"
 */
 public abstract java.lang.Integer getIdTesteText();
 /**
 * Set accessor for persistent attribute: idTesteText.
 */
 public abstract void setIdTesteText(java.lang.Integer newIdTesteText);
 /**
 * Get accessor for persistent attribute: texto
 * @ejb.interface-method
 * view-type="both"
 * @ejb.persistence
 * column-name="texto"
 * jdbc-type="LONGVARCHAR"
 * sql-type="text"
 */
 public abstract java.lang.String getTexto();
 /**
 * Set accessor for persistent attribute: texto
 */
 public abstract void setTexto(java.lang.String newTexto);
}
 
    