Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » OutOfMemoryError in HbDataStore.initialize()
OutOfMemoryError in HbDataStore.initialize() [message #85840] Fri, 08 June 2007 14:17 Go to next message
Eclipse UserFriend
Originally posted by: david.skogan.gmail.com

Hi,

I have a ecore model with a total of 481 class/type definitions. But I run
out of memory when I try to initialize the database through teneo. I
succeeded with a smaller, but similar model file of approximately 120
class/type definitons. It seems like the problem occurs when
org.hibernate.loader.entity.EntityLoader creates static select/actions.

I have set the heap space to -Xmx1024m. Attached are my ecore model and main
file.

Any ideas?


My setup: Eclipse 3.3M6, EMF 3.3.0.v20070330, EMFT TENEO 0.8, Hibernate
3.2.4.sp1,

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.append(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at org.hibernate.loader.JoinWalker.selectString(JoinWalker.java :953)
at
org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:93)
at
org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:78)
at
org.hibernate.loader.AbstractEntityJoinWalker.initAll(Abstra ctEntityJoinWalker.java:58)
at
org.hibernate.loader.entity.CascadeEntityJoinWalker.<init>(CascadeEntityJoinWalker.java:27)
at
org.hibernate.loader.entity.CascadeEntityLoader.<init>(CascadeEntityLoader.java:25)
at
org.hibernate.persister.entity.AbstractEntityPersister.creat eLoaders(AbstractEntityPersister.java:3013)
at
org.hibernate.persister.entity.AbstractEntityPersister.postI nstantiate(AbstractEntityPersister.java:2977)
at
org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1294)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:156)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:79)
at data.db.InitDB.doQuickStart(InitDB.java:67)
at data.db.InitDB.main(InitDB.java:29)


Regards
David



  • Attachment: InitDB.java
    (Size: 2.36KB, Downloaded 275 times)
  • Attachment: model.ecore
    (Size: 271.69KB, Downloaded 198 times)
Re: OutOfMemoryError in HbDataStore.initialize() [message #85972 is a reply to message #85840] Mon, 11 June 2007 08:41 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
David,
Sorry for the later reply. I set Xmx1500m and this works but it is strange that so much memory is
required. As far as I know Teneo does not use that much memory. Can you profile the memory use?

One other thing I encountered is that with mysql the column/tables names become too long because of
the long names of a few eclasses. You can set a maximum to the length of the names created by Teneo
but then you get nameclashes because Teneo then just truncates the columnnames resulting in multiple
columns having the same name.
If this is also an issue with your database then you need to set an entity name annotation on the
eclasses with long names: @Entity(name="myuniqueshortname").

gr. Martin

David Skogan wrote:
> Hi,
>
> I have a ecore model with a total of 481 class/type definitions. But I run
> out of memory when I try to initialize the database through teneo. I
> succeeded with a smaller, but similar model file of approximately 120
> class/type definitons. It seems like the problem occurs when
> org.hibernate.loader.entity.EntityLoader creates static select/actions.
>
> I have set the heap space to -Xmx1024m. Attached are my ecore model and main
> file.
>
> Any ideas?
>
>
> My setup: Eclipse 3.3M6, EMF 3.3.0.v20070330, EMFT TENEO 0.8, Hibernate
> 3.2.4.sp1,
>
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Unknown Source)
> at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> at java.lang.AbstractStringBuilder.append(Unknown Source)
> at java.lang.StringBuffer.append(Unknown Source)
> at org.hibernate.loader.JoinWalker.selectString(JoinWalker.java :953)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:93)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:78)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initAll(Abstra ctEntityJoinWalker.java:58)
> at
> org.hibernate.loader.entity.CascadeEntityJoinWalker.<init>(CascadeEntityJoinWalker.java:27)
> at
> org.hibernate.loader.entity.CascadeEntityLoader.<init>(CascadeEntityLoader.java:25)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.creat eLoaders(AbstractEntityPersister.java:3013)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.postI nstantiate(AbstractEntityPersister.java:2977)
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1294)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:156)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:79)
> at data.db.InitDB.doQuickStart(InitDB.java:67)
> at data.db.InitDB.main(InitDB.java:29)
>
>
> Regards
> David
>
>
>
> package data.db;
>
> import java.util.Properties;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.hibernate.cfg.Environment;
>
> import data.model.ModelPackage;
>
> /**
> * Based on the Quick Start Tutorial
> *
> * @author <a href="mailto:david.skogan@dnv.com">David Skogan</a>
> * @version $Revision: 1.0 $
> */
> public class InitDB {
>
> private static Log log = LogFactory.getLog(InitDB.class);
>
> /** The main method */
> public static void main(String[] args) {
> // the name of the database, this database should exist but does not need to contain tables
> String dbName = "db";
> doQuickStart(dbName); //ignore return
> }
>
> /** Method which can be called by others */
> public static void doQuickStart(String dbName) {
> log.info("initialize db " + dbName);
>
> ModelPackage ePackage = ModelPackage.eINSTANCE;
>
> // create the HbDataStore
> HbDataStore hbds = (HbDataStore)HbHelper.INSTANCE.createRegisterDataStore(dbNam e);
>
> hbds.setEPackages(new EPackage[]{ePackage});
>
> final Properties hprops = new Properties();
>
> hprops.setProperty(Environment.DRIVER, "org.hsqldb.jdbcDriver");
> hprops.setProperty(Environment.URL, "jdbc:hsqldb:hsql://localhost/plcs");
> hprops.setProperty(Environment.DIALECT, org.hibernate.dialect.HSQLDialect.class.getName());
> hprops.setProperty(Environment.USER, "sa");
> hprops.setProperty(Environment.PASS, "");
>
> hprops.setProperty(Environment.C3P0_MIN_SIZE, "5");
> hprops.setProperty(Environment.C3P0_MAX_SIZE, "20");
> hprops.setProperty(Environment.C3P0_TIMEOUT, "300");
> hprops.setProperty(Environment.C3P0_MAX_STATEMENTS, "50");
> hprops.setProperty(Environment.C3P0_IDLE_TEST_PERIOD, "3000");
>
> hprops.setProperty(Environment.SHOW_SQL, "false");
>
> hbds.setHibernateProperties(hprops);
>
> final Properties props = new Properties();
> props.setProperty(PersistenceOptions.USE_MAPPING_FILE, "false");
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, "JOINED"); // SINGLE_TABLE || JOINED
>
> hbds.setPersistenceProperties(props);
>
> hbds.initialize();
>
> if (hbds.isInitialized()) {
> System.out.println("Success!");
>
> }
> }
> }


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: OutOfMemoryError in HbDataStore.initialize() [message #606898 is a reply to message #85840] Mon, 11 June 2007 08:41 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
David,
Sorry for the later reply. I set Xmx1500m and this works but it is strange that so much memory is
required. As far as I know Teneo does not use that much memory. Can you profile the memory use?

One other thing I encountered is that with mysql the column/tables names become too long because of
the long names of a few eclasses. You can set a maximum to the length of the names created by Teneo
but then you get nameclashes because Teneo then just truncates the columnnames resulting in multiple
columns having the same name.
If this is also an issue with your database then you need to set an entity name annotation on the
eclasses with long names: @Entity(name="myuniqueshortname").

gr. Martin

David Skogan wrote:
> Hi,
>
> I have a ecore model with a total of 481 class/type definitions. But I run
> out of memory when I try to initialize the database through teneo. I
> succeeded with a smaller, but similar model file of approximately 120
> class/type definitons. It seems like the problem occurs when
> org.hibernate.loader.entity.EntityLoader creates static select/actions.
>
> I have set the heap space to -Xmx1024m. Attached are my ecore model and main
> file.
>
> Any ideas?
>
>
> My setup: Eclipse 3.3M6, EMF 3.3.0.v20070330, EMFT TENEO 0.8, Hibernate
> 3.2.4.sp1,
>
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Unknown Source)
> at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> at java.lang.AbstractStringBuilder.append(Unknown Source)
> at java.lang.StringBuffer.append(Unknown Source)
> at org.hibernate.loader.JoinWalker.selectString(JoinWalker.java :953)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:93)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initStatementS tring(AbstractEntityJoinWalker.java:78)
> at
> org.hibernate.loader.AbstractEntityJoinWalker.initAll(Abstra ctEntityJoinWalker.java:58)
> at
> org.hibernate.loader.entity.CascadeEntityJoinWalker.<init>(CascadeEntityJoinWalker.java:27)
> at
> org.hibernate.loader.entity.CascadeEntityLoader.<init>(CascadeEntityLoader.java:25)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.creat eLoaders(AbstractEntityPersister.java:3013)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.postI nstantiate(AbstractEntityPersister.java:2977)
> at
> org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1294)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:156)
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:79)
> at data.db.InitDB.doQuickStart(InitDB.java:67)
> at data.db.InitDB.main(InitDB.java:29)
>
>
> Regards
> David
>
>
>
> package data.db;
>
> import java.util.Properties;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.eclipse.emf.ecore.EPackage;
> import org.eclipse.emf.teneo.PersistenceOptions;
> import org.eclipse.emf.teneo.hibernate.HbDataStore;
> import org.eclipse.emf.teneo.hibernate.HbHelper;
> import org.hibernate.cfg.Environment;
>
> import data.model.ModelPackage;
>
> /**
> * Based on the Quick Start Tutorial
> *
> * @author <a href="mailto:david.skogan@dnv.com">David Skogan</a>
> * @version $Revision: 1.0 $
> */
> public class InitDB {
>
> private static Log log = LogFactory.getLog(InitDB.class);
>
> /** The main method */
> public static void main(String[] args) {
> // the name of the database, this database should exist but does not need to contain tables
> String dbName = "db";
> doQuickStart(dbName); //ignore return
> }
>
> /** Method which can be called by others */
> public static void doQuickStart(String dbName) {
> log.info("initialize db " + dbName);
>
> ModelPackage ePackage = ModelPackage.eINSTANCE;
>
> // create the HbDataStore
> HbDataStore hbds = (HbDataStore)HbHelper.INSTANCE.createRegisterDataStore(dbNam e);
>
> hbds.setEPackages(new EPackage[]{ePackage});
>
> final Properties hprops = new Properties();
>
> hprops.setProperty(Environment.DRIVER, "org.hsqldb.jdbcDriver");
> hprops.setProperty(Environment.URL, "jdbc:hsqldb:hsql://localhost/plcs");
> hprops.setProperty(Environment.DIALECT, org.hibernate.dialect.HSQLDialect.class.getName());
> hprops.setProperty(Environment.USER, "sa");
> hprops.setProperty(Environment.PASS, "");
>
> hprops.setProperty(Environment.C3P0_MIN_SIZE, "5");
> hprops.setProperty(Environment.C3P0_MAX_SIZE, "20");
> hprops.setProperty(Environment.C3P0_TIMEOUT, "300");
> hprops.setProperty(Environment.C3P0_MAX_STATEMENTS, "50");
> hprops.setProperty(Environment.C3P0_IDLE_TEST_PERIOD, "3000");
>
> hprops.setProperty(Environment.SHOW_SQL, "false");
>
> hbds.setHibernateProperties(hprops);
>
> final Properties props = new Properties();
> props.setProperty(PersistenceOptions.USE_MAPPING_FILE, "false");
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING, "JOINED"); // SINGLE_TABLE || JOINED
>
> hbds.setPersistenceProperties(props);
>
> hbds.initialize();
>
> if (hbds.isInitialized()) {
> System.out.println("Success!");
>
> }
> }
> }


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:[Teneo] Exception and Persistence mapping
Next Topic:subclasses not being recreated
Goto Forum:
  


Current Time: Mon Jan 25 15:09:44 GMT 2021

Powered by FUDForum. Page generated in 0.02149 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top