Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [CDO Hibernate] Problem with containingClass of CDOFeatures
[CDO Hibernate] Problem with containingClass of CDOFeatures [message #123872] Thu, 29 May 2008 19:17 Go to next message
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Hi Eike, Martin,

I have an Ecore model composed of multiple packages and I have
cross-references between packages. For example:

Package pgk1:
Class A

Package pkg2:
Class B extends A

My problem arise when I read the packages from the database. I first
launch my server, populate the database with some data. Then I shutdown
the server, launch it again and I try to add data. When adding data, I
get an exception about cdoFeature.containingClass is null.

I've looked at the code and I know where the problem is, but I'm really
not sure what would be the ideal solution. The problem can be seen in
HibernatePackageHandler.readPackage(CDOPackage). This method first
loads the package, then goes through all the classes, then through all
the features and for each feature, its containingClass is set. The
problem I have is when pkg2 is read, the features contained in Class A
(also available in Class B by inheritance) and created by Hibernate, but
their containingClass attribute are never initialized. So the
features defined in Class B are fine, but not the ones in coming from
Class A. So when I try to persist an object of Class B, I get a
NullpointerException.

So what would be the ideal solution here? I was expecting to see each
CDOFeature being created only once (aren't they supposed to be unique?)
and not every time a package is read. Is it related only to
cross-package inheritance? If I put all of my classes under the same
package, everything works.

Thanks,
Eric
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #123885 is a reply to message #123872] Thu, 29 May 2008 19:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Hi Eric, Martin

I'm not sure why the containingClass is explicitely set here, because it
should already be set in
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
whih should be called by Hibernate, if I see that correctly.

More important, which of the fields in CDOClassImpl do you mean:
- features
- allFeatures

I think only the first should be persisted by Hibernate and the second
is automatically created on demand.
Actually I don't know how exactly the Hibernate mapping looks like.

Martin, should Eric file a bug?

Cheers
/Eike


Eric schrieb:
> Hi Eike, Martin,
>
> I have an Ecore model composed of multiple packages and I have
> cross-references between packages. For example:
>
> Package pgk1:
> Class A
>
> Package pkg2:
> Class B extends A
>
> My problem arise when I read the packages from the database. I first
> launch my server, populate the database with some data. Then I
> shutdown the server, launch it again and I try to add data. When
> adding data, I get an exception about cdoFeature.containingClass is null.
>
> I've looked at the code and I know where the problem is, but I'm
> really not sure what would be the ideal solution. The problem can be
> seen in HibernatePackageHandler.readPackage(CDOPackage). This method
> first loads the package, then goes through all the classes, then
> through all the features and for each feature, its containingClass is
> set. The problem I have is when pkg2 is read, the features contained
> in Class A (also available in Class B by inheritance) and created by
> Hibernate, but their containingClass attribute are never
> initialized. So the features defined in Class B are fine, but not the
> ones in coming from Class A. So when I try to persist an object of
> Class B, I get a NullpointerException.
>
> So what would be the ideal solution here? I was expecting to see each
> CDOFeature being created only once (aren't they supposed to be
> unique?) and not every time a package is read. Is it related only to
> cross-package inheritance? If I put all of my classes under the same
> package, everything works.
>
> Thanks,
> Eric
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #123911 is a reply to message #123885] Thu, 29 May 2008 19:54 Go to previous messageGo to next message
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Well, I can confirm that
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
is not being called.

Also of note, in CDOClassImpl, the features attribute is set, and
allFeatures is null (since as you pointed out, it is only created on
demand).

Eike Stepper wrote:
> Hi Eric, Martin
>
> I'm not sure why the containingClass is explicitely set here, because it
> should already be set in
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
> whih should be called by Hibernate, if I see that correctly.
>
> More important, which of the fields in CDOClassImpl do you mean:
> - features
> - allFeatures
>
> I think only the first should be persisted by Hibernate and the second
> is automatically created on demand.
> Actually I don't know how exactly the Hibernate mapping looks like.
>
> Martin, should Eric file a bug?
>
> Cheers
> /Eike
>
>
> Eric schrieb:
>> Hi Eike, Martin,
>>
>> I have an Ecore model composed of multiple packages and I have
>> cross-references between packages. For example:
>>
>> Package pgk1:
>> Class A
>>
>> Package pkg2:
>> Class B extends A
>>
>> My problem arise when I read the packages from the database. I first
>> launch my server, populate the database with some data. Then I
>> shutdown the server, launch it again and I try to add data. When
>> adding data, I get an exception about cdoFeature.containingClass is null.
>>
>> I've looked at the code and I know where the problem is, but I'm
>> really not sure what would be the ideal solution. The problem can be
>> seen in HibernatePackageHandler.readPackage(CDOPackage). This method
>> first loads the package, then goes through all the classes, then
>> through all the features and for each feature, its containingClass is
>> set. The problem I have is when pkg2 is read, the features contained
>> in Class A (also available in Class B by inheritance) and created by
>> Hibernate, but their containingClass attribute are never
>> initialized. So the features defined in Class B are fine, but not the
>> ones in coming from Class A. So when I try to persist an object of
>> Class B, I get a NullpointerException.
>>
>> So what would be the ideal solution here? I was expecting to see each
>> CDOFeature being created only once (aren't they supposed to be
>> unique?) and not every time a package is read. Is it related only to
>> cross-package inheritance? If I put all of my classes under the same
>> package, everything works.
>>
>> Thanks,
>> Eric
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #123923 is a reply to message #123911] Thu, 29 May 2008 20:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stepper.sympedia.de

Eric schrieb:
> Well, I can confirm that
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
> is not being called.
I fear we have to ask Martin. He's currently absent but when he returns
it would be good to have a Bugzilla (hint) ;-)
>
> Also of note, in CDOClassImpl, the features attribute is set, and
> allFeatures is null (since as you pointed out, it is only created on
> demand).
>
> Eike Stepper wrote:
>> Hi Eric, Martin
>>
>> I'm not sure why the containingClass is explicitely set here, because
>> it should already be set in
>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>> whih should be called by Hibernate, if I see that correctly.
>>
>> More important, which of the fields in CDOClassImpl do you mean:
>> - features
>> - allFeatures
>>
>> I think only the first should be persisted by Hibernate and the
>> second is automatically created on demand.
>> Actually I don't know how exactly the Hibernate mapping looks like.
>>
>> Martin, should Eric file a bug?
>>
>> Cheers
>> /Eike
>>
>>
>> Eric schrieb:
>>> Hi Eike, Martin,
>>>
>>> I have an Ecore model composed of multiple packages and I have
>>> cross-references between packages. For example:
>>>
>>> Package pgk1:
>>> Class A
>>>
>>> Package pkg2:
>>> Class B extends A
>>>
>>> My problem arise when I read the packages from the database. I
>>> first launch my server, populate the database with some data. Then
>>> I shutdown the server, launch it again and I try to add data. When
>>> adding data, I get an exception about cdoFeature.containingClass is
>>> null.
>>>
>>> I've looked at the code and I know where the problem is, but I'm
>>> really not sure what would be the ideal solution. The problem can
>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>> method first loads the package, then goes through all the classes,
>>> then through all the features and for each feature, its
>>> containingClass is set. The problem I have is when pkg2 is read,
>>> the features contained in Class A (also available in Class B by
>>> inheritance) and created by Hibernate, but their containingClass
>>> attribute are never initialized. So the features defined in Class B
>>> are fine, but not the ones in coming from Class A. So when I try to
>>> persist an object of Class B, I get a NullpointerException.
>>>
>>> So what would be the ideal solution here? I was expecting to see
>>> each CDOFeature being created only once (aren't they supposed to be
>>> unique?) and not every time a package is read. Is it related only
>>> to cross-package inheritance? If I put all of my classes under the
>>> same package, everything works.
>>>
>>> Thanks,
>>> Eric
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #123949 is a reply to message #123923] Thu, 29 May 2008 21:44 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Eric,
Can you enter a bugzilla for this? I hope to have time tomorrow to look at it.

gr. Martin

Eike Stepper wrote:
> Eric schrieb:
>> Well, I can confirm that
>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>> is not being called.
> I fear we have to ask Martin. He's currently absent but when he returns
> it would be good to have a Bugzilla (hint) ;-)
>>
>> Also of note, in CDOClassImpl, the features attribute is set, and
>> allFeatures is null (since as you pointed out, it is only created on
>> demand).
>>
>> Eike Stepper wrote:
>>> Hi Eric, Martin
>>>
>>> I'm not sure why the containingClass is explicitely set here, because
>>> it should already be set in
>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>> whih should be called by Hibernate, if I see that correctly.
>>>
>>> More important, which of the fields in CDOClassImpl do you mean:
>>> - features
>>> - allFeatures
>>>
>>> I think only the first should be persisted by Hibernate and the
>>> second is automatically created on demand.
>>> Actually I don't know how exactly the Hibernate mapping looks like.
>>>
>>> Martin, should Eric file a bug?
>>>
>>> Cheers
>>> /Eike
>>>
>>>
>>> Eric schrieb:
>>>> Hi Eike, Martin,
>>>>
>>>> I have an Ecore model composed of multiple packages and I have
>>>> cross-references between packages. For example:
>>>>
>>>> Package pgk1:
>>>> Class A
>>>>
>>>> Package pkg2:
>>>> Class B extends A
>>>>
>>>> My problem arise when I read the packages from the database. I
>>>> first launch my server, populate the database with some data. Then
>>>> I shutdown the server, launch it again and I try to add data. When
>>>> adding data, I get an exception about cdoFeature.containingClass is
>>>> null.
>>>>
>>>> I've looked at the code and I know where the problem is, but I'm
>>>> really not sure what would be the ideal solution. The problem can
>>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>>> method first loads the package, then goes through all the classes,
>>>> then through all the features and for each feature, its
>>>> containingClass is set. The problem I have is when pkg2 is read,
>>>> the features contained in Class A (also available in Class B by
>>>> inheritance) and created by Hibernate, but their containingClass
>>>> attribute are never initialized. So the features defined in Class B
>>>> are fine, but not the ones in coming from Class A. So when I try to
>>>> persist an object of Class B, I get a NullpointerException.
>>>>
>>>> So what would be the ideal solution here? I was expecting to see
>>>> each CDOFeature being created only once (aren't they supposed to be
>>>> unique?) and not every time a package is read. Is it related only
>>>> to cross-package inheritance? If I put all of my classes under the
>>>> same package, everything works.
>>>>
>>>> Thanks,
>>>> Eric


--

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: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #124137 is a reply to message #123949] Fri, 30 May 2008 13:09 Go to previous message
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Bug entry: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234829

Martin Taal wrote:
> Hi Eric,
> Can you enter a bugzilla for this? I hope to have time tomorrow to look
> at it.
>
> gr. Martin
>
> Eike Stepper wrote:
>> Eric schrieb:
>>> Well, I can confirm that
>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>> is not being called.
>> I fear we have to ask Martin. He's currently absent but when he
>> returns it would be good to have a Bugzilla (hint) ;-)
>>>
>>> Also of note, in CDOClassImpl, the features attribute is set, and
>>> allFeatures is null (since as you pointed out, it is only created on
>>> demand).
>>>
>>> Eike Stepper wrote:
>>>> Hi Eric, Martin
>>>>
>>>> I'm not sure why the containingClass is explicitely set here,
>>>> because it should already be set in
>>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>>> whih should be called by Hibernate, if I see that correctly.
>>>>
>>>> More important, which of the fields in CDOClassImpl do you mean:
>>>> - features
>>>> - allFeatures
>>>>
>>>> I think only the first should be persisted by Hibernate and the
>>>> second is automatically created on demand.
>>>> Actually I don't know how exactly the Hibernate mapping looks like.
>>>>
>>>> Martin, should Eric file a bug?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>
>>>> Eric schrieb:
>>>>> Hi Eike, Martin,
>>>>>
>>>>> I have an Ecore model composed of multiple packages and I have
>>>>> cross-references between packages. For example:
>>>>>
>>>>> Package pgk1:
>>>>> Class A
>>>>>
>>>>> Package pkg2:
>>>>> Class B extends A
>>>>>
>>>>> My problem arise when I read the packages from the database. I
>>>>> first launch my server, populate the database with some data. Then
>>>>> I shutdown the server, launch it again and I try to add data. When
>>>>> adding data, I get an exception about cdoFeature.containingClass is
>>>>> null.
>>>>>
>>>>> I've looked at the code and I know where the problem is, but I'm
>>>>> really not sure what would be the ideal solution. The problem can
>>>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>>>> method first loads the package, then goes through all the classes,
>>>>> then through all the features and for each feature, its
>>>>> containingClass is set. The problem I have is when pkg2 is read,
>>>>> the features contained in Class A (also available in Class B by
>>>>> inheritance) and created by Hibernate, but their containingClass
>>>>> attribute are never initialized. So the features defined in Class
>>>>> B are fine, but not the ones in coming from Class A. So when I try
>>>>> to persist an object of Class B, I get a NullpointerException.
>>>>>
>>>>> So what would be the ideal solution here? I was expecting to see
>>>>> each CDOFeature being created only once (aren't they supposed to be
>>>>> unique?) and not every time a package is read. Is it related only
>>>>> to cross-package inheritance? If I put all of my classes under the
>>>>> same package, everything works.
>>>>>
>>>>> Thanks,
>>>>> Eric
>
>
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #619083 is a reply to message #123872] Thu, 29 May 2008 19:31 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Eric, Martin

I'm not sure why the containingClass is explicitely set here, because it
should already be set in
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
whih should be called by Hibernate, if I see that correctly.

More important, which of the fields in CDOClassImpl do you mean:
- features
- allFeatures

I think only the first should be persisted by Hibernate and the second
is automatically created on demand.
Actually I don't know how exactly the Hibernate mapping looks like.

Martin, should Eric file a bug?

Cheers
/Eike


Eric schrieb:
> Hi Eike, Martin,
>
> I have an Ecore model composed of multiple packages and I have
> cross-references between packages. For example:
>
> Package pgk1:
> Class A
>
> Package pkg2:
> Class B extends A
>
> My problem arise when I read the packages from the database. I first
> launch my server, populate the database with some data. Then I
> shutdown the server, launch it again and I try to add data. When
> adding data, I get an exception about cdoFeature.containingClass is null.
>
> I've looked at the code and I know where the problem is, but I'm
> really not sure what would be the ideal solution. The problem can be
> seen in HibernatePackageHandler.readPackage(CDOPackage). This method
> first loads the package, then goes through all the classes, then
> through all the features and for each feature, its containingClass is
> set. The problem I have is when pkg2 is read, the features contained
> in Class A (also available in Class B by inheritance) and created by
> Hibernate, but their containingClass attribute are never
> initialized. So the features defined in Class B are fine, but not the
> ones in coming from Class A. So when I try to persist an object of
> Class B, I get a NullpointerException.
>
> So what would be the ideal solution here? I was expecting to see each
> CDOFeature being created only once (aren't they supposed to be
> unique?) and not every time a package is read. Is it related only to
> cross-package inheritance? If I put all of my classes under the same
> package, everything works.
>
> Thanks,
> Eric


Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #619085 is a reply to message #123885] Thu, 29 May 2008 19:54 Go to previous message
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Well, I can confirm that
org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
is not being called.

Also of note, in CDOClassImpl, the features attribute is set, and
allFeatures is null (since as you pointed out, it is only created on
demand).

Eike Stepper wrote:
> Hi Eric, Martin
>
> I'm not sure why the containingClass is explicitely set here, because it
> should already be set in
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
> whih should be called by Hibernate, if I see that correctly.
>
> More important, which of the fields in CDOClassImpl do you mean:
> - features
> - allFeatures
>
> I think only the first should be persisted by Hibernate and the second
> is automatically created on demand.
> Actually I don't know how exactly the Hibernate mapping looks like.
>
> Martin, should Eric file a bug?
>
> Cheers
> /Eike
>
>
> Eric schrieb:
>> Hi Eike, Martin,
>>
>> I have an Ecore model composed of multiple packages and I have
>> cross-references between packages. For example:
>>
>> Package pgk1:
>> Class A
>>
>> Package pkg2:
>> Class B extends A
>>
>> My problem arise when I read the packages from the database. I first
>> launch my server, populate the database with some data. Then I
>> shutdown the server, launch it again and I try to add data. When
>> adding data, I get an exception about cdoFeature.containingClass is null.
>>
>> I've looked at the code and I know where the problem is, but I'm
>> really not sure what would be the ideal solution. The problem can be
>> seen in HibernatePackageHandler.readPackage(CDOPackage). This method
>> first loads the package, then goes through all the classes, then
>> through all the features and for each feature, its containingClass is
>> set. The problem I have is when pkg2 is read, the features contained
>> in Class A (also available in Class B by inheritance) and created by
>> Hibernate, but their containingClass attribute are never
>> initialized. So the features defined in Class B are fine, but not the
>> ones in coming from Class A. So when I try to persist an object of
>> Class B, I get a NullpointerException.
>>
>> So what would be the ideal solution here? I was expecting to see each
>> CDOFeature being created only once (aren't they supposed to be
>> unique?) and not every time a package is read. Is it related only to
>> cross-package inheritance? If I put all of my classes under the same
>> package, everything works.
>>
>> Thanks,
>> Eric
Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #619086 is a reply to message #123911] Thu, 29 May 2008 20:01 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Eric schrieb:
> Well, I can confirm that
> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
> is not being called.
I fear we have to ask Martin. He's currently absent but when he returns
it would be good to have a Bugzilla (hint) ;-)
>
> Also of note, in CDOClassImpl, the features attribute is set, and
> allFeatures is null (since as you pointed out, it is only created on
> demand).
>
> Eike Stepper wrote:
>> Hi Eric, Martin
>>
>> I'm not sure why the containingClass is explicitely set here, because
>> it should already be set in
>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>> whih should be called by Hibernate, if I see that correctly.
>>
>> More important, which of the fields in CDOClassImpl do you mean:
>> - features
>> - allFeatures
>>
>> I think only the first should be persisted by Hibernate and the
>> second is automatically created on demand.
>> Actually I don't know how exactly the Hibernate mapping looks like.
>>
>> Martin, should Eric file a bug?
>>
>> Cheers
>> /Eike
>>
>>
>> Eric schrieb:
>>> Hi Eike, Martin,
>>>
>>> I have an Ecore model composed of multiple packages and I have
>>> cross-references between packages. For example:
>>>
>>> Package pgk1:
>>> Class A
>>>
>>> Package pkg2:
>>> Class B extends A
>>>
>>> My problem arise when I read the packages from the database. I
>>> first launch my server, populate the database with some data. Then
>>> I shutdown the server, launch it again and I try to add data. When
>>> adding data, I get an exception about cdoFeature.containingClass is
>>> null.
>>>
>>> I've looked at the code and I know where the problem is, but I'm
>>> really not sure what would be the ideal solution. The problem can
>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>> method first loads the package, then goes through all the classes,
>>> then through all the features and for each feature, its
>>> containingClass is set. The problem I have is when pkg2 is read,
>>> the features contained in Class A (also available in Class B by
>>> inheritance) and created by Hibernate, but their containingClass
>>> attribute are never initialized. So the features defined in Class B
>>> are fine, but not the ones in coming from Class A. So when I try to
>>> persist an object of Class B, I get a NullpointerException.
>>>
>>> So what would be the ideal solution here? I was expecting to see
>>> each CDOFeature being created only once (aren't they supposed to be
>>> unique?) and not every time a package is read. Is it related only
>>> to cross-package inheritance? If I put all of my classes under the
>>> same package, everything works.
>>>
>>> Thanks,
>>> Eric


Re: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #619088 is a reply to message #123923] Thu, 29 May 2008 21:44 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Eric,
Can you enter a bugzilla for this? I hope to have time tomorrow to look at it.

gr. Martin

Eike Stepper wrote:
> Eric schrieb:
>> Well, I can confirm that
>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>> is not being called.
> I fear we have to ask Martin. He's currently absent but when he returns
> it would be good to have a Bugzilla (hint) ;-)
>>
>> Also of note, in CDOClassImpl, the features attribute is set, and
>> allFeatures is null (since as you pointed out, it is only created on
>> demand).
>>
>> Eike Stepper wrote:
>>> Hi Eric, Martin
>>>
>>> I'm not sure why the containingClass is explicitely set here, because
>>> it should already be set in
>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>> whih should be called by Hibernate, if I see that correctly.
>>>
>>> More important, which of the fields in CDOClassImpl do you mean:
>>> - features
>>> - allFeatures
>>>
>>> I think only the first should be persisted by Hibernate and the
>>> second is automatically created on demand.
>>> Actually I don't know how exactly the Hibernate mapping looks like.
>>>
>>> Martin, should Eric file a bug?
>>>
>>> Cheers
>>> /Eike
>>>
>>>
>>> Eric schrieb:
>>>> Hi Eike, Martin,
>>>>
>>>> I have an Ecore model composed of multiple packages and I have
>>>> cross-references between packages. For example:
>>>>
>>>> Package pgk1:
>>>> Class A
>>>>
>>>> Package pkg2:
>>>> Class B extends A
>>>>
>>>> My problem arise when I read the packages from the database. I
>>>> first launch my server, populate the database with some data. Then
>>>> I shutdown the server, launch it again and I try to add data. When
>>>> adding data, I get an exception about cdoFeature.containingClass is
>>>> null.
>>>>
>>>> I've looked at the code and I know where the problem is, but I'm
>>>> really not sure what would be the ideal solution. The problem can
>>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>>> method first loads the package, then goes through all the classes,
>>>> then through all the features and for each feature, its
>>>> containingClass is set. The problem I have is when pkg2 is read,
>>>> the features contained in Class A (also available in Class B by
>>>> inheritance) and created by Hibernate, but their containingClass
>>>> attribute are never initialized. So the features defined in Class B
>>>> are fine, but not the ones in coming from Class A. So when I try to
>>>> persist an object of Class B, I get a NullpointerException.
>>>>
>>>> So what would be the ideal solution here? I was expecting to see
>>>> each CDOFeature being created only once (aren't they supposed to be
>>>> unique?) and not every time a package is read. Is it related only
>>>> to cross-package inheritance? If I put all of my classes under the
>>>> same package, everything works.
>>>>
>>>> Thanks,
>>>> Eric


--

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: [CDO Hibernate] Problem with containingClass of CDOFeatures [message #619102 is a reply to message #123949] Fri, 30 May 2008 13:09 Go to previous message
Eric is currently offline EricFriend
Messages: 40
Registered: July 2009
Member
Bug entry: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234829

Martin Taal wrote:
> Hi Eric,
> Can you enter a bugzilla for this? I hope to have time tomorrow to look
> at it.
>
> gr. Martin
>
> Eike Stepper wrote:
>> Eric schrieb:
>>> Well, I can confirm that
>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>> is not being called.
>> I fear we have to ask Martin. He's currently absent but when he
>> returns it would be good to have a Bugzilla (hint) ;-)
>>>
>>> Also of note, in CDOClassImpl, the features attribute is set, and
>>> allFeatures is null (since as you pointed out, it is only created on
>>> demand).
>>>
>>> Eike Stepper wrote:
>>>> Hi Eric, Martin
>>>>
>>>> I'm not sure why the containingClass is explicitely set here,
>>>> because it should already be set in
>>>> org.eclipse.emf.cdo.internal.protocol.model.CDOClassImpl.set Features(List <CDOFeature>)
>>>> whih should be called by Hibernate, if I see that correctly.
>>>>
>>>> More important, which of the fields in CDOClassImpl do you mean:
>>>> - features
>>>> - allFeatures
>>>>
>>>> I think only the first should be persisted by Hibernate and the
>>>> second is automatically created on demand.
>>>> Actually I don't know how exactly the Hibernate mapping looks like.
>>>>
>>>> Martin, should Eric file a bug?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>>
>>>> Eric schrieb:
>>>>> Hi Eike, Martin,
>>>>>
>>>>> I have an Ecore model composed of multiple packages and I have
>>>>> cross-references between packages. For example:
>>>>>
>>>>> Package pgk1:
>>>>> Class A
>>>>>
>>>>> Package pkg2:
>>>>> Class B extends A
>>>>>
>>>>> My problem arise when I read the packages from the database. I
>>>>> first launch my server, populate the database with some data. Then
>>>>> I shutdown the server, launch it again and I try to add data. When
>>>>> adding data, I get an exception about cdoFeature.containingClass is
>>>>> null.
>>>>>
>>>>> I've looked at the code and I know where the problem is, but I'm
>>>>> really not sure what would be the ideal solution. The problem can
>>>>> be seen in HibernatePackageHandler.readPackage(CDOPackage). This
>>>>> method first loads the package, then goes through all the classes,
>>>>> then through all the features and for each feature, its
>>>>> containingClass is set. The problem I have is when pkg2 is read,
>>>>> the features contained in Class A (also available in Class B by
>>>>> inheritance) and created by Hibernate, but their containingClass
>>>>> attribute are never initialized. So the features defined in Class
>>>>> B are fine, but not the ones in coming from Class A. So when I try
>>>>> to persist an object of Class B, I get a NullpointerException.
>>>>>
>>>>> So what would be the ideal solution here? I was expecting to see
>>>>> each CDOFeature being created only once (aren't they supposed to be
>>>>> unique?) and not every time a package is read. Is it related only
>>>>> to cross-package inheritance? If I put all of my classes under the
>>>>> same package, everything works.
>>>>>
>>>>> Thanks,
>>>>> Eric
>
>
Previous Topic:[CDO] Does CDO fit in our scenario?
Next Topic:[CDO] Exception when using ' in Strings
Goto Forum:
  


Current Time: Tue Apr 23 17:41:08 GMT 2024

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

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

Back to the top