|
|
|
|
Re: [Teneo] Re: HBSessionDataStore.initialize() / reinitialize? [message #665968 is a reply to message #665951] |
Mon, 18 April 2011 11:52 |
Liviu-Marian Negrila Messages: 53 Registered: July 2009 |
Member |
|
|
I did two things to be able to reInitialize:
1) I forced the Configuration reference be null on initialization:
I extended the HbDataStoreFactory and I overrriden the intialize method:
@Override
public void initialize() {
setConfiguration(null);
super.initialize();
}
2)
Also, rigth before calling the dataStore.initialize(), I reset the
hibernate properties I've used on first initialization on the datastore:
dataStore.getProperties().clear();
dataStore.setProperties(hibernateProperties);
dataStore.initialize();
Hope not to be sorry for this ugly hack later on.
Please advice
Liviu
On 18/04/11 12:51, Liviu Negrila wrote:
>
> With org.eclipse.emf.teneo.hibernate_1.1.1.v200909151729 I can call
> initialize multiple times.
>
> With 1.1.2 I can't.
>
> How can I reinitialize with 1.1.2 ?
>
> On 18/04/11 12:48, Liviu Negrila wrote:
>> I'm using:
>> EMF Teneo Hibernate Runtime 1.1.2.v201011050935
>> Hibernate 3.3.2GA
>>
>>
>> On 18/04/11 12:43, Liviu Negrila wrote:
>>> Sorry for forgetting to put [Teneo] in subject bar.
>>>
>>>
>>> On 18/04/11 12:40, Liviu Negrila wrote:
>>>> Hello,
>>>>
>>>> I need to reinitialize the HBDataStore. But how?
>>>>
>>>> I found that the reinitialize method has been removed on purpose:
>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg04326.html
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Indeed, calling the initialize method twice seened to work with teneo
>>>> prior to 1.0.1. I recently upgraded the teneo version I use.
>>>>
>>>> From 1.0.1 it throws a DuplicateMappingException.
>>>> Perhaps becouse the org.hibernate.cfg.Mappings checks to see it the
>>>> class to be added has already been added.
>>>>
>>>>
>>>>
>>>> The use case is this: I initialize a HBDataStore, read from database
>>>> some data and with that data I create dynamic classes that I add to the
>>>> set of EPackages and I would like to reinitialize so that I can use
>>>> those new mappings.
>>>>
>>>>
>>>> Please advice
>>>>
>>>> Thanks
>>>> Liviu
>>>
>>
>
|
|
|
Re: [Teneo] Re: HBSessionDataStore.initialize() / reinitialize? [message #666131 is a reply to message #665968] |
Tue, 19 April 2011 08:59 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Liviu,
Thanks for reporting this, not an ugly hack at all. I solved the issue following your approach and published a new build
which contains it. Let me know if the new build does not solve it...
gr. Martin
On 04/18/2011 01:52 PM, Liviu Negrila wrote:
> I did two things to be able to reInitialize:
>
> 1) I forced the Configuration reference be null on initialization:
> I extended the HbDataStoreFactory and I overrriden the intialize method:
> @Override
> public void initialize() {
> setConfiguration(null);
> super.initialize();
> }
>
>
> 2)
> Also, rigth before calling the dataStore.initialize(), I reset the hibernate properties I've used on first
> initialization on the datastore:
>
> dataStore.getProperties().clear();
> dataStore.setProperties(hibernateProperties);
>
> dataStore.initialize();
>
>
> Hope not to be sorry for this ugly hack later on.
> Please advice
> Liviu
>
> On 18/04/11 12:51, Liviu Negrila wrote:
>>
>> With org.eclipse.emf.teneo.hibernate_1.1.1.v200909151729 I can call
>> initialize multiple times.
>>
>> With 1.1.2 I can't.
>>
>> How can I reinitialize with 1.1.2 ?
>>
>> On 18/04/11 12:48, Liviu Negrila wrote:
>>> I'm using:
>>> EMF Teneo Hibernate Runtime 1.1.2.v201011050935
>>> Hibernate 3.3.2GA
>>>
>>>
>>> On 18/04/11 12:43, Liviu Negrila wrote:
>>>> Sorry for forgetting to put [Teneo] in subject bar.
>>>>
>>>>
>>>> On 18/04/11 12:40, Liviu Negrila wrote:
>>>>> Hello,
>>>>>
>>>>> I need to reinitialize the HBDataStore. But how?
>>>>>
>>>>> I found that the reinitialize method has been removed on purpose:
>>>>> http://dev.eclipse.org/newslists/news.eclipse.technology.emf t/msg04326.html
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Indeed, calling the initialize method twice seened to work with teneo
>>>>> prior to 1.0.1. I recently upgraded the teneo version I use.
>>>>>
>>>>> From 1.0.1 it throws a DuplicateMappingException.
>>>>> Perhaps becouse the org.hibernate.cfg.Mappings checks to see it the
>>>>> class to be added has already been added.
>>>>>
>>>>>
>>>>>
>>>>> The use case is this: I initialize a HBDataStore, read from database
>>>>> some data and with that data I create dynamic classes that I add to the
>>>>> set of EPackages and I would like to reinitialize so that I can use
>>>>> those new mappings.
>>>>>
>>>>>
>>>>> Please advice
>>>>>
>>>>> Thanks
>>>>> Liviu
>>>>
>>>
>>
>
--
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
|
|
|
Powered by
FUDForum. Page generated in 0.04204 seconds