Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » HBSessionDataStore.initialize() / reinitialize?
HBSessionDataStore.initialize() / reinitialize? [message #665945] Mon, 18 April 2011 09:40 Go to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
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
[Teneo] Re: HBSessionDataStore.initialize() / reinitialize? [message #665946 is a reply to message #665945] Mon, 18 April 2011 09:43 Go to previous messageGo to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
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 #665949 is a reply to message #665946] Mon, 18 April 2011 09:48 Go to previous messageGo to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
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 #665951 is a reply to message #665949] Mon, 18 April 2011 09:51 Go to previous messageGo to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
Messages: 53
Registered: July 2009
Member
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 #665968 is a reply to message #665951] Mon, 18 April 2011 11:52 Go to previous messageGo to next message
Liviu-Marian Negrila is currently offline Liviu-Marian NegrilaFriend
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 Go to previous message
Martin Taal is currently offline Martin TaalFriend
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
Previous Topic:[EMF compare]
Next Topic:[Teneo] HbDataStore.reinitialize()
Goto Forum:
  


Current Time: Thu Apr 25 13:59:52 GMT 2024

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

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

Back to the top