Home » Modeling » EMF » [Teneo] Attempting thread-bound sessions
[Teneo] Attempting thread-bound sessions [message #422354] |
Tue, 02 September 2008 15:20 |
Neil Brennan Messages: 14 Registered: July 2009 |
Junior Member |
|
|
Hi,
I'm a total newbie to Teneo and not much better (but a little) with
Hibernate, and I'm trying to use Hibernate's ability to bind sessions to
the current thread.
If I try to use hibernate.properties or hibernate.cfg.xml with the
current_session_context_class=thread property, Teneo/Hibernate are
cheerfully ignoring me.
What's more, every time I try to use anything except directly setting
properties via dataStore.setHibernateProperties() I get this error:
Hibernate Dialect must be explicitly set
So, two questions:
1. Why am I seeing this? It looks like nothing is picking up my
properties, though if I bypass Teneo totally, Hibernate works just fine;
sessionFactory = new Configuration().configure().buildSessionFactory()
works correctly, so Hibernate CAN locate the resource.
2. Is this (attempting to use thread-bound sessions) actually possible
with Teneo?
Regards,
Neil Brennan
|
|
|
Re: [Teneo] Attempting thread-bound sessions [message #422356 is a reply to message #422354] |
Tue, 02 September 2008 17:40 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
I use the method of specifying the properties in a hibernate.properties
file in /src directory, as shown here
http://www.elver.org/hibernate/tutorialone/tutorial1_2.html
Which is copied across by Eclipse automatically to the bin directory
which is on the classpath. And I get exactly the same error as Neil
despite having specified the dialect in the hibernate.properties file.
If I set it programatically then all is well apart form the next problem.
The other problem is that despite having these in my eclipse.ini
-vmargs
-server
-Dcom.sun.management.jmxremote
-Xms80m
-Xmx768m
-XX:MaxPermSize=128m
-XX:+UseParallelGC
-XX:+UseParallelOldGC
I still get Out of Memory heap space errors when I attempt to generate?
I watch the memory and the Java process is crashing out after 100MB,
despite having 768m at its disposal and -Xmx512m in the Java runtime
arguments in the Run dialog set.
Ideas?
Thx.
David
Neil Brennan wrote:
> Hi,
>
> I'm a total newbie to Teneo and not much better (but a little) with
> Hibernate, and I'm trying to use Hibernate's ability to bind sessions to
> the current thread.
>
> If I try to use hibernate.properties or hibernate.cfg.xml with the
> current_session_context_class=thread property, Teneo/Hibernate are
> cheerfully ignoring me.
>
> What's more, every time I try to use anything except directly setting
> properties via dataStore.setHibernateProperties() I get this error:
>
> Hibernate Dialect must be explicitly set
>
>
> So, two questions:
>
> 1. Why am I seeing this? It looks like nothing is picking up my
> properties, though if I bypass Teneo totally, Hibernate works just fine;
> sessionFactory = new Configuration().configure().buildSessionFactory()
> works correctly, so Hibernate CAN locate the resource.
>
> 2. Is this (attempting to use thread-bound sessions) actually possible
> with Teneo?
>
> Regards,
>
> Neil Brennan
|
|
|
Re: [Teneo] Attempting thread-bound sessions [message #422358 is a reply to message #422354] |
Tue, 02 September 2008 18:32 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Neil,
Hmm, I checked and this is a bug (within the datastore.initialize I do configuration.setProperties
which replaces the properties created from the environment). Can you enter a bugzilla for this? This
will be solved in the next build.
As a workaround you can set the properties directly on the datastore: datastore.setProperties().
Thread-bound sessions should work fine with Teneo.
gr. Martin
Neil Brennan wrote:
> Hi,
>
> I'm a total newbie to Teneo and not much better (but a little) with
> Hibernate, and I'm trying to use Hibernate's ability to bind sessions to
> the current thread.
>
> If I try to use hibernate.properties or hibernate.cfg.xml with the
> current_session_context_class=thread property, Teneo/Hibernate are
> cheerfully ignoring me.
>
> What's more, every time I try to use anything except directly setting
> properties via dataStore.setHibernateProperties() I get this error:
>
> Hibernate Dialect must be explicitly set
>
>
> So, two questions:
>
> 1. Why am I seeing this? It looks like nothing is picking up my
> properties, though if I bypass Teneo totally, Hibernate works just fine;
> sessionFactory = new Configuration().configure().buildSessionFactory()
> works correctly, so Hibernate CAN locate the resource.
>
> 2. Is this (attempting to use thread-bound sessions) actually possible
> with Teneo?
>
> Regards,
>
> Neil Brennan
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: [Teneo] Attempting thread-bound sessions [message #422359 is a reply to message #422356] |
Tue, 02 September 2008 18:34 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi David,
Yes indeed a bug, see my reply to Neil.
Regarding your out-of-memory issue. Do you run generate mapping from the eclipse menu or
programmatically?
The only thing I can think of is that the run uses a different launch configuration which does not
have the -Xmx512m, just guessing here.
gr. Martin
David Wynter wrote:
> Hi,
>
> I use the method of specifying the properties in a hibernate.properties
> file in /src directory, as shown here
> http://www.elver.org/hibernate/tutorialone/tutorial1_2.html
>
> Which is copied across by Eclipse automatically to the bin directory
> which is on the classpath. And I get exactly the same error as Neil
> despite having specified the dialect in the hibernate.properties file.
> If I set it programatically then all is well apart form the next problem.
>
> The other problem is that despite having these in my eclipse.ini
>
> -vmargs
> -server
> -Dcom.sun.management.jmxremote
> -Xms80m
> -Xmx768m
> -XX:MaxPermSize=128m
> -XX:+UseParallelGC
> -XX:+UseParallelOldGC
>
> I still get Out of Memory heap space errors when I attempt to generate?
> I watch the memory and the Java process is crashing out after 100MB,
> despite having 768m at its disposal and -Xmx512m in the Java runtime
> arguments in the Run dialog set.
>
> Ideas?
>
> Thx.
>
> David
>
> Neil Brennan wrote:
>> Hi,
>>
>> I'm a total newbie to Teneo and not much better (but a little) with
>> Hibernate, and I'm trying to use Hibernate's ability to bind sessions
>> to the current thread.
>>
>> If I try to use hibernate.properties or hibernate.cfg.xml with the
>> current_session_context_class=thread property, Teneo/Hibernate are
>> cheerfully ignoring me.
>>
>> What's more, every time I try to use anything except directly setting
>> properties via dataStore.setHibernateProperties() I get this error:
>>
>> Hibernate Dialect must be explicitly set
>>
>>
>> So, two questions:
>>
>> 1. Why am I seeing this? It looks like nothing is picking up my
>> properties, though if I bypass Teneo totally, Hibernate works just
>> fine; sessionFactory = new
>> Configuration().configure().buildSessionFactory() works correctly, so
>> Hibernate CAN locate the resource.
>>
>> 2. Is this (attempting to use thread-bound sessions) actually possible
>> with Teneo?
>>
>> Regards,
>>
>> Neil Brennan
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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: [Teneo] Attempting thread-bound sessions [message #422366 is a reply to message #422359] |
Wed, 03 September 2008 09:12 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
If you mean the hibernate mapping I use initialize() method as below.
This class is the same as it was the last time you saw it months ago.
// the name of the datastore
String hbName = "MyGenSec";
// the name of the database, this database should exist but does
not need to contain tables
String dbName = "GCSM";
// Set the database information, Environment is
org.hibernate.cfg.Environment
final Properties props = new Properties();
props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
props.setProperty(Environment.USER, "tLoader");
props.setProperty(Environment.PASS, "UUUUUUU");
props.setProperty(Environment.URL, "jdbc:mysql://localhost:3306/" +
dbName);
props.setProperty(Environment.DIALECT,
org.hibernate.dialect.MySQL5InnoDBDialect.class.getName());
props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH ,
"30");
props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY,
"true");
props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME ,
"id");
props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY, "simple");
props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
"DATE");
props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING, "true");
props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG,
"true");
props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
"JOINED");
// create the HbDataStore
HbDataStore hbds = HbHelper.INSTANCE.createRegisterDataStore(hbName);
// set the relational database to use and other properties
// to set Teneo specific options call
hbds.setPersistenceProperties(props);
hbds.setHibernateProperties(props);
// sets its epackages stored in this datastore
hbds.setEPackages(new EPackage[]{GensecPackage.eINSTANCE});
// initialize, also creates the database tables
hbds.initialize();
When you check in the fix for the properties file pickup, will it have a
dependency on 3.5M1 like the last maintenance build? I am using 3.4.
Regards,
David
Martin Taal wrote:
> Hi David,
> Yes indeed a bug, see my reply to Neil.
>
> Regarding your out-of-memory issue. Do you run generate mapping from the
> eclipse menu or programmatically?
> The only thing I can think of is that the run uses a different launch
> configuration which does not have the -Xmx512m, just guessing here.
>
> gr. Martin
>
> David Wynter wrote:
>> Hi,
>>
>> I use the method of specifying the properties in a
>> hibernate.properties file in /src directory, as shown here
>> http://www.elver.org/hibernate/tutorialone/tutorial1_2.html
>>
>> Which is copied across by Eclipse automatically to the bin directory
>> which is on the classpath. And I get exactly the same error as Neil
>> despite having specified the dialect in the hibernate.properties file.
>> If I set it programatically then all is well apart form the next problem.
>>
>> The other problem is that despite having these in my eclipse.ini
>>
>> -vmargs
>> -server
>> -Dcom.sun.management.jmxremote
>> -Xms80m
>> -Xmx768m
>> -XX:MaxPermSize=128m
>> -XX:+UseParallelGC
>> -XX:+UseParallelOldGC
>>
>> I still get Out of Memory heap space errors when I attempt to
>> generate? I watch the memory and the Java process is crashing out
>> after 100MB, despite having 768m at its disposal and -Xmx512m in the
>> Java runtime arguments in the Run dialog set.
>>
>> Ideas?
>>
>> Thx.
>>
>> David
>>
>> Neil Brennan wrote:
>>> Hi,
>>>
>>> I'm a total newbie to Teneo and not much better (but a little) with
>>> Hibernate, and I'm trying to use Hibernate's ability to bind sessions
>>> to the current thread.
>>>
>>> If I try to use hibernate.properties or hibernate.cfg.xml with the
>>> current_session_context_class=thread property, Teneo/Hibernate are
>>> cheerfully ignoring me.
>>>
>>> What's more, every time I try to use anything except directly setting
>>> properties via dataStore.setHibernateProperties() I get this error:
>>>
>>> Hibernate Dialect must be explicitly set
>>>
>>>
>>> So, two questions:
>>>
>>> 1. Why am I seeing this? It looks like nothing is picking up my
>>> properties, though if I bypass Teneo totally, Hibernate works just
>>> fine; sessionFactory = new
>>> Configuration().configure().buildSessionFactory() works correctly, so
>>> Hibernate CAN locate the resource.
>>>
>>> 2. Is this (attempting to use thread-bound sessions) actually
>>> possible with Teneo?
>>>
>>> Regards,
>>>
>>> Neil Brennan
>
>
|
|
|
Re: [Teneo] Attempting thread-bound sessions [message #422376 is a reply to message #422366] |
Wed, 03 September 2008 13:25 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
Looks like this was a one off, rebooted and the thing generates just fine.
David
David Wynter wrote:
> Hi,
>
> If you mean the hibernate mapping I use initialize() method as below.
> This class is the same as it was the last time you saw it months ago.
>
> // the name of the datastore
> String hbName = "MyGenSec";
> // the name of the database, this database should exist but does
> not need to contain tables
> String dbName = "GCSM";
>
> // Set the database information, Environment is
> org.hibernate.cfg.Environment
> final Properties props = new Properties();
>
> props.setProperty(Environment.DRIVER, "com.mysql.jdbc.Driver");
> props.setProperty(Environment.USER, "tLoader");
> props.setProperty(Environment.PASS, "UUUUUUU");
> props.setProperty(Environment.URL,
> "jdbc:mysql://localhost:3306/" + dbName);
> props.setProperty(Environment.DIALECT,
> org.hibernate.dialect.MySQL5InnoDBDialect.class.getName());
>
> props.setProperty(PersistenceOptions.MAXIMUM_SQL_NAME_LENGTH ,
> "30");
> props.setProperty(PersistenceOptions.ID_FEATURE_AS_PRIMARY_K EY,
> "true");
> props.setProperty(PersistenceOptions.DEFAULT_ID_FEATURE_NAME ,
> "id");
>
> props.setProperty(PersistenceOptions.JOIN_COLUMN_NAMING_STRA TEGY,
> "simple");
> props.setProperty(PersistenceOptions.ALSO_MAP_AS_CLASS, "false");
> props.setProperty(PersistenceOptions.DEFAULT_TEMPORAL_VALUE,
> "DATE");
>
> props.setProperty(PersistenceOptions.DISABLE_ECONTAINER_MAPP ING, "true");
> props.setProperty(PersistenceOptions.ALWAYS_VERSION, "false");
> props.setProperty(PersistenceOptions.ALWAYS_MAP_LIST_AS_BAG,
> "true");
> props.setProperty(PersistenceOptions.INHERITANCE_MAPPING,
> "JOINED");
> // create the HbDataStore
> HbDataStore hbds =
> HbHelper.INSTANCE.createRegisterDataStore(hbName);
>
> // set the relational database to use and other properties
> // to set Teneo specific options call
> hbds.setPersistenceProperties(props);
> hbds.setHibernateProperties(props);
>
> // sets its epackages stored in this datastore
> hbds.setEPackages(new EPackage[]{GensecPackage.eINSTANCE});
>
> // initialize, also creates the database tables
> hbds.initialize();
>
> When you check in the fix for the properties file pickup, will it have a
> dependency on 3.5M1 like the last maintenance build? I am using 3.4.
>
>
> Regards,
>
> David
>
> Martin Taal wrote:
>> Hi David,
>> Yes indeed a bug, see my reply to Neil.
>>
>> Regarding your out-of-memory issue. Do you run generate mapping from
>> the eclipse menu or programmatically?
>> The only thing I can think of is that the run uses a different launch
>> configuration which does not have the -Xmx512m, just guessing here.
>>
>> gr. Martin
>>
>> David Wynter wrote:
>>> Hi,
>>>
>>> I use the method of specifying the properties in a
>>> hibernate.properties file in /src directory, as shown here
>>> http://www.elver.org/hibernate/tutorialone/tutorial1_2.html
>>>
>>> Which is copied across by Eclipse automatically to the bin directory
>>> which is on the classpath. And I get exactly the same error as Neil
>>> despite having specified the dialect in the hibernate.properties
>>> file. If I set it programatically then all is well apart form the
>>> next problem.
>>>
>>> The other problem is that despite having these in my eclipse.ini
>>>
>>> -vmargs
>>> -server
>>> -Dcom.sun.management.jmxremote
>>> -Xms80m
>>> -Xmx768m
>>> -XX:MaxPermSize=128m
>>> -XX:+UseParallelGC
>>> -XX:+UseParallelOldGC
>>>
>>> I still get Out of Memory heap space errors when I attempt to
>>> generate? I watch the memory and the Java process is crashing out
>>> after 100MB, despite having 768m at its disposal and -Xmx512m in the
>>> Java runtime arguments in the Run dialog set.
>>>
>>> Ideas?
>>>
>>> Thx.
>>>
>>> David
>>>
>>> Neil Brennan wrote:
>>>> Hi,
>>>>
>>>> I'm a total newbie to Teneo and not much better (but a little) with
>>>> Hibernate, and I'm trying to use Hibernate's ability to bind
>>>> sessions to the current thread.
>>>>
>>>> If I try to use hibernate.properties or hibernate.cfg.xml with the
>>>> current_session_context_class=thread property, Teneo/Hibernate are
>>>> cheerfully ignoring me.
>>>>
>>>> What's more, every time I try to use anything except directly
>>>> setting properties via dataStore.setHibernateProperties() I get this
>>>> error:
>>>>
>>>> Hibernate Dialect must be explicitly set
>>>>
>>>>
>>>> So, two questions:
>>>>
>>>> 1. Why am I seeing this? It looks like nothing is picking up my
>>>> properties, though if I bypass Teneo totally, Hibernate works just
>>>> fine; sessionFactory = new
>>>> Configuration().configure().buildSessionFactory() works correctly,
>>>> so Hibernate CAN locate the resource.
>>>>
>>>> 2. Is this (attempting to use thread-bound sessions) actually
>>>> possible with Teneo?
>>>>
>>>> Regards,
>>>>
>>>> Neil Brennan
>>
>>
|
|
|
Goto Forum:
Current Time: Wed Apr 24 17:34:18 GMT 2024
Powered by FUDForum. Page generated in 0.03016 seconds
|