Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo] eContainer has not been saved?
[Teneo] eContainer has not been saved? [message #83921] Fri, 18 May 2007 09:01 Go to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Hi,

I had some many-To-one eobject to save,

before executing HibernateResource's mySession.saveOrUpdate(obj)

I saw the eContainer is correct.

No exception was thrown, but in Mysql DB, the eContainer was null.

The container was init by other resource than the resource init the
contained object.

Is it the reason?

Anthony
Re: [Teneo] eContainer has not been saved? [message #83936 is a reply to message #83921] Fri, 18 May 2007 09:38 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
Was the eContainer null in the object after the save? Where/how was it set to null (you can set a
breakpoint to check out who then nullifies the eContainer)?
Which object was in which resource, was the child in resource 1 and the parent in resource 2, or
both in the same resource?

gr. Martin

Anthony wrote:
> Hi,
>
> I had some many-To-one eobject to save,
>
> before executing HibernateResource's mySession.saveOrUpdate(obj)
>
> I saw the eContainer is correct.
>
> No exception was thrown, but in Mysql DB, the eContainer was null.
>
> The container was init by other resource than the resource init the
> contained object.
>
> Is it the reason?
>
> Anthony
>


--

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: [Teneo] eContainer has not been saved? [message #83949 is a reply to message #83936] Fri, 18 May 2007 10:14 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

I add preFlush() and postFlush in my Interceptor, I could see that all
the eContainer is correct before flush and after flush. It is not set
null at all. But the field present eContainer is null.

The parent is load in resource 1 , and the child is load in resource
2.



Thanks.

Anthony




> Hi Anthony,
> Was the eContainer null in the object after the save? Where/how was it
> set to null (you can set a breakpoint to check out who then nullifies
> the eContainer)? Which object was in which resource, was the child in
> resource 1 and the parent in resource 2, or both in the same resource?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> I had some many-To-one eobject to save,
>>
>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>
>> I saw the eContainer is correct.
>>
>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>
>> The container was init by other resource than the resource init
>> the
>> contained object.
>>
>> Is it the reason?
>>
>> Anthony
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #83964 is a reply to message #83949] Fri, 18 May 2007 10:22 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
But the field in DB present eContainer is null.


Anthony


> Martin,
>
> I add preFlush() and postFlush in my Interceptor, I could see that
all
> the eContainer is correct before flush and after flush. It is not set
> null at all. But the field present eContainer is null.
>
> The parent is load in resource 1 , and the child is load in resource
> 2.
>
>
>
> Thanks.
>
> Anthony
>
>
>
>
>> Hi Anthony,
>> Was the eContainer null in the object after the save? Where/how was
it
>> set to null (you can set a breakpoint to check out who then nullifies
>> the eContainer)? Which object was in which resource, was the child in
>> resource 1 and the parent in resource 2, or both in the same
resource?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I had some many-To-one eobject to save,
>>>
>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>
>>> I saw the eContainer is correct.
>>>
>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>
>>> The container was init by other resource than the resource init
>>> the
>>> contained object.
>>>
>>> Is it the reason?
>>>
>>> Anthony
>>>
>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #83979 is a reply to message #83949] Fri, 18 May 2007 14:04 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
So before the save eContainer is not null and after the save it is null?
Did you set a breakpoint in the eBasicSetContainer method?

gr. Martin

Anthony wrote:
> Martin,
>
> I add preFlush() and postFlush in my Interceptor, I could see that all
> the eContainer is correct before flush and after flush. It is not set
> null at all. But the field present eContainer is null.
>
> The parent is load in resource 1 , and the child is load in resource
> 2.
>
>
>
> Thanks.
>
> Anthony
>
>
>
>
>> Hi Anthony,
>> Was the eContainer null in the object after the save? Where/how was it
>> set to null (you can set a breakpoint to check out who then nullifies
>> the eContainer)? Which object was in which resource, was the child in
>> resource 1 and the parent in resource 2, or both in the same resource?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I had some many-To-one eobject to save,
>>>
>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>
>>> I saw the eContainer is correct.
>>>
>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>
>>> The container was init by other resource than the resource init
>>> the
>>> contained object.
>>>
>>> Is it the reason?
>>>
>>> Anthony
>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #83994 is a reply to message #83979] Fri, 18 May 2007 14:16 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

No. It is not null before and after the saving.
Just it is not set in DB.
I think that's related to Hibernate .


I have another question to ask:

As I need to adapt to db2 tables ,
I have to write the mapping file .
I want to know if below meta arrtibutes must be inside the class ?

<meta attribute="eclassName">Customer</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>


Best regard,

Anthony


> Anthony,
> So before the save eContainer is not null and after the save it is
> null? Did you set a breakpoint in the eBasicSetContainer method?
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> I add preFlush() and postFlush in my Interceptor, I could see that
>> all
>> the eContainer is correct before flush and after flush. It is not set
>> null at all. But the field present eContainer is null.
>>
>> The parent is load in resource 1 , and the child is load in
>> resource
>> 2.
>>
>>
>>
>> Thanks.
>>
>> Anthony
>>
>>
>>
>>
>>> Hi Anthony,
>>> Was the eContainer null in the object after the save? Where/how was
>>> it set to null (you can set a breakpoint to check out who then
>>> nullifies the eContainer)? Which object was in which resource, was
>>> the child in resource 1 and the parent in resource 2, or both in the
>>> same resource?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Hi,
>>>>
>>>> I had some many-To-one eobject to save,
>>>>
>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>
>>>> I saw the eContainer is correct.
>>>>
>>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>>
>>>> The container was init by other resource than the resource init
>>>> the
>>>> contained object.
>>>>
>>>> Is it the reason?
>>>>
>>>> Anthony
>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84009 is a reply to message #83994] Fri, 18 May 2007 14:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Can you post the mapping file (or for one type which has an econtainer)?

No the meta attributes are not required for Teneo. They are for future use.
gr. Martin

Anthony wrote:
> Martin,
>
> No. It is not null before and after the saving.
> Just it is not set in DB.
> I think that's related to Hibernate .
>
>
> I have another question to ask:
>
> As I need to adapt to db2 tables ,
> I have to write the mapping file .
> I want to know if below meta arrtibutes must be inside the class ?
>
> <meta attribute="eclassName">Customer</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>
>
> Best regard,
>
> Anthony
>
>
>> Anthony,
>> So before the save eContainer is not null and after the save it is
>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> I add preFlush() and postFlush in my Interceptor, I could see that
>>> all
>>> the eContainer is correct before flush and after flush. It is not set
>>> null at all. But the field present eContainer is null.
>>>
>>> The parent is load in resource 1 , and the child is load in
>>> resource
>>> 2.
>>>
>>>
>>>
>>> Thanks.
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>> Hi Anthony,
>>>> Was the eContainer null in the object after the save? Where/how was
>>>> it set to null (you can set a breakpoint to check out who then
>>>> nullifies the eContainer)? Which object was in which resource, was
>>>> the child in resource 1 and the parent in resource 2, or both in the
>>>> same resource?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Hi,
>>>>>
>>>>> I had some many-To-one eobject to save,
>>>>>
>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>
>>>>> I saw the eContainer is correct.
>>>>>
>>>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>>>
>>>>> The container was init by other resource than the resource init
>>>>> the
>>>>> contained object.
>>>>>
>>>>> Is it the reason?
>>>>>
>>>>> Anthony
>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84023 is a reply to message #84009] Fri, 18 May 2007 14:40 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

ProductRegistry is Product's container.

<subclass entity-name="Product" abstract="false" lazy="false"
extends="NamedElement" discriminator-value="Product">
<meta attribute="eclassName">Product</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>
<property name="productId" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`productid`"/>
</property>

<many-to-one name="productRegistry" entity-
name="ProductRegistry" cascade="merge,persist,save-update,lock,refresh"
lazy="false" insert="false" update="false" not-null="false">
<column not-null="false" unique="false"
name="`product_productregistry_id`"/>
</many-to-one>
</subclass>


<class entity-name="ProductRegistry" abstract="false" lazy="false"
discriminator-value="ProductRegistry" table="`productregistry`">
<meta attribute="eclassName">ProductRegistry</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPro
pertyHandler">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp erty
Handler">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="modelName" lazy="false" insert="true"
update="true" not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false"
name="`modelname`"/>
</property>
</class>


Anthony



> Anthony,
> Can you post the mapping file (or for one type which has an
> econtainer)?
>
> No the meta attributes are not required for Teneo. They are for future
> use. gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> No. It is not null before and after the saving.
>> Just it is not set in DB.
>> I think that's related to Hibernate .
>>
>>
>> I have another question to ask:
>>
>> As I need to adapt to db2 tables ,
>> I have to write the mapping file .
>> I want to know if below meta arrtibutes must be inside the class ?
>>
>> <meta attribute="eclassName">Customer</meta>
>> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>>
>>
>> Best regard,
>>
>> Anthony
>>
>>
>>> Anthony,
>>> So before the save eContainer is not null and after the save it is
>>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> I add preFlush() and postFlush in my Interceptor, I could see
>>>> that all
>>>> the eContainer is correct before flush and after flush. It is not
>>>> set null at all. But the field present eContainer is null.
>>>>
>>>> The parent is load in resource 1 , and the child is load in
>>>> resource
>>>> 2.
>>>>
>>>>
>>>>
>>>> Thanks.
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>> Hi Anthony,
>>>>> Was the eContainer null in the object after the save? Where/how
>>>>> was it set to null (you can set a breakpoint to check out who then
>>>>> nullifies the eContainer)? Which object was in which resource, was
>>>>> the child in resource 1 and the parent in resource 2, or both in
>>>>> the same resource?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I had some many-To-one eobject to save,
>>>>>>
>>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>>
>>>>>> I saw the eContainer is correct.
>>>>>>
>>>>>> No exception was thrown, but in Mysql DB, the eContainer was
>>>>>> null.
>>>>>>
>>>>>> The container was init by other resource than the resource
>>>>>> init the
>>>>>> contained object.
>>>>>>
>>>>>> Is it the reason?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84039 is a reply to message #84023] Fri, 18 May 2007 14:43 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Can you set a breakpoint in the method HbDataStore.addContainerMapping to check if it is called?
This method adds the econtainer mapping to the hbm mapping.

gr. Martin

Anthony wrote:
> Martin,
>
> ProductRegistry is Product's container.
>
> <subclass entity-name="Product" abstract="false" lazy="false"
> extends="NamedElement" discriminator-value="Product">
> <meta attribute="eclassName">Product</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
> <property name="productId" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`productid`"/>
> </property>
>
> <many-to-one name="productRegistry" entity-
> name="ProductRegistry" cascade="merge,persist,save-update,lock,refresh"
> lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false"
> name="`product_productregistry_id`"/>
> </many-to-one>
> </subclass>
>
>
> <class entity-name="ProductRegistry" abstract="false" lazy="false"
> discriminator-value="ProductRegistry" table="`productregistry`">
> <meta attribute="eclassName">ProductRegistry</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPro
> pertyHandler">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp erty
> Handler">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="modelName" lazy="false" insert="true"
> update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false"
> name="`modelname`"/>
> </property>
> </class>
>
>
> Anthony
>
>
>
>> Anthony,
>> Can you post the mapping file (or for one type which has an
>> econtainer)?
>>
>> No the meta attributes are not required for Teneo. They are for future
>> use. gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> No. It is not null before and after the saving.
>>> Just it is not set in DB.
>>> I think that's related to Hibernate .
>>>
>>>
>>> I have another question to ask:
>>>
>>> As I need to adapt to db2 tables ,
>>> I have to write the mapping file .
>>> I want to know if below meta arrtibutes must be inside the class ?
>>>
>>> <meta attribute="eclassName">Customer</meta>
>>> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>>>
>>>
>>> Best regard,
>>>
>>> Anthony
>>>
>>>
>>>> Anthony,
>>>> So before the save eContainer is not null and after the save it is
>>>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> I add preFlush() and postFlush in my Interceptor, I could see
>>>>> that all
>>>>> the eContainer is correct before flush and after flush. It is not
>>>>> set null at all. But the field present eContainer is null.
>>>>>
>>>>> The parent is load in resource 1 , and the child is load in
>>>>> resource
>>>>> 2.
>>>>>
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Anthony,
>>>>>> Was the eContainer null in the object after the save? Where/how
>>>>>> was it set to null (you can set a breakpoint to check out who then
>>>>>> nullifies the eContainer)? Which object was in which resource, was
>>>>>> the child in resource 1 and the parent in resource 2, or both in
>>>>>> the same resource?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I had some many-To-one eobject to save,
>>>>>>>
>>>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>>>
>>>>>>> I saw the eContainer is correct.
>>>>>>>
>>>>>>> No exception was thrown, but in Mysql DB, the eContainer was
>>>>>>> null.
>>>>>>>
>>>>>>> The container was init by other resource than the resource
>>>>>>> init the
>>>>>>> contained object.
>>>>>>>
>>>>>>> Is it the reason?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84054 is a reply to message #84039] Fri, 18 May 2007 15:04 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Yes, it got called.



Anthony
Re: [Teneo] eContainer has not been saved? [message #84069 is a reply to message #84039] Fri, 18 May 2007 15:16 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

I step into HbDataStore's addContainerMapping(),

For Product class ,it's referers has not include ProductRegistry,
so rt.isContainer() always return false.

Is it correct behavior?

Anthony
Re: [Teneo] eContainer has not been saved? [message #84084 is a reply to message #84069] Fri, 18 May 2007 15:33 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I start to understand. In Teneo I only considered the case that the containment relation was defined
from the parent to the child. In your case (I now understand) it is defined from the child to the
parent. Correct?

What is the ecore definition of Product.productRegistry?

gr. Martin

Anthony wrote:
> Martin,
>
> I step into HbDataStore's addContainerMapping(),
>
> For Product class ,it's referers has not include ProductRegistry,
> so rt.isContainer() always return false.
>
> Is it correct behavior?
>
> Anthony


--

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: [Teneo] eContainer has not been saved? [message #84111 is a reply to message #84084] Sat, 19 May 2007 10:10 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
@build.eclipse.org:

> Product.productRegistry

Martin,

Product.ProductRegistry :

container:true
containment: false
resolve proxies: true
required: true
lower bound: 1
upper bound: 1
Transient : false
Many : false
EOpposite : products

ProductRegistry.products:

container:false
containment: true
resolve proxies: true
required: false
lower bound: 0
upper bound: -1
Transient : true
Many : true
EOpposite : productRegistry

Regards,

Anthony
Re: [Teneo] eContainer has not been saved? [message #84126 is a reply to message #84111] Sat, 19 May 2007 10:57 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The cause is that transient is true for ProductRegistry.products. I think that this has to do with a
performance issue in your case (the products collection is very large). Is that correct?
Otherwise setting transient to false will ensure that the container is set in the db.
Even now if the products are read from the db through the ProductRegistry.products then when loading
the products their econtainer should normally be set correctly.
Did you try that? Or do you read products independently? In the last case you can get the container
from the product.ProductRegistry.
So in short is it an issue for your app that the econtainer is not stored separately in the
econtainer fields in the db?

gr. Martin

Anthony wrote:
> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
> @build.eclipse.org:
>
>> Product.productRegistry
>
> Martin,
>
> Product.ProductRegistry :
>
> container:true
> containment: false
> resolve proxies: true
> required: true
> lower bound: 1
> upper bound: 1
> Transient : false
> Many : false
> EOpposite : products
>
> ProductRegistry.products:
>
> container:false
> containment: true
> resolve proxies: true
> required: false
> lower bound: 0
> upper bound: -1
> Transient : true
> Many : true
> EOpposite : productRegistry
>
> Regards,
>
> Anthony
>


--

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: [Teneo] eContainer has not been saved? [message #84142 is a reply to message #84126] Sat, 19 May 2007 11:09 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in
news:f2ml6i$j5i$1@build.eclipse.org:

> The cause is that transient is true for ProductRegistry.products. I
> think that this has to do with a performance issue in your case (the
> products collection is very large). Is that correct?

YES.


> Otherwise setting
> transient to false will ensure that the container is set in the db.
> Even now if the products are read from the db through the
> ProductRegistry.products then when loading the products their
> econtainer should normally be set correctly. Did you try that? Or do
> you read products independently?

I load ProductRegistry first,
and then I load product in another resource as I need to do pagination,


> In the last case you can get the
> container from the product.ProductRegistry.

In fact , the product table has no ProductRegistry , it only have
field EContainer , I guess they has been merged as one. Right?



> So in short is it an issue for your app that the econtainer is not
> stored separately in the econtainer fields in the db?

In DB the econtainer field is always null.

?

Anthony


>
> gr. Martin
>
> Anthony wrote:
>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>> @build.eclipse.org:
>>
>>> Product.productRegistry
>>
>> Martin,
>>
>> Product.ProductRegistry :
>>
>> container:true
>> containment: false
>> resolve proxies: true
>> required: true
>> lower bound: 1
>> upper bound: 1
>> Transient : false
>> Many : false
>> EOpposite : products
>>
>> ProductRegistry.products:
>>
>> container:false
>> containment: true
>> resolve proxies: true
>> required: false
>> lower bound: 0
>> upper bound: -1
>> Transient : true
>> Many : true
>> EOpposite : productRegistry
>>
>> Regards,
>>
>> Anthony
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84157 is a reply to message #84142] Sat, 19 May 2007 11:31 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay, one thing I find strange is that there is an econtainer field in the product but it does not
do addcontainermapping for this type.

Can you try the following:
override the HbSessionDataStore and the addContainerMapping method with the method below.
The only change I made is that in this method if a isContainer ereference is found no econtainer
mapping is added. Also you need to replace the code NAME_IS_PRODUCT with something meaningfull. It
is not a nice solution but it can help to identify how to solve this.

/**
* Adds a econtainer mapping to the class mapping, is only called for eclasses which do not have
* am explicit feature which points to the container
*/
protected void addContainerMapping(PersistentClass pc) {

// always first check if the super class should have a container mapping
if (pc.getSuperclass() != null) {
addContainerMapping(pc.getSuperclass());
}

if (!isContained(pc) && !NAME_IS_PRODUCT) return;
if (hasEContainerProp(pc)) return;

log.debug("Adding container mapping for " + getMappedName(pc));
// check if there are not alreadyecontai ner features for the eclass

final EClass eclass;
if (pc.getEntityName() != null) {
eclass =
getPersistenceOptions().getEClassNameStrategy().toEClass(pc. getEntityName(),
getEPackages());
} else {
eclass = EModelResolver.instance().getEClass(pc.getMappedClass());
}

// DCB: Provide a way to avoid container mappings for a particular
// class. You'd do this if, for example,
// you never load the contained objects except through the containers...
// or, you don't fit the use case
// for which this was put together (i.e., the generated model editing
// code tries to eagerly resolve the
// container)
if (eclass == null
|| eclass.getEAnnotation("http://facet.elver.org/SkipContainerMappings") != null) {
return; // featuremap
}

if (!NAME_IS_PRODUCT) {
for (EReference eref : eclass.getEAllReferences()) {
if (eref.isContainer()) {
log
.debug("There are container ereferences present, assuming that no separate econta iner columns
are required.");
return;
}
}
}

log.debug("Adding eContainer and econtainerfeatureid properties to " + pc.getClassName());

final Property eContainer = new Property();
eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
eContainer.setMetaAttributes(new HashMap<Object, Object>());
eContainer.setNodeName(eContainer.getName());
eContainer.setPropertyAccessorName(EContainerAccessor.class. getName());

final SimpleValue sv = new SimpleValue(pc.getTable());
sv.setTypeName(EContainerUserType.class.getName());

final Column eccColumn = new Column(HbConstants.COLUMN_ECONTAINER_CLASS);
sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));

final Column ecColumn = new Column(HbConstants.COLUMN_ECONTAINER);
sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));

eContainer.setValue(sv);
pc.addProperty(eContainer);

final Property ecFID = new Property();
ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
ecFID.setMetaAttributes(new HashMap<Object, Object>());
ecFID.setNodeName(ecFID.getName());
ecFID.setPropertyAccessorName(EContainerFeatureIDAccessor.cl ass.getName());
final SimpleValue svfid = new SimpleValue(pc.getTable());
svfid.setTypeName("integer");

final Column ecfColumn = new Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
svfid.addColumn(checkColumnExists(pc.getTable(), ecfColumn));

ecFID.setValue(svfid);
pc.addProperty(ecFID);
}


Anthony wrote:
> Martin Taal <mtaal@elver.org> wrote in
> news:f2ml6i$j5i$1@build.eclipse.org:
>
>> The cause is that transient is true for ProductRegistry.products. I
>> think that this has to do with a performance issue in your case (the
>> products collection is very large). Is that correct?
>
> YES.
>
>
>> Otherwise setting
>> transient to false will ensure that the container is set in the db.
>> Even now if the products are read from the db through the
>> ProductRegistry.products then when loading the products their
>> econtainer should normally be set correctly. Did you try that? Or do
>> you read products independently?
>
> I load ProductRegistry first,
> and then I load product in another resource as I need to do pagination,
>
>
>> In the last case you can get the
>> container from the product.ProductRegistry.
>
> In fact , the product table has no ProductRegistry , it only have
> field EContainer , I guess they has been merged as one. Right?
>
>
>
>> So in short is it an issue for your app that the econtainer is not
>> stored separately in the econtainer fields in the db?
>
> In DB the econtainer field is always null.
>
> ?
>
> Anthony
>
>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>> @build.eclipse.org:
>>>
>>>> Product.productRegistry
>>> Martin,
>>>
>>> Product.ProductRegistry :
>>>
>>> container:true
>>> containment: false
>>> resolve proxies: true
>>> required: true
>>> lower bound: 1
>>> upper bound: 1
>>> Transient : false
>>> Many : false
>>> EOpposite : products
>>>
>>> ProductRegistry.products:
>>>
>>> container:false
>>> containment: true
>>> resolve proxies: true
>>> required: false
>>> lower bound: 0
>>> upper bound: -1
>>> Transient : true
>>> Many : true
>>> EOpposite : productRegistry
>>>
>>> Regards,
>>>
>>> Anthony
>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84173 is a reply to message #84157] Sat, 19 May 2007 12:10 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

At this time I am using Teneo 0.7.5, it has only HbDataStore.

So I need to upgrade to 0.8.


Tomorrow I will try it.


Thanks.


Anthony


> Okay, one thing I find strange is that there is an econtainer field in
> the product but it does not do addcontainermapping for this type.
>
> Can you try the following:
> override the HbSessionDataStore and the addContainerMapping method
> with the method below. The only change I made is that in this method
> if a isContainer ereference is found no econtainer mapping is added.
> Also you need to replace the code NAME_IS_PRODUCT with something
> meaningfull. It is not a nice solution but it can help to identify how
> to solve this.
>
> /**
> * Adds a econtainer mapping to the class mapping, is only called
> for eclasses which do not have * am explicit feature which
> points to the container */
> protected void addContainerMapping(PersistentClass pc) {
>
> // always first check if the super class should have a
> container mapping if (pc.getSuperclass() != null) {
> addContainerMapping(pc.getSuperclass());
> }
>
> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
> if (hasEContainerProp(pc)) return;
>
> log.debug("Adding container mapping for " +
> getMappedName(pc)); // check if there are not alreadyecontai
> ner features for the eclass
>
> final EClass eclass;
> if (pc.getEntityName() != null) {
> eclass =
> getPersistenceOptions().getEClassNameStrategy
(
> ).toEClass(pc.getEntityName(),
> getEPackages());
> } else {
> eclass =
> EModelResolver.instance().getEClass(pc.getMappedClass
())
> ;
> }
>
> // DCB: Provide a way to avoid container mappings for a
> particular // class. You'd do this if, for example,
> // you never load the contained objects except through the
> containers... // or, you don't fit the use case
> // for which this was put together (i.e., the generated
> model editing // code tries to eagerly resolve the
> // container)
> if (eclass == null
> || eclass.getEAnnotation
("http://facet.elver.org/Sk
> || ipContainerMappings") != null) {
> return; // featuremap
> }
>
> if (!NAME_IS_PRODUCT) {
> for (EReference eref : eclass.getEAllReferences()) {
> if (eref.isContainer()) {
> log
> .debug("There are container ereferences
> present, assuming that no separate
> econta iner columns
> are required.");
> return;
> }
> }
> }
>
> log.debug("Adding eContainer and econtainerfeatureid
> properties to " + pc.getClassName());
>
> final Property eContainer = new Property();
> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
> eContainer.setMetaAttributes(new HashMap<Object, Object>());
> eContainer.setNodeName(eContainer.getName());
> eContainer.setPropertyAccessorName
(EContainerAccessor.class.g
> etName());
>
> final SimpleValue sv = new SimpleValue(pc.getTable());
> sv.setTypeName(EContainerUserType.class.getName());
>
> final Column eccColumn = new
> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>
> final Column ecColumn = new
> Column(HbConstants.COLUMN_ECONTAINER);
> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>
> eContainer.setValue(sv);
> pc.addProperty(eContainer);
>
> final Property ecFID = new Property();
> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
> ecFID.setMetaAttributes(new HashMap<Object, Object>());
> ecFID.setNodeName(ecFID.getName());
> ecFID.setPropertyAccessorName
(EContainerFeatureIDAccessor.cla
> ss.getName()); final SimpleValue svfid = new
> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>
> final Column ecfColumn = new
> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
> svfid.addColumn(checkColumnExists(pc.getTable(),
> ecfColumn));
>
> ecFID.setValue(svfid);
> pc.addProperty(ecFID);
> }
>
>
> Anthony wrote:
>> Martin Taal <mtaal@elver.org> wrote in
>> news:f2ml6i$j5i$1@build.eclipse.org:
>>
>>> The cause is that transient is true for ProductRegistry.products. I
>>> think that this has to do with a performance issue in your case (the
>>> products collection is very large). Is that correct?
>>
>> YES.
>>
>>
>>> Otherwise setting
>>> transient to false will ensure that the container is set in the db.
>>> Even now if the products are read from the db through the
>>> ProductRegistry.products then when loading the products their
>>> econtainer should normally be set correctly. Did you try that? Or do
>>> you read products independently?
>>
>> I load ProductRegistry first,
>> and then I load product in another resource as I need to do
>> pagination,
>>
>>
>>> In the last case you can get the
>>> container from the product.ProductRegistry.
>>
>> In fact , the product table has no ProductRegistry , it only have
>> field EContainer , I guess they has been merged as one. Right?
>>
>>
>>
>>> So in short is it an issue for your app that the econtainer is not
>>> stored separately in the econtainer fields in the db?
>>
>> In DB the econtainer field is always null.
>>
>> ?
>>
>> Anthony
>>
>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>> @build.eclipse.org:
>>>>
>>>>> Product.productRegistry
>>>> Martin,
>>>>
>>>> Product.ProductRegistry :
>>>>
>>>> container:true
>>>> containment: false
>>>> resolve proxies: true
>>>> required: true
>>>> lower bound: 1
>>>> upper bound: 1
>>>> Transient : false
>>>> Many : false
>>>> EOpposite : products
>>>>
>>>> ProductRegistry.products:
>>>>
>>>> container:false
>>>> containment: true
>>>> resolve proxies: true
>>>> required: false
>>>> lower bound: 0
>>>> upper bound: -1
>>>> Transient : true
>>>> Many : true
>>>> EOpposite : productRegistry
>>>>
>>>> Regards,
>>>>
>>>> Anthony
>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84188 is a reply to message #84173] Sun, 20 May 2007 04:04 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
This part of the code did not change that much since 0.7.5. For 0.7.5 you can override the HbDataStore.

gr. Martin

Anthony wrote:
> Martin,
>
> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>
> So I need to upgrade to 0.8.
>
>
> Tomorrow I will try it.
>
>
> Thanks.
>
>
> Anthony
>
>
>> Okay, one thing I find strange is that there is an econtainer field in
>> the product but it does not do addcontainermapping for this type.
>>
>> Can you try the following:
>> override the HbSessionDataStore and the addContainerMapping method
>> with the method below. The only change I made is that in this method
>> if a isContainer ereference is found no econtainer mapping is added.
>> Also you need to replace the code NAME_IS_PRODUCT with something
>> meaningfull. It is not a nice solution but it can help to identify how
>> to solve this.
>>
>> /**
>> * Adds a econtainer mapping to the class mapping, is only called
>> for eclasses which do not have * am explicit feature which
>> points to the container */
>> protected void addContainerMapping(PersistentClass pc) {
>>
>> // always first check if the super class should have a
>> container mapping if (pc.getSuperclass() != null) {
>> addContainerMapping(pc.getSuperclass());
>> }
>>
>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>> if (hasEContainerProp(pc)) return;
>>
>> log.debug("Adding container mapping for " +
>> getMappedName(pc)); // check if there are not alreadyecontai
>> ner features for the eclass
>>
>> final EClass eclass;
>> if (pc.getEntityName() != null) {
>> eclass =
>> getPersistenceOptions().getEClassNameStrategy
> (
>> ).toEClass(pc.getEntityName(),
>> getEPackages());
>> } else {
>> eclass =
>> EModelResolver.instance().getEClass(pc.getMappedClass
> ())
>> ;
>> }
>>
>> // DCB: Provide a way to avoid container mappings for a
>> particular // class. You'd do this if, for example,
>> // you never load the contained objects except through the
>> containers... // or, you don't fit the use case
>> // for which this was put together (i.e., the generated
>> model editing // code tries to eagerly resolve the
>> // container)
>> if (eclass == null
>> || eclass.getEAnnotation
> ("http://facet.elver.org/Sk
>> || ipContainerMappings") != null) {
>> return; // featuremap
>> }
>>
>> if (!NAME_IS_PRODUCT) {
>> for (EReference eref : eclass.getEAllReferences()) {
>> if (eref.isContainer()) {
>> log
>> .debug("There are container ereferences
>> present, assuming that no separate
>> econta iner columns
>> are required.");
>> return;
>> }
>> }
>> }
>>
>> log.debug("Adding eContainer and econtainerfeatureid
>> properties to " + pc.getClassName());
>>
>> final Property eContainer = new Property();
>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>> eContainer.setMetaAttributes(new HashMap<Object, Object>());
>> eContainer.setNodeName(eContainer.getName());
>> eContainer.setPropertyAccessorName
> (EContainerAccessor.class.g
>> etName());
>>
>> final SimpleValue sv = new SimpleValue(pc.getTable());
>> sv.setTypeName(EContainerUserType.class.getName());
>>
>> final Column eccColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>
>> final Column ecColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER);
>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>
>> eContainer.setValue(sv);
>> pc.addProperty(eContainer);
>>
>> final Property ecFID = new Property();
>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>> ecFID.setNodeName(ecFID.getName());
>> ecFID.setPropertyAccessorName
> (EContainerFeatureIDAccessor.cla
>> ss.getName()); final SimpleValue svfid = new
>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>
>> final Column ecfColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>> svfid.addColumn(checkColumnExists(pc.getTable(),
>> ecfColumn));
>>
>> ecFID.setValue(svfid);
>> pc.addProperty(ecFID);
>> }
>>
>>
>> Anthony wrote:
>>> Martin Taal <mtaal@elver.org> wrote in
>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>
>>>> The cause is that transient is true for ProductRegistry.products. I
>>>> think that this has to do with a performance issue in your case (the
>>>> products collection is very large). Is that correct?
>>> YES.
>>>
>>>
>>>> Otherwise setting
>>>> transient to false will ensure that the container is set in the db.
>>>> Even now if the products are read from the db through the
>>>> ProductRegistry.products then when loading the products their
>>>> econtainer should normally be set correctly. Did you try that? Or do
>>>> you read products independently?
>>> I load ProductRegistry first,
>>> and then I load product in another resource as I need to do
>>> pagination,
>>>
>>>
>>>> In the last case you can get the
>>>> container from the product.ProductRegistry.
>>> In fact , the product table has no ProductRegistry , it only have
>>> field EContainer , I guess they has been merged as one. Right?
>>>
>>>
>>>
>>>> So in short is it an issue for your app that the econtainer is not
>>>> stored separately in the econtainer fields in the db?
>>> In DB the econtainer field is always null.
>>>
>>> ?
>>>
>>> Anthony
>>>
>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>> @build.eclipse.org:
>>>>>
>>>>>> Product.productRegistry
>>>>> Martin,
>>>>>
>>>>> Product.ProductRegistry :
>>>>>
>>>>> container:true
>>>>> containment: false
>>>>> resolve proxies: true
>>>>> required: true
>>>>> lower bound: 1
>>>>> upper bound: 1
>>>>> Transient : false
>>>>> Many : false
>>>>> EOpposite : products
>>>>>
>>>>> ProductRegistry.products:
>>>>>
>>>>> container:false
>>>>> containment: true
>>>>> resolve proxies: true
>>>>> required: false
>>>>> lower bound: 0
>>>>> upper bound: -1
>>>>> Transient : true
>>>>> Many : true
>>>>> EOpposite : productRegistry
>>>>>
>>>>> Regards,
>>>>>
>>>>> Anthony
>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84220 is a reply to message #84188] Sun, 20 May 2007 04:44 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

As isContained(),hasEContainerProp(),checkColumnExists() are private
method,HbDataStore's addContainerMapping() cannot be overrided.

Is there another way to work around?

Thanks.

Anthony

> Anthony,
> This part of the code did not change that much since 0.7.5. For 0.7.5
> you can override the HbDataStore.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>
>> So I need to upgrade to 0.8.
>>
>>
>> Tomorrow I will try it.
>>
>>
>> Thanks.
>>
>>
>> Anthony
>>
>>
>>> Okay, one thing I find strange is that there is an econtainer field
>>> in the product but it does not do addcontainermapping for this type.
>>>
>>> Can you try the following:
>>> override the HbSessionDataStore and the addContainerMapping method
>>> with the method below. The only change I made is that in this method
>>> if a isContainer ereference is found no econtainer mapping is added.
>>> Also you need to replace the code NAME_IS_PRODUCT with something
>>> meaningfull. It is not a nice solution but it can help to identify
>>> how to solve this.
>>>
>>> /**
>>> * Adds a econtainer mapping to the class mapping, is only
>>> called for eclasses which do not have * am explicit feature
>>> which points to the container */
>>> protected void addContainerMapping(PersistentClass pc) {
>>>
>>> // always first check if the super class should have a
>>> container mapping if (pc.getSuperclass() != null) {
>>> addContainerMapping(pc.getSuperclass());
>>> }
>>>
>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>> if (hasEContainerProp(pc)) return;
>>>
>>> log.debug("Adding container mapping for " +
>>> getMappedName(pc)); // check if there are not
>>> alreadyecontai ner features for the eclass
>>>
>>> final EClass eclass;
>>> if (pc.getEntityName() != null) {
>>> eclass =
>>> getPersistenceOptions
().getEClassNameStrateg
>>> y
>> (
>>> ).toEClass(pc.getEntityName(),
>>> getEPackages());
>>> } else {
>>> eclass =
>>> EModelResolver.instance().getEClass(pc.getMappedClass
>> ())
>>> ;
>>> }
>>>
>>> // DCB: Provide a way to avoid container mappings for a
>>> particular // class. You'd do this if, for example,
>>> // you never load the contained objects except through the
>>> containers... // or, you don't fit the use case
>>> // for which this was put together (i.e., the generated
>>> model editing // code tries to eagerly resolve the
>>> // container)
>>> if (eclass == null
>>> || eclass.getEAnnotation
>> ("http://facet.elver.org/Sk
>>> || ipContainerMappings") != null) {
>>> return; // featuremap
>>> }
>>>
>>> if (!NAME_IS_PRODUCT) {
>>> for (EReference eref : eclass.getEAllReferences()) {
>>> if (eref.isContainer()) {
>>> log
>>> .debug("There are container
>>> ereferences
>>> present, assuming that no separate
>>> econta iner columns
>>> are required.");
>>> return;
>>> }
>>> }
>>> }
>>>
>>> log.debug("Adding eContainer and econtainerfeatureid
>>> properties to " + pc.getClassName());
>>>
>>> final Property eContainer = new Property();
>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>> eContainer.setMetaAttributes(new HashMap<Object,
>>> Object>()); eContainer.setNodeName(eContainer.getName());
>>> eContainer.setPropertyAccessorName
>> (EContainerAccessor.class.g
>>> etName());
>>>
>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>> sv.setTypeName(EContainerUserType.class.getName());
>>>
>>> final Column eccColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>>
>>> final Column ecColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER);
>>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>>
>>> eContainer.setValue(sv);
>>> pc.addProperty(eContainer);
>>>
>>> final Property ecFID = new Property();
>>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>>> ecFID.setNodeName(ecFID.getName());
>>> ecFID.setPropertyAccessorName
>> (EContainerFeatureIDAccessor.cla
>>> ss.getName()); final SimpleValue svfid = new
>>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>>
>>> final Column ecfColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>> ecfColumn));
>>>
>>> ecFID.setValue(svfid);
>>> pc.addProperty(ecFID);
>>> }
>>>
>>>
>>> Anthony wrote:
>>>> Martin Taal <mtaal@elver.org> wrote in
>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>
>>>>> The cause is that transient is true for ProductRegistry.products.
>>>>> I think that this has to do with a performance issue in your case
>>>>> (the products collection is very large). Is that correct?
>>>> YES.
>>>>
>>>>
>>>>> Otherwise setting
>>>>> transient to false will ensure that the container is set in the
>>>>> db. Even now if the products are read from the db through the
>>>>> ProductRegistry.products then when loading the products their
>>>>> econtainer should normally be set correctly. Did you try that? Or
>>>>> do you read products independently?
>>>> I load ProductRegistry first,
>>>> and then I load product in another resource as I need to do
>>>> pagination,
>>>>
>>>>
>>>>> In the last case you can get the
>>>>> container from the product.ProductRegistry.
>>>> In fact , the product table has no ProductRegistry , it only have
>>>> field EContainer , I guess they has been merged as one. Right?
>>>>
>>>>
>>>>
>>>>> So in short is it an issue for your app that the econtainer is not
>>>>> stored separately in the econtainer fields in the db?
>>>> In DB the econtainer field is always null.
>>>>
>>>> ?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>>> Product.productRegistry
>>>>>> Martin,
>>>>>>
>>>>>> Product.ProductRegistry :
>>>>>>
>>>>>> container:true
>>>>>> containment: false
>>>>>> resolve proxies: true
>>>>>> required: true
>>>>>> lower bound: 1
>>>>>> upper bound: 1
>>>>>> Transient : false
>>>>>> Many : false
>>>>>> EOpposite : products
>>>>>>
>>>>>> ProductRegistry.products:
>>>>>>
>>>>>> container:false
>>>>>> containment: true
>>>>>> resolve proxies: true
>>>>>> required: false
>>>>>> lower bound: 0
>>>>>> upper bound: -1
>>>>>> Transient : true
>>>>>> Many : true
>>>>>> EOpposite : productRegistry
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Anthony
>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84235 is a reply to message #84220] Sun, 20 May 2007 04:53 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
I would copy these methods also, each of them is only a few lines.
Btw, this is just a workaround to get you going. If you enter a bugzilla for this then I can look at
it more thoroughly for the next build.

gr. Martin

Anthony wrote:
> Martin,
>
> As isContained(),hasEContainerProp(),checkColumnExists() are private
> method,HbDataStore's addContainerMapping() cannot be overrided.
>
> Is there another way to work around?
>
> Thanks.
>
> Anthony
>
>> Anthony,
>> This part of the code did not change that much since 0.7.5. For 0.7.5
>> you can override the HbDataStore.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>
>>> So I need to upgrade to 0.8.
>>>
>>>
>>> Tomorrow I will try it.
>>>
>>>
>>> Thanks.
>>>
>>>
>>> Anthony
>>>
>>>
>>>> Okay, one thing I find strange is that there is an econtainer field
>>>> in the product but it does not do addcontainermapping for this type.
>>>>
>>>> Can you try the following:
>>>> override the HbSessionDataStore and the addContainerMapping method
>>>> with the method below. The only change I made is that in this method
>>>> if a isContainer ereference is found no econtainer mapping is added.
>>>> Also you need to replace the code NAME_IS_PRODUCT with something
>>>> meaningfull. It is not a nice solution but it can help to identify
>>>> how to solve this.
>>>>
>>>> /**
>>>> * Adds a econtainer mapping to the class mapping, is only
>>>> called for eclasses which do not have * am explicit feature
>>>> which points to the container */
>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>
>>>> // always first check if the super class should have a
>>>> container mapping if (pc.getSuperclass() != null) {
>>>> addContainerMapping(pc.getSuperclass());
>>>> }
>>>>
>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>> if (hasEContainerProp(pc)) return;
>>>>
>>>> log.debug("Adding container mapping for " +
>>>> getMappedName(pc)); // check if there are not
>>>> alreadyecontai ner features for the eclass
>>>>
>>>> final EClass eclass;
>>>> if (pc.getEntityName() != null) {
>>>> eclass =
>>>> getPersistenceOptions
> ().getEClassNameStrateg
>>>> y
>>> (
>>>> ).toEClass(pc.getEntityName(),
>>>> getEPackages());
>>>> } else {
>>>> eclass =
>>>> EModelResolver.instance().getEClass(pc.getMappedClass
>>> ())
>>>> ;
>>>> }
>>>>
>>>> // DCB: Provide a way to avoid container mappings for a
>>>> particular // class. You'd do this if, for example,
>>>> // you never load the contained objects except through the
>>>> containers... // or, you don't fit the use case
>>>> // for which this was put together (i.e., the generated
>>>> model editing // code tries to eagerly resolve the
>>>> // container)
>>>> if (eclass == null
>>>> || eclass.getEAnnotation
>>> ("http://facet.elver.org/Sk
>>>> || ipContainerMappings") != null) {
>>>> return; // featuremap
>>>> }
>>>>
>>>> if (!NAME_IS_PRODUCT) {
>>>> for (EReference eref : eclass.getEAllReferences()) {
>>>> if (eref.isContainer()) {
>>>> log
>>>> .debug("There are container
>>>> ereferences
>>>> present, assuming that no separate
>>>> econta iner columns
>>>> are required.");
>>>> return;
>>>> }
>>>> }
>>>> }
>>>>
>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>> properties to " + pc.getClassName());
>>>>
>>>> final Property eContainer = new Property();
>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>> Object>()); eContainer.setNodeName(eContainer.getName());
>>>> eContainer.setPropertyAccessorName
>>> (EContainerAccessor.class.g
>>>> etName());
>>>>
>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>
>>>> final Column eccColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>>>
>>>> final Column ecColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>>>
>>>> eContainer.setValue(sv);
>>>> pc.addProperty(eContainer);
>>>>
>>>> final Property ecFID = new Property();
>>>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>>>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>>>> ecFID.setNodeName(ecFID.getName());
>>>> ecFID.setPropertyAccessorName
>>> (EContainerFeatureIDAccessor.cla
>>>> ss.getName()); final SimpleValue svfid = new
>>>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>>>
>>>> final Column ecfColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>> ecfColumn));
>>>>
>>>> ecFID.setValue(svfid);
>>>> pc.addProperty(ecFID);
>>>> }
>>>>
>>>>
>>>> Anthony wrote:
>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>
>>>>>> The cause is that transient is true for ProductRegistry.products.
>>>>>> I think that this has to do with a performance issue in your case
>>>>>> (the products collection is very large). Is that correct?
>>>>> YES.
>>>>>
>>>>>
>>>>>> Otherwise setting
>>>>>> transient to false will ensure that the container is set in the
>>>>>> db. Even now if the products are read from the db through the
>>>>>> ProductRegistry.products then when loading the products their
>>>>>> econtainer should normally be set correctly. Did you try that? Or
>>>>>> do you read products independently?
>>>>> I load ProductRegistry first,
>>>>> and then I load product in another resource as I need to do
>>>>> pagination,
>>>>>
>>>>>
>>>>>> In the last case you can get the
>>>>>> container from the product.ProductRegistry.
>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>
>>>>>
>>>>>
>>>>>> So in short is it an issue for your app that the econtainer is not
>>>>>> stored separately in the econtainer fields in the db?
>>>>> In DB the econtainer field is always null.
>>>>>
>>>>> ?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>>> Product.productRegistry
>>>>>>> Martin,
>>>>>>>
>>>>>>> Product.ProductRegistry :
>>>>>>>
>>>>>>> container:true
>>>>>>> containment: false
>>>>>>> resolve proxies: true
>>>>>>> required: true
>>>>>>> lower bound: 1
>>>>>>> upper bound: 1
>>>>>>> Transient : false
>>>>>>> Many : false
>>>>>>> EOpposite : products
>>>>>>>
>>>>>>> ProductRegistry.products:
>>>>>>>
>>>>>>> container:false
>>>>>>> containment: true
>>>>>>> resolve proxies: true
>>>>>>> required: false
>>>>>>> lower bound: 0
>>>>>>> upper bound: -1
>>>>>>> Transient : true
>>>>>>> Many : true
>>>>>>> EOpposite : productRegistry
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84250 is a reply to message #84235] Sun, 20 May 2007 05:01 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

OK. (Sorry for the stupid question.I have done that before.)
I will enter a bugzilla later.

Anthony


> Anthony,
> I would copy these methods also, each of them is only a few lines.
> Btw, this is just a workaround to get you going. If you enter a
> bugzilla for this then I can look at it more thoroughly for the next
> build.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> As isContained(),hasEContainerProp(),checkColumnExists() are
>> private
>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>
>> Is there another way to work around?
>>
>> Thanks.
>>
>> Anthony
>>
>>> Anthony,
>>> This part of the code did not change that much since 0.7.5. For
>>> 0.7.5 you can override the HbDataStore.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>
>>>> So I need to upgrade to 0.8.
>>>>
>>>>
>>>> Tomorrow I will try it.
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>> field in the product but it does not do addcontainermapping for
>>>>> this type.
>>>>>
>>>>> Can you try the following:
>>>>> override the HbSessionDataStore and the addContainerMapping method
>>>>> with the method below. The only change I made is that in this
>>>>> method if a isContainer ereference is found no econtainer mapping
>>>>> is added. Also you need to replace the code NAME_IS_PRODUCT with
>>>>> something meaningfull. It is not a nice solution but it can help
>>>>> to identify how to solve this.
>>>>>
>>>>> /**
>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>> called for eclasses which do not have * am explicit feature
>>>>> which points to the container */
>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>
>>>>> // always first check if the super class should have a
>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>> addContainerMapping(pc.getSuperclass());
>>>>> }
>>>>>
>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>> if (hasEContainerProp(pc)) return;
>>>>>
>>>>> log.debug("Adding container mapping for " +
>>>>> getMappedName(pc)); // check if there are not
>>>>> alreadyecontai ner features for the eclass
>>>>>
>>>>> final EClass eclass;
>>>>> if (pc.getEntityName() != null) {
>>>>> eclass =
>>>>> getPersistenceOptions
>> ().getEClassNameStrateg
>>>>> y
>>>> (
>>>>> ).toEClass(pc.getEntityName(),
>>>>> getEPackages());
>>>>> } else {
>>>>> eclass =
>>>>> EModelResolver.instance().getEClass
(pc.getMappedClas
>>>>> s
>>>> ())
>>>>> ;
>>>>> }
>>>>>
>>>>> // DCB: Provide a way to avoid container mappings for a
>>>>> particular // class. You'd do this if, for example,
>>>>> // you never load the contained objects except through
>>>>> the containers... // or, you don't fit the use case
>>>>> // for which this was put together (i.e., the generated
>>>>> model editing // code tries to eagerly resolve the
>>>>> // container)
>>>>> if (eclass == null
>>>>> || eclass.getEAnnotation
>>>> ("http://facet.elver.org/Sk
>>>>> || ipContainerMappings") != null) {
>>>>> return; // featuremap
>>>>> }
>>>>>
>>>>> if (!NAME_IS_PRODUCT) {
>>>>> for (EReference eref : eclass.getEAllReferences())
>>>>> {
>>>>> if (eref.isContainer()) {
>>>>> log
>>>>> .debug("There are container
>>>>> ereferences
>>>>> present, assuming that no separate
>>>>> econta iner columns
>>>>> are required.");
>>>>> return;
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>> properties to " + pc.getClassName());
>>>>>
>>>>> final Property eContainer = new Property();
>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>> Object>());
>>>>> eContainer.setNodeName(eContainer.getName());
>>>>> eContainer.setPropertyAccessorName
>>>> (EContainerAccessor.class.g
>>>>> etName());
>>>>>
>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>
>>>>> final Column eccColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>> eccColumn));
>>>>>
>>>>> final Column ecColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>> ecColumn));
>>>>>
>>>>> eContainer.setValue(sv);
>>>>> pc.addProperty(eContainer);
>>>>>
>>>>> final Property ecFID = new Property();
>>>>> ecFID.setName
(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>> ecFID.setPropertyAccessorName
>>>> (EContainerFeatureIDAccessor.cla
>>>>> ss.getName()); final SimpleValue svfid = new
>>>>> SimpleValue(pc.getTable());
>>>>> svfid.setTypeName("integer");
>>>>>
>>>>> final Column ecfColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>> ecfColumn));
>>>>>
>>>>> ecFID.setValue(svfid);
>>>>> pc.addProperty(ecFID);
>>>>> }
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>
>>>>>>> The cause is that transient is true for
>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>> performance issue in your case (the products collection is very
>>>>>>> large). Is that correct?
>>>>>> YES.
>>>>>>
>>>>>>
>>>>>>> Otherwise setting
>>>>>>> transient to false will ensure that the container is set in the
>>>>>>> db. Even now if the products are read from the db through the
>>>>>>> ProductRegistry.products then when loading the products their
>>>>>>> econtainer should normally be set correctly. Did you try that?
>>>>>>> Or do you read products independently?
>>>>>> I load ProductRegistry first,
>>>>>> and then I load product in another resource as I need to do
>>>>>> pagination,
>>>>>>
>>>>>>
>>>>>>> In the last case you can get the
>>>>>>> container from the product.ProductRegistry.
>>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>>
>>>>>>
>>>>>>
>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>> In DB the econtainer field is always null.
>>>>>>
>>>>>> ?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>> @build.eclipse.org:
>>>>>>>>
>>>>>>>>> Product.productRegistry
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> Product.ProductRegistry :
>>>>>>>>
>>>>>>>> container:true
>>>>>>>> containment: false
>>>>>>>> resolve proxies: true
>>>>>>>> required: true
>>>>>>>> lower bound: 1
>>>>>>>> upper bound: 1
>>>>>>>> Transient : false
>>>>>>>> Many : false
>>>>>>>> EOpposite : products
>>>>>>>>
>>>>>>>> ProductRegistry.products:
>>>>>>>>
>>>>>>>> container:false
>>>>>>>> containment: true
>>>>>>>> resolve proxies: true
>>>>>>>> required: false
>>>>>>>> lower bound: 0
>>>>>>>> upper bound: -1
>>>>>>>> Transient : true
>>>>>>>> Many : true
>>>>>>>> EOpposite : productRegistry
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84265 is a reply to message #84250] Sun, 20 May 2007 05:13 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
No stupid question at all (I forgot myself that these were private when copy-pasting the code in the
previous post), over time I noticed that I should make more and more methods in HbDataStore
protected to facilitate customization, probably these methods are also candidates.

gr. Martin

Anthony wrote:
> Martin,
>
> OK. (Sorry for the stupid question.I have done that before.)
> I will enter a bugzilla later.
>
> Anthony
>
>
>> Anthony,
>> I would copy these methods also, each of them is only a few lines.
>> Btw, this is just a workaround to get you going. If you enter a
>> bugzilla for this then I can look at it more thoroughly for the next
>> build.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>> private
>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>
>>> Is there another way to work around?
>>>
>>> Thanks.
>>>
>>> Anthony
>>>
>>>> Anthony,
>>>> This part of the code did not change that much since 0.7.5. For
>>>> 0.7.5 you can override the HbDataStore.
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>
>>>>> So I need to upgrade to 0.8.
>>>>>
>>>>>
>>>>> Tomorrow I will try it.
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>> field in the product but it does not do addcontainermapping for
>>>>>> this type.
>>>>>>
>>>>>> Can you try the following:
>>>>>> override the HbSessionDataStore and the addContainerMapping method
>>>>>> with the method below. The only change I made is that in this
>>>>>> method if a isContainer ereference is found no econtainer mapping
>>>>>> is added. Also you need to replace the code NAME_IS_PRODUCT with
>>>>>> something meaningfull. It is not a nice solution but it can help
>>>>>> to identify how to solve this.
>>>>>>
>>>>>> /**
>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>> called for eclasses which do not have * am explicit feature
>>>>>> which points to the container */
>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>
>>>>>> // always first check if the super class should have a
>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>> }
>>>>>>
>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>
>>>>>> log.debug("Adding container mapping for " +
>>>>>> getMappedName(pc)); // check if there are not
>>>>>> alreadyecontai ner features for the eclass
>>>>>>
>>>>>> final EClass eclass;
>>>>>> if (pc.getEntityName() != null) {
>>>>>> eclass =
>>>>>> getPersistenceOptions
>>> ().getEClassNameStrateg
>>>>>> y
>>>>> (
>>>>>> ).toEClass(pc.getEntityName(),
>>>>>> getEPackages());
>>>>>> } else {
>>>>>> eclass =
>>>>>> EModelResolver.instance().getEClass
> (pc.getMappedClas
>>>>>> s
>>>>> ())
>>>>>> ;
>>>>>> }
>>>>>>
>>>>>> // DCB: Provide a way to avoid container mappings for a
>>>>>> particular // class. You'd do this if, for example,
>>>>>> // you never load the contained objects except through
>>>>>> the containers... // or, you don't fit the use case
>>>>>> // for which this was put together (i.e., the generated
>>>>>> model editing // code tries to eagerly resolve the
>>>>>> // container)
>>>>>> if (eclass == null
>>>>>> || eclass.getEAnnotation
>>>>> ("http://facet.elver.org/Sk
>>>>>> || ipContainerMappings") != null) {
>>>>>> return; // featuremap
>>>>>> }
>>>>>>
>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>> for (EReference eref : eclass.getEAllReferences())
>>>>>> {
>>>>>> if (eref.isContainer()) {
>>>>>> log
>>>>>> .debug("There are container
>>>>>> ereferences
>>>>>> present, assuming that no separate
>>>>>> econta iner columns
>>>>>> are required.");
>>>>>> return;
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>> properties to " + pc.getClassName());
>>>>>>
>>>>>> final Property eContainer = new Property();
>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>> Object>());
>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>> eContainer.setPropertyAccessorName
>>>>> (EContainerAccessor.class.g
>>>>>> etName());
>>>>>>
>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>
>>>>>> final Column eccColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>> eccColumn));
>>>>>>
>>>>>> final Column ecColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>> ecColumn));
>>>>>>
>>>>>> eContainer.setValue(sv);
>>>>>> pc.addProperty(eContainer);
>>>>>>
>>>>>> final Property ecFID = new Property();
>>>>>> ecFID.setName
> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>> ecFID.setPropertyAccessorName
>>>>> (EContainerFeatureIDAccessor.cla
>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>> SimpleValue(pc.getTable());
>>>>>> svfid.setTypeName("integer");
>>>>>>
>>>>>> final Column ecfColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>> ecfColumn));
>>>>>>
>>>>>> ecFID.setValue(svfid);
>>>>>> pc.addProperty(ecFID);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>
>>>>>>>> The cause is that transient is true for
>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>> performance issue in your case (the products collection is very
>>>>>>>> large). Is that correct?
>>>>>>> YES.
>>>>>>>
>>>>>>>
>>>>>>>> Otherwise setting
>>>>>>>> transient to false will ensure that the container is set in the
>>>>>>>> db. Even now if the products are read from the db through the
>>>>>>>> ProductRegistry.products then when loading the products their
>>>>>>>> econtainer should normally be set correctly. Did you try that?
>>>>>>>> Or do you read products independently?
>>>>>>> I load ProductRegistry first,
>>>>>>> and then I load product in another resource as I need to do
>>>>>>> pagination,
>>>>>>>
>>>>>>>
>>>>>>>> In the last case you can get the
>>>>>>>> container from the product.ProductRegistry.
>>>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>> In DB the econtainer field is always null.
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>> @build.eclipse.org:
>>>>>>>>>
>>>>>>>>>> Product.productRegistry
>>>>>>>>> Martin,
>>>>>>>>>
>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>
>>>>>>>>> container:true
>>>>>>>>> containment: false
>>>>>>>>> resolve proxies: true
>>>>>>>>> required: true
>>>>>>>>> lower bound: 1
>>>>>>>>> upper bound: 1
>>>>>>>>> Transient : false
>>>>>>>>> Many : false
>>>>>>>>> EOpposite : products
>>>>>>>>>
>>>>>>>>> ProductRegistry.products:
>>>>>>>>>
>>>>>>>>> container:false
>>>>>>>>> containment: true
>>>>>>>>> resolve proxies: true
>>>>>>>>> required: false
>>>>>>>>> lower bound: 0
>>>>>>>>> upper bound: -1
>>>>>>>>> Transient : true
>>>>>>>>> Many : true
>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84280 is a reply to message #84265] Sun, 20 May 2007 05:44 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

agree,'protected' would be better.

isContained() method can be copy, but it need a private member
'referers' and no method(protected or public) could return this member.


Any idea?


( rt.isContainer could be replace with rt.isContainer())



Anthony

> Hi Anthony,
> No stupid question at all (I forgot myself that these were private
> when copy-pasting the code in the previous post), over time I noticed
> that I should make more and more methods in HbDataStore protected to
> facilitate customization, probably these methods are also candidates.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> OK. (Sorry for the stupid question.I have done that before.)
>> I will enter a bugzilla later.
>>
>> Anthony
>>
>>
>>> Anthony,
>>> I would copy these methods also, each of them is only a few lines.
>>> Btw, this is just a workaround to get you going. If you enter a
>>> bugzilla for this then I can look at it more thoroughly for the next
>>> build.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>> private
>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>
>>>> Is there another way to work around?
>>>>
>>>> Thanks.
>>>>
>>>> Anthony
>>>>
>>>>> Anthony,
>>>>> This part of the code did not change that much since 0.7.5. For
>>>>> 0.7.5 you can override the HbDataStore.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>
>>>>>> So I need to upgrade to 0.8.
>>>>>>
>>>>>>
>>>>>> Tomorrow I will try it.
>>>>>>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>> field in the product but it does not do addcontainermapping for
>>>>>>> this type.
>>>>>>>
>>>>>>> Can you try the following:
>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>> method with the method below. The only change I made is that in
>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>> mapping is added. Also you need to replace the code
>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>
>>>>>>> /**
>>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>>> called for eclasses which do not have * am explicit
>>>>>>> feature which points to the container */
>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>
>>>>>>> // always first check if the super class should have a
>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>> }
>>>>>>>
>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>
>>>>>>> log.debug("Adding container mapping for " +
>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>
>>>>>>> final EClass eclass;
>>>>>>> if (pc.getEntityName() != null) {
>>>>>>> eclass =
>>>>>>> getPersistenceOptions
>>>> ().getEClassNameStrateg
>>>>>>> y
>>>>>> (
>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>> getEPackages());
>>>>>>> } else {
>>>>>>> eclass =
>>>>>>> EModelResolver.instance().getEClass
>> (pc.getMappedClas
>>>>>>> s
>>>>>> ())
>>>>>>> ;
>>>>>>> }
>>>>>>>
>>>>>>> // DCB: Provide a way to avoid container mappings for
>>>>>>> a particular // class. You'd do this if, for example,
>>>>>>> // you never load the contained objects except through
>>>>>>> the containers... // or, you don't fit the use case
>>>>>>> // for which this was put together (i.e., the
>>>>>>> generated model editing // code tries to eagerly
>>>>>>> resolve the // container)
>>>>>>> if (eclass == null
>>>>>>> || eclass.getEAnnotation
>>>>>> ("http://facet.elver.org/Sk
>>>>>>> || ipContainerMappings") != null) {
>>>>>>> return; // featuremap
>>>>>>> }
>>>>>>>
>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>> for (EReference eref :
>>>>>>> eclass.getEAllReferences())
>>>>>>> {
>>>>>>> if (eref.isContainer()) {
>>>>>>> log
>>>>>>> .debug("There are container
>>>>>>> ereferences
>>>>>>> present, assuming that no separate
>>>>>>> econta iner columns
>>>>>>> are required.");
>>>>>>> return;
>>>>>>> }
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>> properties to " + pc.getClassName());
>>>>>>>
>>>>>>> final Property eContainer = new Property();
>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>> Object>());
>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>> eContainer.setPropertyAccessorName
>>>>>> (EContainerAccessor.class.g
>>>>>>> etName());
>>>>>>>
>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>
>>>>>>> final Column eccColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> eccColumn));
>>>>>>>
>>>>>>> final Column ecColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> ecColumn));
>>>>>>>
>>>>>>> eContainer.setValue(sv);
>>>>>>> pc.addProperty(eContainer);
>>>>>>>
>>>>>>> final Property ecFID = new Property();
>>>>>>> ecFID.setName
>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>> ecFID.setPropertyAccessorName
>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>> SimpleValue(pc.getTable());
>>>>>>> svfid.setTypeName("integer");
>>>>>>>
>>>>>>> final Column ecfColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> ecfColumn));
>>>>>>>
>>>>>>> ecFID.setValue(svfid);
>>>>>>> pc.addProperty(ecFID);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>
>>>>>>>>> The cause is that transient is true for
>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>> very large). Is that correct?
>>>>>>>> YES.
>>>>>>>>
>>>>>>>>
>>>>>>>>> Otherwise setting
>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>> the db. Even now if the products are read from the db through
>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>> their econtainer should normally be set correctly. Did you try
>>>>>>>>> that? Or do you read products independently?
>>>>>>>> I load ProductRegistry first,
>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>> pagination,
>>>>>>>>
>>>>>>>>
>>>>>>>>> In the last case you can get the
>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>> Right?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>
>>>>>>>> ?
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>
>>>>>>>>>>> Product.productRegistry
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>
>>>>>>>>>> container:true
>>>>>>>>>> containment: false
>>>>>>>>>> resolve proxies: true
>>>>>>>>>> required: true
>>>>>>>>>> lower bound: 1
>>>>>>>>>> upper bound: 1
>>>>>>>>>> Transient : false
>>>>>>>>>> Many : false
>>>>>>>>>> EOpposite : products
>>>>>>>>>>
>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>
>>>>>>>>>> container:false
>>>>>>>>>> containment: true
>>>>>>>>>> resolve proxies: true
>>>>>>>>>> required: false
>>>>>>>>>> lower bound: 0
>>>>>>>>>> upper bound: -1
>>>>>>>>>> Transient : true
>>>>>>>>>> Many : true
>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84295 is a reply to message #84280] Sun, 20 May 2007 06:13 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
The latest release of Teneo should have a getReferers method.

gr. Martin

Anthony wrote:
> Martin,
>
> agree,'protected' would be better.
>
> isContained() method can be copy, but it need a private member
> 'referers' and no method(protected or public) could return this member.
>
>
> Any idea?
>
>
> ( rt.isContainer could be replace with rt.isContainer())
>
>
>
> Anthony
>
>> Hi Anthony,
>> No stupid question at all (I forgot myself that these were private
>> when copy-pasting the code in the previous post), over time I noticed
>> that I should make more and more methods in HbDataStore protected to
>> facilitate customization, probably these methods are also candidates.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> OK. (Sorry for the stupid question.I have done that before.)
>>> I will enter a bugzilla later.
>>>
>>> Anthony
>>>
>>>
>>>> Anthony,
>>>> I would copy these methods also, each of them is only a few lines.
>>>> Btw, this is just a workaround to get you going. If you enter a
>>>> bugzilla for this then I can look at it more thoroughly for the next
>>>> build.
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>> private
>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>
>>>>> Is there another way to work around?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Anthony
>>>>>
>>>>>> Anthony,
>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin,
>>>>>>>
>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>
>>>>>>> So I need to upgrade to 0.8.
>>>>>>>
>>>>>>>
>>>>>>> Tomorrow I will try it.
>>>>>>>
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>> field in the product but it does not do addcontainermapping for
>>>>>>>> this type.
>>>>>>>>
>>>>>>>> Can you try the following:
>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>> method with the method below. The only change I made is that in
>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>
>>>>>>>> /**
>>>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>> feature which points to the container */
>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>
>>>>>>>> // always first check if the super class should have a
>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>
>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>
>>>>>>>> final EClass eclass;
>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>> eclass =
>>>>>>>> getPersistenceOptions
>>>>> ().getEClassNameStrateg
>>>>>>>> y
>>>>>>> (
>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>> getEPackages());
>>>>>>>> } else {
>>>>>>>> eclass =
>>>>>>>> EModelResolver.instance().getEClass
>>> (pc.getMappedClas
>>>>>>>> s
>>>>>>> ())
>>>>>>>> ;
>>>>>>>> }
>>>>>>>>
>>>>>>>> // DCB: Provide a way to avoid container mappings for
>>>>>>>> a particular // class. You'd do this if, for example,
>>>>>>>> // you never load the contained objects except through
>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>> // for which this was put together (i.e., the
>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>> resolve the // container)
>>>>>>>> if (eclass == null
>>>>>>>> || eclass.getEAnnotation
>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>> return; // featuremap
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>> for (EReference eref :
>>>>>>>> eclass.getEAllReferences())
>>>>>>>> {
>>>>>>>> if (eref.isContainer()) {
>>>>>>>> log
>>>>>>>> .debug("There are container
>>>>>>>> ereferences
>>>>>>>> present, assuming that no separate
>>>>>>>> econta iner columns
>>>>>>>> are required.");
>>>>>>>> return;
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>
>>>>>>>> final Property eContainer = new Property();
>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>> Object>());
>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>> (EContainerAccessor.class.g
>>>>>>>> etName());
>>>>>>>>
>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>
>>>>>>>> final Column eccColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> eccColumn));
>>>>>>>>
>>>>>>>> final Column ecColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> ecColumn));
>>>>>>>>
>>>>>>>> eContainer.setValue(sv);
>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>
>>>>>>>> final Property ecFID = new Property();
>>>>>>>> ecFID.setName
>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>
>>>>>>>> final Column ecfColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> ecfColumn));
>>>>>>>>
>>>>>>>> ecFID.setValue(svfid);
>>>>>>>> pc.addProperty(ecFID);
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>
>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>> very large). Is that correct?
>>>>>>>>> YES.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Otherwise setting
>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>> the db. Even now if the products are read from the db through
>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>> their econtainer should normally be set correctly. Did you try
>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>> I load ProductRegistry first,
>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>> pagination,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> In the last case you can get the
>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>> Right?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>
>>>>>>>>> ?
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> gr. Martin
>>>>>>>>>>
>>>>>>>>>> Anthony wrote:
>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>
>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>> Martin,
>>>>>>>>>>>
>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>
>>>>>>>>>>> container:true
>>>>>>>>>>> containment: false
>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>> required: true
>>>>>>>>>>> lower bound: 1
>>>>>>>>>>> upper bound: 1
>>>>>>>>>>> Transient : false
>>>>>>>>>>> Many : false
>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>
>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>
>>>>>>>>>>> container:false
>>>>>>>>>>> containment: true
>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>> required: false
>>>>>>>>>>> lower bound: 0
>>>>>>>>>>> upper bound: -1
>>>>>>>>>>> Transient : true
>>>>>>>>>>> Many : true
>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>>
>>>>>>>>>>> Anthony
>>>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84310 is a reply to message #84295] Sun, 20 May 2007 07:59 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

After I use customed HbSessionDataStore , I got en exception said
org.hibernate.MappingException: Unknown entity: SND(my top model class)

BTW, where to input bugzilla and when will next release be ready?


Anthony


> Anthony,
> The latest release of Teneo should have a getReferers method.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> agree,'protected' would be better.
>>
>> isContained() method can be copy, but it need a private member
>> 'referers' and no method(protected or public) could return this
member.
>>
>>
>> Any idea?
>>
>>
>> ( rt.isContainer could be replace with rt.isContainer())
>>
>>
>>
>> Anthony
>>
>>> Hi Anthony,
>>> No stupid question at all (I forgot myself that these were private
>>> when copy-pasting the code in the previous post), over time I
noticed
>>> that I should make more and more methods in HbDataStore protected to
>>> facilitate customization, probably these methods are also
candidates.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>> I will enter a bugzilla later.
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> Anthony,
>>>>> I would copy these methods also, each of them is only a few lines.
>>>>> Btw, this is just a workaround to get you going. If you enter a
>>>>> bugzilla for this then I can look at it more thoroughly for the
next
>>>>> build.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>> private
>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>
>>>>>> Is there another way to work around?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>> Anthony,
>>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>>
>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>
>>>>>>>>
>>>>>>>> Tomorrow I will try it.
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>>> field in the product but it does not do addcontainermapping
for
>>>>>>>>> this type.
>>>>>>>>>
>>>>>>>>> Can you try the following:
>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>> method with the method below. The only change I made is that
in
>>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>>
>>>>>>>>> /**
>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
only
>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>> feature which points to the container */
>>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>>
>>>>>>>>> // always first check if the super class should have
a
>>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>
>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>
>>>>>>>>> final EClass eclass;
>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>> eclass =
>>>>>>>>> getPersistenceOptions
>>>>>> ().getEClassNameStrateg
>>>>>>>>> y
>>>>>>>> (
>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>> getEPackages());
>>>>>>>>> } else {
>>>>>>>>> eclass =
>>>>>>>>> EModelResolver.instance().getEClass
>>>> (pc.getMappedClas
>>>>>>>>> s
>>>>>>>> ())
>>>>>>>>> ;
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> // DCB: Provide a way to avoid container mappings
for
>>>>>>>>> a particular // class. You'd do this if, for
example,
>>>>>>>>> // you never load the contained objects except
through
>>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>>> // for which this was put together (i.e., the
>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>> resolve the // container)
>>>>>>>>> if (eclass == null
>>>>>>>>> || eclass.getEAnnotation
>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>> return; // featuremap
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>> for (EReference eref :
>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>> {
>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>> log
>>>>>>>>> .debug("There are container
>>>>>>>>> ereferences
>>>>>>>>> present, assuming that no
separate
>>>>>>>>> econta iner columns
>>>>>>>>> are required.");
>>>>>>>>> return;
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>>
>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>> Object>());
>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>> etName());
>>>>>>>>>
>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
());
>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>
>>>>>>>>> final Column eccColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> eccColumn));
>>>>>>>>>
>>>>>>>>> final Column ecColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> ecColumn));
>>>>>>>>>
>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>
>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>> ecFID.setName
>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>
>>>>>>>>> final Column ecfColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> ecfColumn));
>>>>>>>>>
>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>
>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>>> very large). Is that correct?
>>>>>>>>>> YES.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Otherwise setting
>>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>>> the db. Even now if the products are read from the db
through
>>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>>> their econtainer should normally be set correctly. Did you
try
>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>> pagination,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>>> Right?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> So in short is it an issue for your app that the econtainer
is
>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>
>>>>>>>>>> ?
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> gr. Martin
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>> Martin,
>>>>>>>>>>>>
>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>
>>>>>>>>>>>> container:true
>>>>>>>>>>>> containment: false
>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>> required: true
>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>> Transient : false
>>>>>>>>>>>> Many : false
>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>
>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>
>>>>>>>>>>>> container:false
>>>>>>>>>>>> containment: true
>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>> required: false
>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>> Transient : true
>>>>>>>>>>>> Many : true
>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84327 is a reply to message #84310] Sun, 20 May 2007 08:05 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Can you post the complete stacktrace?

Which version of Teneo are you using?

Bugzilla can be entered here:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT

I had hoped to do a next release this week but it will be a few weeks later.

gr. Martin

Anthony wrote:
> Martin,
>
> After I use customed HbSessionDataStore , I got en exception said
> org.hibernate.MappingException: Unknown entity: SND(my top model class)
>
> BTW, where to input bugzilla and when will next release be ready?
>
>
> Anthony
>
>
>> Anthony,
>> The latest release of Teneo should have a getReferers method.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> agree,'protected' would be better.
>>>
>>> isContained() method can be copy, but it need a private member
>>> 'referers' and no method(protected or public) could return this
> member.
>>>
>>> Any idea?
>>>
>>>
>>> ( rt.isContainer could be replace with rt.isContainer())
>>>
>>>
>>>
>>> Anthony
>>>
>>>> Hi Anthony,
>>>> No stupid question at all (I forgot myself that these were private
>>>> when copy-pasting the code in the previous post), over time I
> noticed
>>>> that I should make more and more methods in HbDataStore protected to
>>>> facilitate customization, probably these methods are also
> candidates.
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>> I will enter a bugzilla later.
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>> I would copy these methods also, each of them is only a few lines.
>>>>>> Btw, this is just a workaround to get you going. If you enter a
>>>>>> bugzilla for this then I can look at it more thoroughly for the
> next
>>>>>> build.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin,
>>>>>>>
>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>> private
>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>
>>>>>>> Is there another way to work around?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>> Anthony,
>>>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin,
>>>>>>>>>
>>>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>>>
>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>>>> field in the product but it does not do addcontainermapping
> for
>>>>>>>>>> this type.
>>>>>>>>>>
>>>>>>>>>> Can you try the following:
>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>> method with the method below. The only change I made is that
> in
>>>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>>>
>>>>>>>>>> /**
>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
> only
>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>> feature which points to the container */
>>>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>>>
>>>>>>>>>> // always first check if the super class should have
> a
>>>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>
>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>
>>>>>>>>>> final EClass eclass;
>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>> eclass =
>>>>>>>>>> getPersistenceOptions
>>>>>>> ().getEClassNameStrateg
>>>>>>>>>> y
>>>>>>>>> (
>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>> getEPackages());
>>>>>>>>>> } else {
>>>>>>>>>> eclass =
>>>>>>>>>> EModelResolver.instance().getEClass
>>>>> (pc.getMappedClas
>>>>>>>>>> s
>>>>>>>>> ())
>>>>>>>>>> ;
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> // DCB: Provide a way to avoid container mappings
> for
>>>>>>>>>> a particular // class. You'd do this if, for
> example,
>>>>>>>>>> // you never load the contained objects except
> through
>>>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>>>> // for which this was put together (i.e., the
>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>> resolve the // container)
>>>>>>>>>> if (eclass == null
>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>> return; // featuremap
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>> for (EReference eref :
>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>> {
>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>> log
>>>>>>>>>> .debug("There are container
>>>>>>>>>> ereferences
>>>>>>>>>> present, assuming that no
> separate
>>>>>>>>>> econta iner columns
>>>>>>>>>> are required.");
>>>>>>>>>> return;
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>>>
>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>> Object>());
>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>> etName());
>>>>>>>>>>
>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
> ());
>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>>
>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> eccColumn));
>>>>>>>>>>
>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> ecColumn));
>>>>>>>>>>
>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>
>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>> ecFID.setName
>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>
>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> ecfColumn));
>>>>>>>>>>
>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony wrote:
>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>
>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>>>> very large). Is that correct?
>>>>>>>>>>> YES.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>>>> the db. Even now if the products are read from the db
> through
>>>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>>>> their econtainer should normally be set correctly. Did you
> try
>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>> pagination,
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>>>> Right?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> So in short is it an issue for your app that the econtainer
> is
>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>
>>>>>>>>>>> ?
>>>>>>>>>>>
>>>>>>>>>>> Anthony
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>
>>>>>>>>>>>>> container:true
>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>> required: true
>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>
>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>
>>>>>>>>>>>>> container:false
>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>> required: false
>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #84345 is a reply to message #84327] Sun, 20 May 2007 10:36 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Now I am using 0.8.

Just a few minutes ago , I try it again(after clear schema and mapping
file) and it's OK .

It seems that the previous exception was caused by other reason.

I will input a bugzilla.

Thanks.

Anthony




> Anthony,
> Can you post the complete stacktrace?
>
> Which version of Teneo are you using?
>
> Bugzilla can be entered here:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT
>
> I had hoped to do a next release this week but it will be a few weeks
> later.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> After I use customed HbSessionDataStore , I got en exception said
>> org.hibernate.MappingException: Unknown entity: SND(my top model
>> class)
>>
>> BTW, where to input bugzilla and when will next release be ready?
>>
>>
>> Anthony
>>
>>
>>> Anthony,
>>> The latest release of Teneo should have a getReferers method.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> agree,'protected' would be better.
>>>>
>>>> isContained() method can be copy, but it need a private member
>>>> 'referers' and no method(protected or public) could return this
>> member.
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> ( rt.isContainer could be replace with rt.isContainer())
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>> Hi Anthony,
>>>>> No stupid question at all (I forgot myself that these were private
>>>>> when copy-pasting the code in the previous post), over time I
>> noticed
>>>>> that I should make more and more methods in HbDataStore protected
>>>>> to facilitate customization, probably these methods are also
>> candidates.
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>>> I will enter a bugzilla later.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>> I would copy these methods also, each of them is only a few
>>>>>>> lines. Btw, this is just a workaround to get you going. If you
>>>>>>> enter a bugzilla for this then I can look at it more thoroughly
>>>>>>> for the
>> next
>>>>>>> build.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>>> private
>>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>>
>>>>>>>> Is there another way to work around?
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>> This part of the code did not change that much since 0.7.5.
>>>>>>>>> For 0.7.5 you can override the HbDataStore.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> At this time I am using Teneo 0.7.5, it has only
>>>>>>>>>> HbDataStore.
>>>>>>>>>>
>>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Okay, one thing I find strange is that there is an
>>>>>>>>>>> econtainer field in the product but it does not do
>>>>>>>>>>> addcontainermapping
>> for
>>>>>>>>>>> this type.
>>>>>>>>>>>
>>>>>>>>>>> Can you try the following:
>>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>>> method with the method below. The only change I made is that
>> in
>>>>>>>>>>> this method if a isContainer ereference is found no
>>>>>>>>>>> econtainer mapping is added. Also you need to replace the
>>>>>>>>>>> code NAME_IS_PRODUCT with something meaningfull. It is not a
>>>>>>>>>>> nice solution but it can help to identify how to solve this.
>>>>>>>>>>>
>>>>>>>>>>> /**
>>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
>> only
>>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>>> feature which points to the container */
>>>>>>>>>>> protected void addContainerMapping(PersistentClass pc)
>>>>>>>>>>> {
>>>>>>>>>>>
>>>>>>>>>>> // always first check if the super class should
>>>>>>>>>>> have
>> a
>>>>>>>>>>> container mapping if (pc.getSuperclass() != null)
>>>>>>>>>>> {
>>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>>
>>>>>>>>>>> final EClass eclass;
>>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>>> eclass =
>>>>>>>>>>> getPersistenceOptions
>>>>>>>> ().getEClassNameStrateg
>>>>>>>>>>> y
>>>>>>>>>> (
>>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>>> getEPackages());
>>>>>>>>>>> } else {
>>>>>>>>>>> eclass =
>>>>>>>>>>> EModelResolver.instance().getEClass
>>>>>> (pc.getMappedClas
>>>>>>>>>>> s
>>>>>>>>>> ())
>>>>>>>>>>> ;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> // DCB: Provide a way to avoid container mappings
>> for
>>>>>>>>>>> a particular // class. You'd do this if, for
>> example,
>>>>>>>>>>> // you never load the contained objects except
>> through
>>>>>>>>>>> the containers... // or, you don't fit the use
>>>>>>>>>>> case // for which this was put together (i.e., the
>>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>>> resolve the // container)
>>>>>>>>>>> if (eclass == null
>>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>>> return; // featuremap
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>>> for (EReference eref :
>>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>>> {
>>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>>> log
>>>>>>>>>>> .debug("There are container
>>>>>>>>>>> ereferences
>>>>>>>>>>> present, assuming that no
>> separate
>>>>>>>>>>> econta iner columns
>>>>>>>>>>> are required.");
>>>>>>>>>>> return;
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding eContainer and
>>>>>>>>>>> econtainerfeatureid properties to " +
>>>>>>>>>>> pc.getClassName());
>>>>>>>>>>>
>>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER)
>>>>>>>>>>> ; eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>());
>>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>>> etName());
>>>>>>>>>>>
>>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
>> ());
>>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>>>
>>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> eccColumn));
>>>>>>>>>>>
>>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecColumn));
>>>>>>>>>>>
>>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>>
>>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>>> ecFID.setName
>>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>>
>>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecfColumn));
>>>>>>>>>>>
>>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with
>>>>>>>>>>>>> a performance issue in your case (the products collection
>>>>>>>>>>>>> is very large). Is that correct?
>>>>>>>>>>>> YES.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>>> transient to false will ensure that the container is set
>>>>>>>>>>>>> in the db. Even now if the products are read from the db
>> through
>>>>>>>>>>>>> the ProductRegistry.products then when loading the
>>>>>>>>>>>>> products their econtainer should normally be set
>>>>>>>>>>>>> correctly. Did you
>> try
>>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>>> pagination,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>>> In fact , the product table has no ProductRegistry , it
>>>>>>>>>>>> only have field EContainer , I guess they has been merged
>>>>>>>>>>>> as one. Right?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> So in short is it an issue for your app that the
>>>>>>>>>>>>> econtainer
>> is
>>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>>
>>>>>>>>>>>> ?
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:true
>>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: true
>>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:false
>>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: false
>>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #84361 is a reply to message #84327] Sun, 20 May 2007 10:57 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin :

bug# is 187984 .



Anthony

> Anthony,
> Can you post the complete stacktrace?
>
> Which version of Teneo are you using?
>
> Bugzilla can be entered here:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT
>
> I had hoped to do a next release this week but it will be a few weeks
> later.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> After I use customed HbSessionDataStore , I got en exception said
>> org.hibernate.MappingException: Unknown entity: SND(my top model
>> class)
>>
>> BTW, where to input bugzilla and when will next release be ready?
>>
>>
>> Anthony
>>
>>
>>> Anthony,
>>> The latest release of Teneo should have a getReferers method.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> agree,'protected' would be better.
>>>>
>>>> isContained() method can be copy, but it need a private member
>>>> 'referers' and no method(protected or public) could return this
>> member.
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> ( rt.isContainer could be replace with rt.isContainer())
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>> Hi Anthony,
>>>>> No stupid question at all (I forgot myself that these were private
>>>>> when copy-pasting the code in the previous post), over time I
>> noticed
>>>>> that I should make more and more methods in HbDataStore protected
>>>>> to facilitate customization, probably these methods are also
>> candidates.
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>>> I will enter a bugzilla later.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>> I would copy these methods also, each of them is only a few
>>>>>>> lines. Btw, this is just a workaround to get you going. If you
>>>>>>> enter a bugzilla for this then I can look at it more thoroughly
>>>>>>> for the
>> next
>>>>>>> build.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>>> private
>>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>>
>>>>>>>> Is there another way to work around?
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>> This part of the code did not change that much since 0.7.5.
>>>>>>>>> For 0.7.5 you can override the HbDataStore.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> At this time I am using Teneo 0.7.5, it has only
>>>>>>>>>> HbDataStore.
>>>>>>>>>>
>>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Okay, one thing I find strange is that there is an
>>>>>>>>>>> econtainer field in the product but it does not do
>>>>>>>>>>> addcontainermapping
>> for
>>>>>>>>>>> this type.
>>>>>>>>>>>
>>>>>>>>>>> Can you try the following:
>>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>>> method with the method below. The only change I made is that
>> in
>>>>>>>>>>> this method if a isContainer ereference is found no
>>>>>>>>>>> econtainer mapping is added. Also you need to replace the
>>>>>>>>>>> code NAME_IS_PRODUCT with something meaningfull. It is not a
>>>>>>>>>>> nice solution but it can help to identify how to solve this.
>>>>>>>>>>>
>>>>>>>>>>> /**
>>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
>> only
>>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>>> feature which points to the container */
>>>>>>>>>>> protected void addContainerMapping(PersistentClass pc)
>>>>>>>>>>> {
>>>>>>>>>>>
>>>>>>>>>>> // always first check if the super class should
>>>>>>>>>>> have
>> a
>>>>>>>>>>> container mapping if (pc.getSuperclass() != null)
>>>>>>>>>>> {
>>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>>
>>>>>>>>>>> final EClass eclass;
>>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>>> eclass =
>>>>>>>>>>> getPersistenceOptions
>>>>>>>> ().getEClassNameStrateg
>>>>>>>>>>> y
>>>>>>>>>> (
>>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>>> getEPackages());
>>>>>>>>>>> } else {
>>>>>>>>>>> eclass =
>>>>>>>>>>> EModelResolver.instance().getEClass
>>>>>> (pc.getMappedClas
>>>>>>>>>>> s
>>>>>>>>>> ())
>>>>>>>>>>> ;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> // DCB: Provide a way to avoid container mappings
>> for
>>>>>>>>>>> a particular // class. You'd do this if, for
>> example,
>>>>>>>>>>> // you never load the contained objects except
>> through
>>>>>>>>>>> the containers... // or, you don't fit the use
>>>>>>>>>>> case // for which this was put together (i.e., the
>>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>>> resolve the // container)
>>>>>>>>>>> if (eclass == null
>>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>>> return; // featuremap
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>>> for (EReference eref :
>>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>>> {
>>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>>> log
>>>>>>>>>>> .debug("There are container
>>>>>>>>>>> ereferences
>>>>>>>>>>> present, assuming that no
>> separate
>>>>>>>>>>> econta iner columns
>>>>>>>>>>> are required.");
>>>>>>>>>>> return;
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding eContainer and
>>>>>>>>>>> econtainerfeatureid properties to " +
>>>>>>>>>>> pc.getClassName());
>>>>>>>>>>>
>>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>>> eContainer.setName
(HbConstants.PROPERTY_ECONTAINER)
>>>>>>>>>>> ; eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>());
>>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>>> etName());
>>>>>>>>>>>
>>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
>> ());
>>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName
());
>>>>>>>>>>>
>>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> eccColumn));
>>>>>>>>>>>
>>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecColumn));
>>>>>>>>>>>
>>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>>
>>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>>> ecFID.setName
>>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>>
>>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecfColumn));
>>>>>>>>>>>
>>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with
>>>>>>>>>>>>> a performance issue in your case (the products collection
>>>>>>>>>>>>> is very large). Is that correct?
>>>>>>>>>>>> YES.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>>> transient to false will ensure that the container is set
>>>>>>>>>>>>> in the db. Even now if the products are read from the db
>> through
>>>>>>>>>>>>> the ProductRegistry.products then when loading the
>>>>>>>>>>>>> products their econtainer should normally be set
>>>>>>>>>>>>> correctly. Did you
>> try
>>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>>> pagination,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>>> In fact , the product table has no ProductRegistry , it
>>>>>>>>>>>> only have field EContainer , I guess they has been merged
>>>>>>>>>>>> as one. Right?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> So in short is it an issue for your app that the
>>>>>>>>>>>>> econtainer
>> is
>>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>>
>>>>>>>>>>>> ?
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:true
>>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: true
>>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:false
>>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: false
>>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606726 is a reply to message #83921] Fri, 18 May 2007 09:38 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
Was the eContainer null in the object after the save? Where/how was it set to null (you can set a
breakpoint to check out who then nullifies the eContainer)?
Which object was in which resource, was the child in resource 1 and the parent in resource 2, or
both in the same resource?

gr. Martin

Anthony wrote:
> Hi,
>
> I had some many-To-one eobject to save,
>
> before executing HibernateResource's mySession.saveOrUpdate(obj)
>
> I saw the eContainer is correct.
>
> No exception was thrown, but in Mysql DB, the eContainer was null.
>
> The container was init by other resource than the resource init the
> contained object.
>
> Is it the reason?
>
> Anthony
>


--

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: [Teneo] eContainer has not been saved? [message #606727 is a reply to message #83936] Fri, 18 May 2007 10:14 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

I add preFlush() and postFlush in my Interceptor, I could see that all
the eContainer is correct before flush and after flush. It is not set
null at all. But the field present eContainer is null.

The parent is load in resource 1 , and the child is load in resource
2.



Thanks.

Anthony




> Hi Anthony,
> Was the eContainer null in the object after the save? Where/how was it
> set to null (you can set a breakpoint to check out who then nullifies
> the eContainer)? Which object was in which resource, was the child in
> resource 1 and the parent in resource 2, or both in the same resource?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> I had some many-To-one eobject to save,
>>
>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>
>> I saw the eContainer is correct.
>>
>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>
>> The container was init by other resource than the resource init
>> the
>> contained object.
>>
>> Is it the reason?
>>
>> Anthony
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606728 is a reply to message #83949] Fri, 18 May 2007 10:22 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
But the field in DB present eContainer is null.


Anthony


> Martin,
>
> I add preFlush() and postFlush in my Interceptor, I could see that
all
> the eContainer is correct before flush and after flush. It is not set
> null at all. But the field present eContainer is null.
>
> The parent is load in resource 1 , and the child is load in resource
> 2.
>
>
>
> Thanks.
>
> Anthony
>
>
>
>
>> Hi Anthony,
>> Was the eContainer null in the object after the save? Where/how was
it
>> set to null (you can set a breakpoint to check out who then nullifies
>> the eContainer)? Which object was in which resource, was the child in
>> resource 1 and the parent in resource 2, or both in the same
resource?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I had some many-To-one eobject to save,
>>>
>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>
>>> I saw the eContainer is correct.
>>>
>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>
>>> The container was init by other resource than the resource init
>>> the
>>> contained object.
>>>
>>> Is it the reason?
>>>
>>> Anthony
>>>
>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606729 is a reply to message #83949] Fri, 18 May 2007 14:04 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
So before the save eContainer is not null and after the save it is null?
Did you set a breakpoint in the eBasicSetContainer method?

gr. Martin

Anthony wrote:
> Martin,
>
> I add preFlush() and postFlush in my Interceptor, I could see that all
> the eContainer is correct before flush and after flush. It is not set
> null at all. But the field present eContainer is null.
>
> The parent is load in resource 1 , and the child is load in resource
> 2.
>
>
>
> Thanks.
>
> Anthony
>
>
>
>
>> Hi Anthony,
>> Was the eContainer null in the object after the save? Where/how was it
>> set to null (you can set a breakpoint to check out who then nullifies
>> the eContainer)? Which object was in which resource, was the child in
>> resource 1 and the parent in resource 2, or both in the same resource?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I had some many-To-one eobject to save,
>>>
>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>
>>> I saw the eContainer is correct.
>>>
>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>
>>> The container was init by other resource than the resource init
>>> the
>>> contained object.
>>>
>>> Is it the reason?
>>>
>>> Anthony
>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606730 is a reply to message #83979] Fri, 18 May 2007 14:16 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

No. It is not null before and after the saving.
Just it is not set in DB.
I think that's related to Hibernate .


I have another question to ask:

As I need to adapt to db2 tables ,
I have to write the mapping file .
I want to know if below meta arrtibutes must be inside the class ?

<meta attribute="eclassName">Customer</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>


Best regard,

Anthony


> Anthony,
> So before the save eContainer is not null and after the save it is
> null? Did you set a breakpoint in the eBasicSetContainer method?
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> I add preFlush() and postFlush in my Interceptor, I could see that
>> all
>> the eContainer is correct before flush and after flush. It is not set
>> null at all. But the field present eContainer is null.
>>
>> The parent is load in resource 1 , and the child is load in
>> resource
>> 2.
>>
>>
>>
>> Thanks.
>>
>> Anthony
>>
>>
>>
>>
>>> Hi Anthony,
>>> Was the eContainer null in the object after the save? Where/how was
>>> it set to null (you can set a breakpoint to check out who then
>>> nullifies the eContainer)? Which object was in which resource, was
>>> the child in resource 1 and the parent in resource 2, or both in the
>>> same resource?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Hi,
>>>>
>>>> I had some many-To-one eobject to save,
>>>>
>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>
>>>> I saw the eContainer is correct.
>>>>
>>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>>
>>>> The container was init by other resource than the resource init
>>>> the
>>>> contained object.
>>>>
>>>> Is it the reason?
>>>>
>>>> Anthony
>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606731 is a reply to message #83994] Fri, 18 May 2007 14:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Can you post the mapping file (or for one type which has an econtainer)?

No the meta attributes are not required for Teneo. They are for future use.
gr. Martin

Anthony wrote:
> Martin,
>
> No. It is not null before and after the saving.
> Just it is not set in DB.
> I think that's related to Hibernate .
>
>
> I have another question to ask:
>
> As I need to adapt to db2 tables ,
> I have to write the mapping file .
> I want to know if below meta arrtibutes must be inside the class ?
>
> <meta attribute="eclassName">Customer</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>
>
> Best regard,
>
> Anthony
>
>
>> Anthony,
>> So before the save eContainer is not null and after the save it is
>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> I add preFlush() and postFlush in my Interceptor, I could see that
>>> all
>>> the eContainer is correct before flush and after flush. It is not set
>>> null at all. But the field present eContainer is null.
>>>
>>> The parent is load in resource 1 , and the child is load in
>>> resource
>>> 2.
>>>
>>>
>>>
>>> Thanks.
>>>
>>> Anthony
>>>
>>>
>>>
>>>
>>>> Hi Anthony,
>>>> Was the eContainer null in the object after the save? Where/how was
>>>> it set to null (you can set a breakpoint to check out who then
>>>> nullifies the eContainer)? Which object was in which resource, was
>>>> the child in resource 1 and the parent in resource 2, or both in the
>>>> same resource?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Hi,
>>>>>
>>>>> I had some many-To-one eobject to save,
>>>>>
>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>
>>>>> I saw the eContainer is correct.
>>>>>
>>>>> No exception was thrown, but in Mysql DB, the eContainer was null.
>>>>>
>>>>> The container was init by other resource than the resource init
>>>>> the
>>>>> contained object.
>>>>>
>>>>> Is it the reason?
>>>>>
>>>>> Anthony
>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606732 is a reply to message #84009] Fri, 18 May 2007 14:40 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

ProductRegistry is Product's container.

<subclass entity-name="Product" abstract="false" lazy="false"
extends="NamedElement" discriminator-value="Product">
<meta attribute="eclassName">Product</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>
<property name="productId" lazy="false" insert="true"
update="true" not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false"
name="`productid`"/>
</property>

<many-to-one name="productRegistry" entity-
name="ProductRegistry" cascade="merge,persist,save-update,lock,refresh"
lazy="false" insert="false" update="false" not-null="false">
<column not-null="false" unique="false"
name="`product_productregistry_id`"/>
</many-to-one>
</subclass>


<class entity-name="ProductRegistry" abstract="false" lazy="false"
discriminator-value="ProductRegistry" table="`productregistry`">
<meta attribute="eclassName">ProductRegistry</meta>
<meta attribute="epackage">http:///sndmodel.ecore</meta>
<id type="long" name="e_id" column="e_id"
access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPro
pertyHandler">
<meta attribute="syntheticId">true</meta>
<generator class="native"/>
</id>
<discriminator column="`dtype`" type="string"/>
<version name="e_version" column="e_version"
access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp erty
Handler">
<meta attribute="syntheticVersion">true</meta>
</version>
<property name="modelName" lazy="false" insert="true"
update="true" not-null="true" unique="false" type="java.lang.String">
<column not-null="true" unique="false"
name="`modelname`"/>
</property>
</class>


Anthony



> Anthony,
> Can you post the mapping file (or for one type which has an
> econtainer)?
>
> No the meta attributes are not required for Teneo. They are for future
> use. gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> No. It is not null before and after the saving.
>> Just it is not set in DB.
>> I think that's related to Hibernate .
>>
>>
>> I have another question to ask:
>>
>> As I need to adapt to db2 tables ,
>> I have to write the mapping file .
>> I want to know if below meta arrtibutes must be inside the class ?
>>
>> <meta attribute="eclassName">Customer</meta>
>> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>>
>>
>> Best regard,
>>
>> Anthony
>>
>>
>>> Anthony,
>>> So before the save eContainer is not null and after the save it is
>>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> I add preFlush() and postFlush in my Interceptor, I could see
>>>> that all
>>>> the eContainer is correct before flush and after flush. It is not
>>>> set null at all. But the field present eContainer is null.
>>>>
>>>> The parent is load in resource 1 , and the child is load in
>>>> resource
>>>> 2.
>>>>
>>>>
>>>>
>>>> Thanks.
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>
>>>>> Hi Anthony,
>>>>> Was the eContainer null in the object after the save? Where/how
>>>>> was it set to null (you can set a breakpoint to check out who then
>>>>> nullifies the eContainer)? Which object was in which resource, was
>>>>> the child in resource 1 and the parent in resource 2, or both in
>>>>> the same resource?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I had some many-To-one eobject to save,
>>>>>>
>>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>>
>>>>>> I saw the eContainer is correct.
>>>>>>
>>>>>> No exception was thrown, but in Mysql DB, the eContainer was
>>>>>> null.
>>>>>>
>>>>>> The container was init by other resource than the resource
>>>>>> init the
>>>>>> contained object.
>>>>>>
>>>>>> Is it the reason?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606733 is a reply to message #84023] Fri, 18 May 2007 14:43 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Can you set a breakpoint in the method HbDataStore.addContainerMapping to check if it is called?
This method adds the econtainer mapping to the hbm mapping.

gr. Martin

Anthony wrote:
> Martin,
>
> ProductRegistry is Product's container.
>
> <subclass entity-name="Product" abstract="false" lazy="false"
> extends="NamedElement" discriminator-value="Product">
> <meta attribute="eclassName">Product</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
> <property name="productId" lazy="false" insert="true"
> update="true" not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false"
> name="`productid`"/>
> </property>
>
> <many-to-one name="productRegistry" entity-
> name="ProductRegistry" cascade="merge,persist,save-update,lock,refresh"
> lazy="false" insert="false" update="false" not-null="false">
> <column not-null="false" unique="false"
> name="`product_productregistry_id`"/>
> </many-to-one>
> </subclass>
>
>
> <class entity-name="ProductRegistry" abstract="false" lazy="false"
> discriminator-value="ProductRegistry" table="`productregistry`">
> <meta attribute="eclassName">ProductRegistry</meta>
> <meta attribute="epackage">http:///sndmodel.ecore</meta>
> <id type="long" name="e_id" column="e_id"
> access=" org.eclipse.emf.teneo.hibernate.mapping.identifier.Identifie rPro
> pertyHandler">
> <meta attribute="syntheticId">true</meta>
> <generator class="native"/>
> </id>
> <discriminator column="`dtype`" type="string"/>
> <version name="e_version" column="e_version"
> access=" org.eclipse.emf.teneo.hibernate.mapping.property.VersionProp erty
> Handler">
> <meta attribute="syntheticVersion">true</meta>
> </version>
> <property name="modelName" lazy="false" insert="true"
> update="true" not-null="true" unique="false" type="java.lang.String">
> <column not-null="true" unique="false"
> name="`modelname`"/>
> </property>
> </class>
>
>
> Anthony
>
>
>
>> Anthony,
>> Can you post the mapping file (or for one type which has an
>> econtainer)?
>>
>> No the meta attributes are not required for Teneo. They are for future
>> use. gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> No. It is not null before and after the saving.
>>> Just it is not set in DB.
>>> I think that's related to Hibernate .
>>>
>>>
>>> I have another question to ask:
>>>
>>> As I need to adapt to db2 tables ,
>>> I have to write the mapping file .
>>> I want to know if below meta arrtibutes must be inside the class ?
>>>
>>> <meta attribute="eclassName">Customer</meta>
>>> <meta attribute="epackage">http:///sndmodel.ecore</meta>
>>>
>>>
>>> Best regard,
>>>
>>> Anthony
>>>
>>>
>>>> Anthony,
>>>> So before the save eContainer is not null and after the save it is
>>>> null? Did you set a breakpoint in the eBasicSetContainer method?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> I add preFlush() and postFlush in my Interceptor, I could see
>>>>> that all
>>>>> the eContainer is correct before flush and after flush. It is not
>>>>> set null at all. But the field present eContainer is null.
>>>>>
>>>>> The parent is load in resource 1 , and the child is load in
>>>>> resource
>>>>> 2.
>>>>>
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Anthony,
>>>>>> Was the eContainer null in the object after the save? Where/how
>>>>>> was it set to null (you can set a breakpoint to check out who then
>>>>>> nullifies the eContainer)? Which object was in which resource, was
>>>>>> the child in resource 1 and the parent in resource 2, or both in
>>>>>> the same resource?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I had some many-To-one eobject to save,
>>>>>>>
>>>>>>> before executing HibernateResource's mySession.saveOrUpdate(obj)
>>>>>>>
>>>>>>> I saw the eContainer is correct.
>>>>>>>
>>>>>>> No exception was thrown, but in Mysql DB, the eContainer was
>>>>>>> null.
>>>>>>>
>>>>>>> The container was init by other resource than the resource
>>>>>>> init the
>>>>>>> contained object.
>>>>>>>
>>>>>>> Is it the reason?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606734 is a reply to message #84039] Fri, 18 May 2007 15:04 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Yes, it got called.



Anthony
Re: [Teneo] eContainer has not been saved? [message #606735 is a reply to message #84039] Fri, 18 May 2007 15:16 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

I step into HbDataStore's addContainerMapping(),

For Product class ,it's referers has not include ProductRegistry,
so rt.isContainer() always return false.

Is it correct behavior?

Anthony
Re: [Teneo] eContainer has not been saved? [message #606736 is a reply to message #84069] Fri, 18 May 2007 15:33 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I start to understand. In Teneo I only considered the case that the containment relation was defined
from the parent to the child. In your case (I now understand) it is defined from the child to the
parent. Correct?

What is the ecore definition of Product.productRegistry?

gr. Martin

Anthony wrote:
> Martin,
>
> I step into HbDataStore's addContainerMapping(),
>
> For Product class ,it's referers has not include ProductRegistry,
> so rt.isContainer() always return false.
>
> Is it correct behavior?
>
> Anthony


--

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: [Teneo] eContainer has not been saved? [message #606738 is a reply to message #84084] Sat, 19 May 2007 10:10 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
@build.eclipse.org:

> Product.productRegistry

Martin,

Product.ProductRegistry :

container:true
containment: false
resolve proxies: true
required: true
lower bound: 1
upper bound: 1
Transient : false
Many : false
EOpposite : products

ProductRegistry.products:

container:false
containment: true
resolve proxies: true
required: false
lower bound: 0
upper bound: -1
Transient : true
Many : true
EOpposite : productRegistry

Regards,

Anthony
Re: [Teneo] eContainer has not been saved? [message #606739 is a reply to message #84111] Sat, 19 May 2007 10:57 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The cause is that transient is true for ProductRegistry.products. I think that this has to do with a
performance issue in your case (the products collection is very large). Is that correct?
Otherwise setting transient to false will ensure that the container is set in the db.
Even now if the products are read from the db through the ProductRegistry.products then when loading
the products their econtainer should normally be set correctly.
Did you try that? Or do you read products independently? In the last case you can get the container
from the product.ProductRegistry.
So in short is it an issue for your app that the econtainer is not stored separately in the
econtainer fields in the db?

gr. Martin

Anthony wrote:
> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
> @build.eclipse.org:
>
>> Product.productRegistry
>
> Martin,
>
> Product.ProductRegistry :
>
> container:true
> containment: false
> resolve proxies: true
> required: true
> lower bound: 1
> upper bound: 1
> Transient : false
> Many : false
> EOpposite : products
>
> ProductRegistry.products:
>
> container:false
> containment: true
> resolve proxies: true
> required: false
> lower bound: 0
> upper bound: -1
> Transient : true
> Many : true
> EOpposite : productRegistry
>
> Regards,
>
> Anthony
>


--

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: [Teneo] eContainer has not been saved? [message #606740 is a reply to message #84126] Sat, 19 May 2007 11:09 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin Taal <mtaal@elver.org> wrote in
news:f2ml6i$j5i$1@build.eclipse.org:

> The cause is that transient is true for ProductRegistry.products. I
> think that this has to do with a performance issue in your case (the
> products collection is very large). Is that correct?

YES.


> Otherwise setting
> transient to false will ensure that the container is set in the db.
> Even now if the products are read from the db through the
> ProductRegistry.products then when loading the products their
> econtainer should normally be set correctly. Did you try that? Or do
> you read products independently?

I load ProductRegistry first,
and then I load product in another resource as I need to do pagination,


> In the last case you can get the
> container from the product.ProductRegistry.

In fact , the product table has no ProductRegistry , it only have
field EContainer , I guess they has been merged as one. Right?



> So in short is it an issue for your app that the econtainer is not
> stored separately in the econtainer fields in the db?

In DB the econtainer field is always null.

?

Anthony


>
> gr. Martin
>
> Anthony wrote:
>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>> @build.eclipse.org:
>>
>>> Product.productRegistry
>>
>> Martin,
>>
>> Product.ProductRegistry :
>>
>> container:true
>> containment: false
>> resolve proxies: true
>> required: true
>> lower bound: 1
>> upper bound: 1
>> Transient : false
>> Many : false
>> EOpposite : products
>>
>> ProductRegistry.products:
>>
>> container:false
>> containment: true
>> resolve proxies: true
>> required: false
>> lower bound: 0
>> upper bound: -1
>> Transient : true
>> Many : true
>> EOpposite : productRegistry
>>
>> Regards,
>>
>> Anthony
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606741 is a reply to message #84142] Sat, 19 May 2007 11:31 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Okay, one thing I find strange is that there is an econtainer field in the product but it does not
do addcontainermapping for this type.

Can you try the following:
override the HbSessionDataStore and the addContainerMapping method with the method below.
The only change I made is that in this method if a isContainer ereference is found no econtainer
mapping is added. Also you need to replace the code NAME_IS_PRODUCT with something meaningfull. It
is not a nice solution but it can help to identify how to solve this.

/**
* Adds a econtainer mapping to the class mapping, is only called for eclasses which do not have
* am explicit feature which points to the container
*/
protected void addContainerMapping(PersistentClass pc) {

// always first check if the super class should have a container mapping
if (pc.getSuperclass() != null) {
addContainerMapping(pc.getSuperclass());
}

if (!isContained(pc) && !NAME_IS_PRODUCT) return;
if (hasEContainerProp(pc)) return;

log.debug("Adding container mapping for " + getMappedName(pc));
// check if there are not alreadyecontai ner features for the eclass

final EClass eclass;
if (pc.getEntityName() != null) {
eclass =
getPersistenceOptions().getEClassNameStrategy().toEClass(pc. getEntityName(),
getEPackages());
} else {
eclass = EModelResolver.instance().getEClass(pc.getMappedClass());
}

// DCB: Provide a way to avoid container mappings for a particular
// class. You'd do this if, for example,
// you never load the contained objects except through the containers...
// or, you don't fit the use case
// for which this was put together (i.e., the generated model editing
// code tries to eagerly resolve the
// container)
if (eclass == null
|| eclass.getEAnnotation("http://facet.elver.org/SkipContainerMappings") != null) {
return; // featuremap
}

if (!NAME_IS_PRODUCT) {
for (EReference eref : eclass.getEAllReferences()) {
if (eref.isContainer()) {
log
.debug("There are container ereferences present, assuming that no separate econta iner columns
are required.");
return;
}
}
}

log.debug("Adding eContainer and econtainerfeatureid properties to " + pc.getClassName());

final Property eContainer = new Property();
eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
eContainer.setMetaAttributes(new HashMap<Object, Object>());
eContainer.setNodeName(eContainer.getName());
eContainer.setPropertyAccessorName(EContainerAccessor.class. getName());

final SimpleValue sv = new SimpleValue(pc.getTable());
sv.setTypeName(EContainerUserType.class.getName());

final Column eccColumn = new Column(HbConstants.COLUMN_ECONTAINER_CLASS);
sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));

final Column ecColumn = new Column(HbConstants.COLUMN_ECONTAINER);
sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));

eContainer.setValue(sv);
pc.addProperty(eContainer);

final Property ecFID = new Property();
ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
ecFID.setMetaAttributes(new HashMap<Object, Object>());
ecFID.setNodeName(ecFID.getName());
ecFID.setPropertyAccessorName(EContainerFeatureIDAccessor.cl ass.getName());
final SimpleValue svfid = new SimpleValue(pc.getTable());
svfid.setTypeName("integer");

final Column ecfColumn = new Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
svfid.addColumn(checkColumnExists(pc.getTable(), ecfColumn));

ecFID.setValue(svfid);
pc.addProperty(ecFID);
}


Anthony wrote:
> Martin Taal <mtaal@elver.org> wrote in
> news:f2ml6i$j5i$1@build.eclipse.org:
>
>> The cause is that transient is true for ProductRegistry.products. I
>> think that this has to do with a performance issue in your case (the
>> products collection is very large). Is that correct?
>
> YES.
>
>
>> Otherwise setting
>> transient to false will ensure that the container is set in the db.
>> Even now if the products are read from the db through the
>> ProductRegistry.products then when loading the products their
>> econtainer should normally be set correctly. Did you try that? Or do
>> you read products independently?
>
> I load ProductRegistry first,
> and then I load product in another resource as I need to do pagination,
>
>
>> In the last case you can get the
>> container from the product.ProductRegistry.
>
> In fact , the product table has no ProductRegistry , it only have
> field EContainer , I guess they has been merged as one. Right?
>
>
>
>> So in short is it an issue for your app that the econtainer is not
>> stored separately in the econtainer fields in the db?
>
> In DB the econtainer field is always null.
>
> ?
>
> Anthony
>
>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>> @build.eclipse.org:
>>>
>>>> Product.productRegistry
>>> Martin,
>>>
>>> Product.ProductRegistry :
>>>
>>> container:true
>>> containment: false
>>> resolve proxies: true
>>> required: true
>>> lower bound: 1
>>> upper bound: 1
>>> Transient : false
>>> Many : false
>>> EOpposite : products
>>>
>>> ProductRegistry.products:
>>>
>>> container:false
>>> containment: true
>>> resolve proxies: true
>>> required: false
>>> lower bound: 0
>>> upper bound: -1
>>> Transient : true
>>> Many : true
>>> EOpposite : productRegistry
>>>
>>> Regards,
>>>
>>> Anthony
>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606742 is a reply to message #84157] Sat, 19 May 2007 12:10 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

At this time I am using Teneo 0.7.5, it has only HbDataStore.

So I need to upgrade to 0.8.


Tomorrow I will try it.


Thanks.


Anthony


> Okay, one thing I find strange is that there is an econtainer field in
> the product but it does not do addcontainermapping for this type.
>
> Can you try the following:
> override the HbSessionDataStore and the addContainerMapping method
> with the method below. The only change I made is that in this method
> if a isContainer ereference is found no econtainer mapping is added.
> Also you need to replace the code NAME_IS_PRODUCT with something
> meaningfull. It is not a nice solution but it can help to identify how
> to solve this.
>
> /**
> * Adds a econtainer mapping to the class mapping, is only called
> for eclasses which do not have * am explicit feature which
> points to the container */
> protected void addContainerMapping(PersistentClass pc) {
>
> // always first check if the super class should have a
> container mapping if (pc.getSuperclass() != null) {
> addContainerMapping(pc.getSuperclass());
> }
>
> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
> if (hasEContainerProp(pc)) return;
>
> log.debug("Adding container mapping for " +
> getMappedName(pc)); // check if there are not alreadyecontai
> ner features for the eclass
>
> final EClass eclass;
> if (pc.getEntityName() != null) {
> eclass =
> getPersistenceOptions().getEClassNameStrategy
(
> ).toEClass(pc.getEntityName(),
> getEPackages());
> } else {
> eclass =
> EModelResolver.instance().getEClass(pc.getMappedClass
())
> ;
> }
>
> // DCB: Provide a way to avoid container mappings for a
> particular // class. You'd do this if, for example,
> // you never load the contained objects except through the
> containers... // or, you don't fit the use case
> // for which this was put together (i.e., the generated
> model editing // code tries to eagerly resolve the
> // container)
> if (eclass == null
> || eclass.getEAnnotation
("http://facet.elver.org/Sk
> || ipContainerMappings") != null) {
> return; // featuremap
> }
>
> if (!NAME_IS_PRODUCT) {
> for (EReference eref : eclass.getEAllReferences()) {
> if (eref.isContainer()) {
> log
> .debug("There are container ereferences
> present, assuming that no separate
> econta iner columns
> are required.");
> return;
> }
> }
> }
>
> log.debug("Adding eContainer and econtainerfeatureid
> properties to " + pc.getClassName());
>
> final Property eContainer = new Property();
> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
> eContainer.setMetaAttributes(new HashMap<Object, Object>());
> eContainer.setNodeName(eContainer.getName());
> eContainer.setPropertyAccessorName
(EContainerAccessor.class.g
> etName());
>
> final SimpleValue sv = new SimpleValue(pc.getTable());
> sv.setTypeName(EContainerUserType.class.getName());
>
> final Column eccColumn = new
> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>
> final Column ecColumn = new
> Column(HbConstants.COLUMN_ECONTAINER);
> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>
> eContainer.setValue(sv);
> pc.addProperty(eContainer);
>
> final Property ecFID = new Property();
> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
> ecFID.setMetaAttributes(new HashMap<Object, Object>());
> ecFID.setNodeName(ecFID.getName());
> ecFID.setPropertyAccessorName
(EContainerFeatureIDAccessor.cla
> ss.getName()); final SimpleValue svfid = new
> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>
> final Column ecfColumn = new
> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
> svfid.addColumn(checkColumnExists(pc.getTable(),
> ecfColumn));
>
> ecFID.setValue(svfid);
> pc.addProperty(ecFID);
> }
>
>
> Anthony wrote:
>> Martin Taal <mtaal@elver.org> wrote in
>> news:f2ml6i$j5i$1@build.eclipse.org:
>>
>>> The cause is that transient is true for ProductRegistry.products. I
>>> think that this has to do with a performance issue in your case (the
>>> products collection is very large). Is that correct?
>>
>> YES.
>>
>>
>>> Otherwise setting
>>> transient to false will ensure that the container is set in the db.
>>> Even now if the products are read from the db through the
>>> ProductRegistry.products then when loading the products their
>>> econtainer should normally be set correctly. Did you try that? Or do
>>> you read products independently?
>>
>> I load ProductRegistry first,
>> and then I load product in another resource as I need to do
>> pagination,
>>
>>
>>> In the last case you can get the
>>> container from the product.ProductRegistry.
>>
>> In fact , the product table has no ProductRegistry , it only have
>> field EContainer , I guess they has been merged as one. Right?
>>
>>
>>
>>> So in short is it an issue for your app that the econtainer is not
>>> stored separately in the econtainer fields in the db?
>>
>> In DB the econtainer field is always null.
>>
>> ?
>>
>> Anthony
>>
>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>> @build.eclipse.org:
>>>>
>>>>> Product.productRegistry
>>>> Martin,
>>>>
>>>> Product.ProductRegistry :
>>>>
>>>> container:true
>>>> containment: false
>>>> resolve proxies: true
>>>> required: true
>>>> lower bound: 1
>>>> upper bound: 1
>>>> Transient : false
>>>> Many : false
>>>> EOpposite : products
>>>>
>>>> ProductRegistry.products:
>>>>
>>>> container:false
>>>> containment: true
>>>> resolve proxies: true
>>>> required: false
>>>> lower bound: 0
>>>> upper bound: -1
>>>> Transient : true
>>>> Many : true
>>>> EOpposite : productRegistry
>>>>
>>>> Regards,
>>>>
>>>> Anthony
>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606743 is a reply to message #84173] Sun, 20 May 2007 04:04 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
This part of the code did not change that much since 0.7.5. For 0.7.5 you can override the HbDataStore.

gr. Martin

Anthony wrote:
> Martin,
>
> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>
> So I need to upgrade to 0.8.
>
>
> Tomorrow I will try it.
>
>
> Thanks.
>
>
> Anthony
>
>
>> Okay, one thing I find strange is that there is an econtainer field in
>> the product but it does not do addcontainermapping for this type.
>>
>> Can you try the following:
>> override the HbSessionDataStore and the addContainerMapping method
>> with the method below. The only change I made is that in this method
>> if a isContainer ereference is found no econtainer mapping is added.
>> Also you need to replace the code NAME_IS_PRODUCT with something
>> meaningfull. It is not a nice solution but it can help to identify how
>> to solve this.
>>
>> /**
>> * Adds a econtainer mapping to the class mapping, is only called
>> for eclasses which do not have * am explicit feature which
>> points to the container */
>> protected void addContainerMapping(PersistentClass pc) {
>>
>> // always first check if the super class should have a
>> container mapping if (pc.getSuperclass() != null) {
>> addContainerMapping(pc.getSuperclass());
>> }
>>
>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>> if (hasEContainerProp(pc)) return;
>>
>> log.debug("Adding container mapping for " +
>> getMappedName(pc)); // check if there are not alreadyecontai
>> ner features for the eclass
>>
>> final EClass eclass;
>> if (pc.getEntityName() != null) {
>> eclass =
>> getPersistenceOptions().getEClassNameStrategy
> (
>> ).toEClass(pc.getEntityName(),
>> getEPackages());
>> } else {
>> eclass =
>> EModelResolver.instance().getEClass(pc.getMappedClass
> ())
>> ;
>> }
>>
>> // DCB: Provide a way to avoid container mappings for a
>> particular // class. You'd do this if, for example,
>> // you never load the contained objects except through the
>> containers... // or, you don't fit the use case
>> // for which this was put together (i.e., the generated
>> model editing // code tries to eagerly resolve the
>> // container)
>> if (eclass == null
>> || eclass.getEAnnotation
> ("http://facet.elver.org/Sk
>> || ipContainerMappings") != null) {
>> return; // featuremap
>> }
>>
>> if (!NAME_IS_PRODUCT) {
>> for (EReference eref : eclass.getEAllReferences()) {
>> if (eref.isContainer()) {
>> log
>> .debug("There are container ereferences
>> present, assuming that no separate
>> econta iner columns
>> are required.");
>> return;
>> }
>> }
>> }
>>
>> log.debug("Adding eContainer and econtainerfeatureid
>> properties to " + pc.getClassName());
>>
>> final Property eContainer = new Property();
>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>> eContainer.setMetaAttributes(new HashMap<Object, Object>());
>> eContainer.setNodeName(eContainer.getName());
>> eContainer.setPropertyAccessorName
> (EContainerAccessor.class.g
>> etName());
>>
>> final SimpleValue sv = new SimpleValue(pc.getTable());
>> sv.setTypeName(EContainerUserType.class.getName());
>>
>> final Column eccColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>
>> final Column ecColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER);
>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>
>> eContainer.setValue(sv);
>> pc.addProperty(eContainer);
>>
>> final Property ecFID = new Property();
>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>> ecFID.setNodeName(ecFID.getName());
>> ecFID.setPropertyAccessorName
> (EContainerFeatureIDAccessor.cla
>> ss.getName()); final SimpleValue svfid = new
>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>
>> final Column ecfColumn = new
>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>> svfid.addColumn(checkColumnExists(pc.getTable(),
>> ecfColumn));
>>
>> ecFID.setValue(svfid);
>> pc.addProperty(ecFID);
>> }
>>
>>
>> Anthony wrote:
>>> Martin Taal <mtaal@elver.org> wrote in
>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>
>>>> The cause is that transient is true for ProductRegistry.products. I
>>>> think that this has to do with a performance issue in your case (the
>>>> products collection is very large). Is that correct?
>>> YES.
>>>
>>>
>>>> Otherwise setting
>>>> transient to false will ensure that the container is set in the db.
>>>> Even now if the products are read from the db through the
>>>> ProductRegistry.products then when loading the products their
>>>> econtainer should normally be set correctly. Did you try that? Or do
>>>> you read products independently?
>>> I load ProductRegistry first,
>>> and then I load product in another resource as I need to do
>>> pagination,
>>>
>>>
>>>> In the last case you can get the
>>>> container from the product.ProductRegistry.
>>> In fact , the product table has no ProductRegistry , it only have
>>> field EContainer , I guess they has been merged as one. Right?
>>>
>>>
>>>
>>>> So in short is it an issue for your app that the econtainer is not
>>>> stored separately in the econtainer fields in the db?
>>> In DB the econtainer field is always null.
>>>
>>> ?
>>>
>>> Anthony
>>>
>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>> @build.eclipse.org:
>>>>>
>>>>>> Product.productRegistry
>>>>> Martin,
>>>>>
>>>>> Product.ProductRegistry :
>>>>>
>>>>> container:true
>>>>> containment: false
>>>>> resolve proxies: true
>>>>> required: true
>>>>> lower bound: 1
>>>>> upper bound: 1
>>>>> Transient : false
>>>>> Many : false
>>>>> EOpposite : products
>>>>>
>>>>> ProductRegistry.products:
>>>>>
>>>>> container:false
>>>>> containment: true
>>>>> resolve proxies: true
>>>>> required: false
>>>>> lower bound: 0
>>>>> upper bound: -1
>>>>> Transient : true
>>>>> Many : true
>>>>> EOpposite : productRegistry
>>>>>
>>>>> Regards,
>>>>>
>>>>> Anthony
>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606745 is a reply to message #84188] Sun, 20 May 2007 04:44 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

As isContained(),hasEContainerProp(),checkColumnExists() are private
method,HbDataStore's addContainerMapping() cannot be overrided.

Is there another way to work around?

Thanks.

Anthony

> Anthony,
> This part of the code did not change that much since 0.7.5. For 0.7.5
> you can override the HbDataStore.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>
>> So I need to upgrade to 0.8.
>>
>>
>> Tomorrow I will try it.
>>
>>
>> Thanks.
>>
>>
>> Anthony
>>
>>
>>> Okay, one thing I find strange is that there is an econtainer field
>>> in the product but it does not do addcontainermapping for this type.
>>>
>>> Can you try the following:
>>> override the HbSessionDataStore and the addContainerMapping method
>>> with the method below. The only change I made is that in this method
>>> if a isContainer ereference is found no econtainer mapping is added.
>>> Also you need to replace the code NAME_IS_PRODUCT with something
>>> meaningfull. It is not a nice solution but it can help to identify
>>> how to solve this.
>>>
>>> /**
>>> * Adds a econtainer mapping to the class mapping, is only
>>> called for eclasses which do not have * am explicit feature
>>> which points to the container */
>>> protected void addContainerMapping(PersistentClass pc) {
>>>
>>> // always first check if the super class should have a
>>> container mapping if (pc.getSuperclass() != null) {
>>> addContainerMapping(pc.getSuperclass());
>>> }
>>>
>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>> if (hasEContainerProp(pc)) return;
>>>
>>> log.debug("Adding container mapping for " +
>>> getMappedName(pc)); // check if there are not
>>> alreadyecontai ner features for the eclass
>>>
>>> final EClass eclass;
>>> if (pc.getEntityName() != null) {
>>> eclass =
>>> getPersistenceOptions
().getEClassNameStrateg
>>> y
>> (
>>> ).toEClass(pc.getEntityName(),
>>> getEPackages());
>>> } else {
>>> eclass =
>>> EModelResolver.instance().getEClass(pc.getMappedClass
>> ())
>>> ;
>>> }
>>>
>>> // DCB: Provide a way to avoid container mappings for a
>>> particular // class. You'd do this if, for example,
>>> // you never load the contained objects except through the
>>> containers... // or, you don't fit the use case
>>> // for which this was put together (i.e., the generated
>>> model editing // code tries to eagerly resolve the
>>> // container)
>>> if (eclass == null
>>> || eclass.getEAnnotation
>> ("http://facet.elver.org/Sk
>>> || ipContainerMappings") != null) {
>>> return; // featuremap
>>> }
>>>
>>> if (!NAME_IS_PRODUCT) {
>>> for (EReference eref : eclass.getEAllReferences()) {
>>> if (eref.isContainer()) {
>>> log
>>> .debug("There are container
>>> ereferences
>>> present, assuming that no separate
>>> econta iner columns
>>> are required.");
>>> return;
>>> }
>>> }
>>> }
>>>
>>> log.debug("Adding eContainer and econtainerfeatureid
>>> properties to " + pc.getClassName());
>>>
>>> final Property eContainer = new Property();
>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>> eContainer.setMetaAttributes(new HashMap<Object,
>>> Object>()); eContainer.setNodeName(eContainer.getName());
>>> eContainer.setPropertyAccessorName
>> (EContainerAccessor.class.g
>>> etName());
>>>
>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>> sv.setTypeName(EContainerUserType.class.getName());
>>>
>>> final Column eccColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>>
>>> final Column ecColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER);
>>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>>
>>> eContainer.setValue(sv);
>>> pc.addProperty(eContainer);
>>>
>>> final Property ecFID = new Property();
>>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>>> ecFID.setNodeName(ecFID.getName());
>>> ecFID.setPropertyAccessorName
>> (EContainerFeatureIDAccessor.cla
>>> ss.getName()); final SimpleValue svfid = new
>>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>>
>>> final Column ecfColumn = new
>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>> ecfColumn));
>>>
>>> ecFID.setValue(svfid);
>>> pc.addProperty(ecFID);
>>> }
>>>
>>>
>>> Anthony wrote:
>>>> Martin Taal <mtaal@elver.org> wrote in
>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>
>>>>> The cause is that transient is true for ProductRegistry.products.
>>>>> I think that this has to do with a performance issue in your case
>>>>> (the products collection is very large). Is that correct?
>>>> YES.
>>>>
>>>>
>>>>> Otherwise setting
>>>>> transient to false will ensure that the container is set in the
>>>>> db. Even now if the products are read from the db through the
>>>>> ProductRegistry.products then when loading the products their
>>>>> econtainer should normally be set correctly. Did you try that? Or
>>>>> do you read products independently?
>>>> I load ProductRegistry first,
>>>> and then I load product in another resource as I need to do
>>>> pagination,
>>>>
>>>>
>>>>> In the last case you can get the
>>>>> container from the product.ProductRegistry.
>>>> In fact , the product table has no ProductRegistry , it only have
>>>> field EContainer , I guess they has been merged as one. Right?
>>>>
>>>>
>>>>
>>>>> So in short is it an issue for your app that the econtainer is not
>>>>> stored separately in the econtainer fields in the db?
>>>> In DB the econtainer field is always null.
>>>>
>>>> ?
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>> @build.eclipse.org:
>>>>>>
>>>>>>> Product.productRegistry
>>>>>> Martin,
>>>>>>
>>>>>> Product.ProductRegistry :
>>>>>>
>>>>>> container:true
>>>>>> containment: false
>>>>>> resolve proxies: true
>>>>>> required: true
>>>>>> lower bound: 1
>>>>>> upper bound: 1
>>>>>> Transient : false
>>>>>> Many : false
>>>>>> EOpposite : products
>>>>>>
>>>>>> ProductRegistry.products:
>>>>>>
>>>>>> container:false
>>>>>> containment: true
>>>>>> resolve proxies: true
>>>>>> required: false
>>>>>> lower bound: 0
>>>>>> upper bound: -1
>>>>>> Transient : true
>>>>>> Many : true
>>>>>> EOpposite : productRegistry
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Anthony
>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606746 is a reply to message #84220] Sun, 20 May 2007 04:53 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
I would copy these methods also, each of them is only a few lines.
Btw, this is just a workaround to get you going. If you enter a bugzilla for this then I can look at
it more thoroughly for the next build.

gr. Martin

Anthony wrote:
> Martin,
>
> As isContained(),hasEContainerProp(),checkColumnExists() are private
> method,HbDataStore's addContainerMapping() cannot be overrided.
>
> Is there another way to work around?
>
> Thanks.
>
> Anthony
>
>> Anthony,
>> This part of the code did not change that much since 0.7.5. For 0.7.5
>> you can override the HbDataStore.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>
>>> So I need to upgrade to 0.8.
>>>
>>>
>>> Tomorrow I will try it.
>>>
>>>
>>> Thanks.
>>>
>>>
>>> Anthony
>>>
>>>
>>>> Okay, one thing I find strange is that there is an econtainer field
>>>> in the product but it does not do addcontainermapping for this type.
>>>>
>>>> Can you try the following:
>>>> override the HbSessionDataStore and the addContainerMapping method
>>>> with the method below. The only change I made is that in this method
>>>> if a isContainer ereference is found no econtainer mapping is added.
>>>> Also you need to replace the code NAME_IS_PRODUCT with something
>>>> meaningfull. It is not a nice solution but it can help to identify
>>>> how to solve this.
>>>>
>>>> /**
>>>> * Adds a econtainer mapping to the class mapping, is only
>>>> called for eclasses which do not have * am explicit feature
>>>> which points to the container */
>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>
>>>> // always first check if the super class should have a
>>>> container mapping if (pc.getSuperclass() != null) {
>>>> addContainerMapping(pc.getSuperclass());
>>>> }
>>>>
>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>> if (hasEContainerProp(pc)) return;
>>>>
>>>> log.debug("Adding container mapping for " +
>>>> getMappedName(pc)); // check if there are not
>>>> alreadyecontai ner features for the eclass
>>>>
>>>> final EClass eclass;
>>>> if (pc.getEntityName() != null) {
>>>> eclass =
>>>> getPersistenceOptions
> ().getEClassNameStrateg
>>>> y
>>> (
>>>> ).toEClass(pc.getEntityName(),
>>>> getEPackages());
>>>> } else {
>>>> eclass =
>>>> EModelResolver.instance().getEClass(pc.getMappedClass
>>> ())
>>>> ;
>>>> }
>>>>
>>>> // DCB: Provide a way to avoid container mappings for a
>>>> particular // class. You'd do this if, for example,
>>>> // you never load the contained objects except through the
>>>> containers... // or, you don't fit the use case
>>>> // for which this was put together (i.e., the generated
>>>> model editing // code tries to eagerly resolve the
>>>> // container)
>>>> if (eclass == null
>>>> || eclass.getEAnnotation
>>> ("http://facet.elver.org/Sk
>>>> || ipContainerMappings") != null) {
>>>> return; // featuremap
>>>> }
>>>>
>>>> if (!NAME_IS_PRODUCT) {
>>>> for (EReference eref : eclass.getEAllReferences()) {
>>>> if (eref.isContainer()) {
>>>> log
>>>> .debug("There are container
>>>> ereferences
>>>> present, assuming that no separate
>>>> econta iner columns
>>>> are required.");
>>>> return;
>>>> }
>>>> }
>>>> }
>>>>
>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>> properties to " + pc.getClassName());
>>>>
>>>> final Property eContainer = new Property();
>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>> Object>()); eContainer.setNodeName(eContainer.getName());
>>>> eContainer.setPropertyAccessorName
>>> (EContainerAccessor.class.g
>>>> etName());
>>>>
>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>
>>>> final Column eccColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>> sv.addColumn(checkColumnExists(pc.getTable(), eccColumn));
>>>>
>>>> final Column ecColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>> sv.addColumn(checkColumnExists(pc.getTable(), ecColumn));
>>>>
>>>> eContainer.setValue(sv);
>>>> pc.addProperty(eContainer);
>>>>
>>>> final Property ecFID = new Property();
>>>> ecFID.setName(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID);
>>>> ecFID.setMetaAttributes(new HashMap<Object, Object>());
>>>> ecFID.setNodeName(ecFID.getName());
>>>> ecFID.setPropertyAccessorName
>>> (EContainerFeatureIDAccessor.cla
>>>> ss.getName()); final SimpleValue svfid = new
>>>> SimpleValue(pc.getTable()); svfid.setTypeName("integer");
>>>>
>>>> final Column ecfColumn = new
>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>> ecfColumn));
>>>>
>>>> ecFID.setValue(svfid);
>>>> pc.addProperty(ecFID);
>>>> }
>>>>
>>>>
>>>> Anthony wrote:
>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>
>>>>>> The cause is that transient is true for ProductRegistry.products.
>>>>>> I think that this has to do with a performance issue in your case
>>>>>> (the products collection is very large). Is that correct?
>>>>> YES.
>>>>>
>>>>>
>>>>>> Otherwise setting
>>>>>> transient to false will ensure that the container is set in the
>>>>>> db. Even now if the products are read from the db through the
>>>>>> ProductRegistry.products then when loading the products their
>>>>>> econtainer should normally be set correctly. Did you try that? Or
>>>>>> do you read products independently?
>>>>> I load ProductRegistry first,
>>>>> and then I load product in another resource as I need to do
>>>>> pagination,
>>>>>
>>>>>
>>>>>> In the last case you can get the
>>>>>> container from the product.ProductRegistry.
>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>
>>>>>
>>>>>
>>>>>> So in short is it an issue for your app that the econtainer is not
>>>>>> stored separately in the econtainer fields in the db?
>>>>> In DB the econtainer field is always null.
>>>>>
>>>>> ?
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>> @build.eclipse.org:
>>>>>>>
>>>>>>>> Product.productRegistry
>>>>>>> Martin,
>>>>>>>
>>>>>>> Product.ProductRegistry :
>>>>>>>
>>>>>>> container:true
>>>>>>> containment: false
>>>>>>> resolve proxies: true
>>>>>>> required: true
>>>>>>> lower bound: 1
>>>>>>> upper bound: 1
>>>>>>> Transient : false
>>>>>>> Many : false
>>>>>>> EOpposite : products
>>>>>>>
>>>>>>> ProductRegistry.products:
>>>>>>>
>>>>>>> container:false
>>>>>>> containment: true
>>>>>>> resolve proxies: true
>>>>>>> required: false
>>>>>>> lower bound: 0
>>>>>>> upper bound: -1
>>>>>>> Transient : true
>>>>>>> Many : true
>>>>>>> EOpposite : productRegistry
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606747 is a reply to message #84235] Sun, 20 May 2007 05:01 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

OK. (Sorry for the stupid question.I have done that before.)
I will enter a bugzilla later.

Anthony


> Anthony,
> I would copy these methods also, each of them is only a few lines.
> Btw, this is just a workaround to get you going. If you enter a
> bugzilla for this then I can look at it more thoroughly for the next
> build.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> As isContained(),hasEContainerProp(),checkColumnExists() are
>> private
>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>
>> Is there another way to work around?
>>
>> Thanks.
>>
>> Anthony
>>
>>> Anthony,
>>> This part of the code did not change that much since 0.7.5. For
>>> 0.7.5 you can override the HbDataStore.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>
>>>> So I need to upgrade to 0.8.
>>>>
>>>>
>>>> Tomorrow I will try it.
>>>>
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>> field in the product but it does not do addcontainermapping for
>>>>> this type.
>>>>>
>>>>> Can you try the following:
>>>>> override the HbSessionDataStore and the addContainerMapping method
>>>>> with the method below. The only change I made is that in this
>>>>> method if a isContainer ereference is found no econtainer mapping
>>>>> is added. Also you need to replace the code NAME_IS_PRODUCT with
>>>>> something meaningfull. It is not a nice solution but it can help
>>>>> to identify how to solve this.
>>>>>
>>>>> /**
>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>> called for eclasses which do not have * am explicit feature
>>>>> which points to the container */
>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>
>>>>> // always first check if the super class should have a
>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>> addContainerMapping(pc.getSuperclass());
>>>>> }
>>>>>
>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>> if (hasEContainerProp(pc)) return;
>>>>>
>>>>> log.debug("Adding container mapping for " +
>>>>> getMappedName(pc)); // check if there are not
>>>>> alreadyecontai ner features for the eclass
>>>>>
>>>>> final EClass eclass;
>>>>> if (pc.getEntityName() != null) {
>>>>> eclass =
>>>>> getPersistenceOptions
>> ().getEClassNameStrateg
>>>>> y
>>>> (
>>>>> ).toEClass(pc.getEntityName(),
>>>>> getEPackages());
>>>>> } else {
>>>>> eclass =
>>>>> EModelResolver.instance().getEClass
(pc.getMappedClas
>>>>> s
>>>> ())
>>>>> ;
>>>>> }
>>>>>
>>>>> // DCB: Provide a way to avoid container mappings for a
>>>>> particular // class. You'd do this if, for example,
>>>>> // you never load the contained objects except through
>>>>> the containers... // or, you don't fit the use case
>>>>> // for which this was put together (i.e., the generated
>>>>> model editing // code tries to eagerly resolve the
>>>>> // container)
>>>>> if (eclass == null
>>>>> || eclass.getEAnnotation
>>>> ("http://facet.elver.org/Sk
>>>>> || ipContainerMappings") != null) {
>>>>> return; // featuremap
>>>>> }
>>>>>
>>>>> if (!NAME_IS_PRODUCT) {
>>>>> for (EReference eref : eclass.getEAllReferences())
>>>>> {
>>>>> if (eref.isContainer()) {
>>>>> log
>>>>> .debug("There are container
>>>>> ereferences
>>>>> present, assuming that no separate
>>>>> econta iner columns
>>>>> are required.");
>>>>> return;
>>>>> }
>>>>> }
>>>>> }
>>>>>
>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>> properties to " + pc.getClassName());
>>>>>
>>>>> final Property eContainer = new Property();
>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>> Object>());
>>>>> eContainer.setNodeName(eContainer.getName());
>>>>> eContainer.setPropertyAccessorName
>>>> (EContainerAccessor.class.g
>>>>> etName());
>>>>>
>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>
>>>>> final Column eccColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>> eccColumn));
>>>>>
>>>>> final Column ecColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>> ecColumn));
>>>>>
>>>>> eContainer.setValue(sv);
>>>>> pc.addProperty(eContainer);
>>>>>
>>>>> final Property ecFID = new Property();
>>>>> ecFID.setName
(HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>> ecFID.setPropertyAccessorName
>>>> (EContainerFeatureIDAccessor.cla
>>>>> ss.getName()); final SimpleValue svfid = new
>>>>> SimpleValue(pc.getTable());
>>>>> svfid.setTypeName("integer");
>>>>>
>>>>> final Column ecfColumn = new
>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>> ecfColumn));
>>>>>
>>>>> ecFID.setValue(svfid);
>>>>> pc.addProperty(ecFID);
>>>>> }
>>>>>
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>
>>>>>>> The cause is that transient is true for
>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>> performance issue in your case (the products collection is very
>>>>>>> large). Is that correct?
>>>>>> YES.
>>>>>>
>>>>>>
>>>>>>> Otherwise setting
>>>>>>> transient to false will ensure that the container is set in the
>>>>>>> db. Even now if the products are read from the db through the
>>>>>>> ProductRegistry.products then when loading the products their
>>>>>>> econtainer should normally be set correctly. Did you try that?
>>>>>>> Or do you read products independently?
>>>>>> I load ProductRegistry first,
>>>>>> and then I load product in another resource as I need to do
>>>>>> pagination,
>>>>>>
>>>>>>
>>>>>>> In the last case you can get the
>>>>>>> container from the product.ProductRegistry.
>>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>>
>>>>>>
>>>>>>
>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>> In DB the econtainer field is always null.
>>>>>>
>>>>>> ?
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>> @build.eclipse.org:
>>>>>>>>
>>>>>>>>> Product.productRegistry
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> Product.ProductRegistry :
>>>>>>>>
>>>>>>>> container:true
>>>>>>>> containment: false
>>>>>>>> resolve proxies: true
>>>>>>>> required: true
>>>>>>>> lower bound: 1
>>>>>>>> upper bound: 1
>>>>>>>> Transient : false
>>>>>>>> Many : false
>>>>>>>> EOpposite : products
>>>>>>>>
>>>>>>>> ProductRegistry.products:
>>>>>>>>
>>>>>>>> container:false
>>>>>>>> containment: true
>>>>>>>> resolve proxies: true
>>>>>>>> required: false
>>>>>>>> lower bound: 0
>>>>>>>> upper bound: -1
>>>>>>>> Transient : true
>>>>>>>> Many : true
>>>>>>>> EOpposite : productRegistry
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606748 is a reply to message #84250] Sun, 20 May 2007 05:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
No stupid question at all (I forgot myself that these were private when copy-pasting the code in the
previous post), over time I noticed that I should make more and more methods in HbDataStore
protected to facilitate customization, probably these methods are also candidates.

gr. Martin

Anthony wrote:
> Martin,
>
> OK. (Sorry for the stupid question.I have done that before.)
> I will enter a bugzilla later.
>
> Anthony
>
>
>> Anthony,
>> I would copy these methods also, each of them is only a few lines.
>> Btw, this is just a workaround to get you going. If you enter a
>> bugzilla for this then I can look at it more thoroughly for the next
>> build.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>> private
>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>
>>> Is there another way to work around?
>>>
>>> Thanks.
>>>
>>> Anthony
>>>
>>>> Anthony,
>>>> This part of the code did not change that much since 0.7.5. For
>>>> 0.7.5 you can override the HbDataStore.
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>
>>>>> So I need to upgrade to 0.8.
>>>>>
>>>>>
>>>>> Tomorrow I will try it.
>>>>>
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>> field in the product but it does not do addcontainermapping for
>>>>>> this type.
>>>>>>
>>>>>> Can you try the following:
>>>>>> override the HbSessionDataStore and the addContainerMapping method
>>>>>> with the method below. The only change I made is that in this
>>>>>> method if a isContainer ereference is found no econtainer mapping
>>>>>> is added. Also you need to replace the code NAME_IS_PRODUCT with
>>>>>> something meaningfull. It is not a nice solution but it can help
>>>>>> to identify how to solve this.
>>>>>>
>>>>>> /**
>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>> called for eclasses which do not have * am explicit feature
>>>>>> which points to the container */
>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>
>>>>>> // always first check if the super class should have a
>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>> }
>>>>>>
>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>
>>>>>> log.debug("Adding container mapping for " +
>>>>>> getMappedName(pc)); // check if there are not
>>>>>> alreadyecontai ner features for the eclass
>>>>>>
>>>>>> final EClass eclass;
>>>>>> if (pc.getEntityName() != null) {
>>>>>> eclass =
>>>>>> getPersistenceOptions
>>> ().getEClassNameStrateg
>>>>>> y
>>>>> (
>>>>>> ).toEClass(pc.getEntityName(),
>>>>>> getEPackages());
>>>>>> } else {
>>>>>> eclass =
>>>>>> EModelResolver.instance().getEClass
> (pc.getMappedClas
>>>>>> s
>>>>> ())
>>>>>> ;
>>>>>> }
>>>>>>
>>>>>> // DCB: Provide a way to avoid container mappings for a
>>>>>> particular // class. You'd do this if, for example,
>>>>>> // you never load the contained objects except through
>>>>>> the containers... // or, you don't fit the use case
>>>>>> // for which this was put together (i.e., the generated
>>>>>> model editing // code tries to eagerly resolve the
>>>>>> // container)
>>>>>> if (eclass == null
>>>>>> || eclass.getEAnnotation
>>>>> ("http://facet.elver.org/Sk
>>>>>> || ipContainerMappings") != null) {
>>>>>> return; // featuremap
>>>>>> }
>>>>>>
>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>> for (EReference eref : eclass.getEAllReferences())
>>>>>> {
>>>>>> if (eref.isContainer()) {
>>>>>> log
>>>>>> .debug("There are container
>>>>>> ereferences
>>>>>> present, assuming that no separate
>>>>>> econta iner columns
>>>>>> are required.");
>>>>>> return;
>>>>>> }
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>> properties to " + pc.getClassName());
>>>>>>
>>>>>> final Property eContainer = new Property();
>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>> Object>());
>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>> eContainer.setPropertyAccessorName
>>>>> (EContainerAccessor.class.g
>>>>>> etName());
>>>>>>
>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>
>>>>>> final Column eccColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>> eccColumn));
>>>>>>
>>>>>> final Column ecColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>> ecColumn));
>>>>>>
>>>>>> eContainer.setValue(sv);
>>>>>> pc.addProperty(eContainer);
>>>>>>
>>>>>> final Property ecFID = new Property();
>>>>>> ecFID.setName
> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>> ecFID.setPropertyAccessorName
>>>>> (EContainerFeatureIDAccessor.cla
>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>> SimpleValue(pc.getTable());
>>>>>> svfid.setTypeName("integer");
>>>>>>
>>>>>> final Column ecfColumn = new
>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>> ecfColumn));
>>>>>>
>>>>>> ecFID.setValue(svfid);
>>>>>> pc.addProperty(ecFID);
>>>>>> }
>>>>>>
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>
>>>>>>>> The cause is that transient is true for
>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>> performance issue in your case (the products collection is very
>>>>>>>> large). Is that correct?
>>>>>>> YES.
>>>>>>>
>>>>>>>
>>>>>>>> Otherwise setting
>>>>>>>> transient to false will ensure that the container is set in the
>>>>>>>> db. Even now if the products are read from the db through the
>>>>>>>> ProductRegistry.products then when loading the products their
>>>>>>>> econtainer should normally be set correctly. Did you try that?
>>>>>>>> Or do you read products independently?
>>>>>>> I load ProductRegistry first,
>>>>>>> and then I load product in another resource as I need to do
>>>>>>> pagination,
>>>>>>>
>>>>>>>
>>>>>>>> In the last case you can get the
>>>>>>>> container from the product.ProductRegistry.
>>>>>>> In fact , the product table has no ProductRegistry , it only have
>>>>>>> field EContainer , I guess they has been merged as one. Right?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>> In DB the econtainer field is always null.
>>>>>>>
>>>>>>> ?
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>> @build.eclipse.org:
>>>>>>>>>
>>>>>>>>>> Product.productRegistry
>>>>>>>>> Martin,
>>>>>>>>>
>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>
>>>>>>>>> container:true
>>>>>>>>> containment: false
>>>>>>>>> resolve proxies: true
>>>>>>>>> required: true
>>>>>>>>> lower bound: 1
>>>>>>>>> upper bound: 1
>>>>>>>>> Transient : false
>>>>>>>>> Many : false
>>>>>>>>> EOpposite : products
>>>>>>>>>
>>>>>>>>> ProductRegistry.products:
>>>>>>>>>
>>>>>>>>> container:false
>>>>>>>>> containment: true
>>>>>>>>> resolve proxies: true
>>>>>>>>> required: false
>>>>>>>>> lower bound: 0
>>>>>>>>> upper bound: -1
>>>>>>>>> Transient : true
>>>>>>>>> Many : true
>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606749 is a reply to message #84265] Sun, 20 May 2007 05:44 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

agree,'protected' would be better.

isContained() method can be copy, but it need a private member
'referers' and no method(protected or public) could return this member.


Any idea?


( rt.isContainer could be replace with rt.isContainer())



Anthony

> Hi Anthony,
> No stupid question at all (I forgot myself that these were private
> when copy-pasting the code in the previous post), over time I noticed
> that I should make more and more methods in HbDataStore protected to
> facilitate customization, probably these methods are also candidates.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> OK. (Sorry for the stupid question.I have done that before.)
>> I will enter a bugzilla later.
>>
>> Anthony
>>
>>
>>> Anthony,
>>> I would copy these methods also, each of them is only a few lines.
>>> Btw, this is just a workaround to get you going. If you enter a
>>> bugzilla for this then I can look at it more thoroughly for the next
>>> build.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>> private
>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>
>>>> Is there another way to work around?
>>>>
>>>> Thanks.
>>>>
>>>> Anthony
>>>>
>>>>> Anthony,
>>>>> This part of the code did not change that much since 0.7.5. For
>>>>> 0.7.5 you can override the HbDataStore.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>
>>>>>> So I need to upgrade to 0.8.
>>>>>>
>>>>>>
>>>>>> Tomorrow I will try it.
>>>>>>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>> field in the product but it does not do addcontainermapping for
>>>>>>> this type.
>>>>>>>
>>>>>>> Can you try the following:
>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>> method with the method below. The only change I made is that in
>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>> mapping is added. Also you need to replace the code
>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>
>>>>>>> /**
>>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>>> called for eclasses which do not have * am explicit
>>>>>>> feature which points to the container */
>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>
>>>>>>> // always first check if the super class should have a
>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>> }
>>>>>>>
>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>
>>>>>>> log.debug("Adding container mapping for " +
>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>
>>>>>>> final EClass eclass;
>>>>>>> if (pc.getEntityName() != null) {
>>>>>>> eclass =
>>>>>>> getPersistenceOptions
>>>> ().getEClassNameStrateg
>>>>>>> y
>>>>>> (
>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>> getEPackages());
>>>>>>> } else {
>>>>>>> eclass =
>>>>>>> EModelResolver.instance().getEClass
>> (pc.getMappedClas
>>>>>>> s
>>>>>> ())
>>>>>>> ;
>>>>>>> }
>>>>>>>
>>>>>>> // DCB: Provide a way to avoid container mappings for
>>>>>>> a particular // class. You'd do this if, for example,
>>>>>>> // you never load the contained objects except through
>>>>>>> the containers... // or, you don't fit the use case
>>>>>>> // for which this was put together (i.e., the
>>>>>>> generated model editing // code tries to eagerly
>>>>>>> resolve the // container)
>>>>>>> if (eclass == null
>>>>>>> || eclass.getEAnnotation
>>>>>> ("http://facet.elver.org/Sk
>>>>>>> || ipContainerMappings") != null) {
>>>>>>> return; // featuremap
>>>>>>> }
>>>>>>>
>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>> for (EReference eref :
>>>>>>> eclass.getEAllReferences())
>>>>>>> {
>>>>>>> if (eref.isContainer()) {
>>>>>>> log
>>>>>>> .debug("There are container
>>>>>>> ereferences
>>>>>>> present, assuming that no separate
>>>>>>> econta iner columns
>>>>>>> are required.");
>>>>>>> return;
>>>>>>> }
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>> properties to " + pc.getClassName());
>>>>>>>
>>>>>>> final Property eContainer = new Property();
>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>> Object>());
>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>> eContainer.setPropertyAccessorName
>>>>>> (EContainerAccessor.class.g
>>>>>>> etName());
>>>>>>>
>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>
>>>>>>> final Column eccColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> eccColumn));
>>>>>>>
>>>>>>> final Column ecColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> ecColumn));
>>>>>>>
>>>>>>> eContainer.setValue(sv);
>>>>>>> pc.addProperty(eContainer);
>>>>>>>
>>>>>>> final Property ecFID = new Property();
>>>>>>> ecFID.setName
>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>> ecFID.setPropertyAccessorName
>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>> SimpleValue(pc.getTable());
>>>>>>> svfid.setTypeName("integer");
>>>>>>>
>>>>>>> final Column ecfColumn = new
>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>> ecfColumn));
>>>>>>>
>>>>>>> ecFID.setValue(svfid);
>>>>>>> pc.addProperty(ecFID);
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>
>>>>>>>>> The cause is that transient is true for
>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>> very large). Is that correct?
>>>>>>>> YES.
>>>>>>>>
>>>>>>>>
>>>>>>>>> Otherwise setting
>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>> the db. Even now if the products are read from the db through
>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>> their econtainer should normally be set correctly. Did you try
>>>>>>>>> that? Or do you read products independently?
>>>>>>>> I load ProductRegistry first,
>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>> pagination,
>>>>>>>>
>>>>>>>>
>>>>>>>>> In the last case you can get the
>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>> Right?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>
>>>>>>>> ?
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>
>>>>>>>>>>> Product.productRegistry
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>
>>>>>>>>>> container:true
>>>>>>>>>> containment: false
>>>>>>>>>> resolve proxies: true
>>>>>>>>>> required: true
>>>>>>>>>> lower bound: 1
>>>>>>>>>> upper bound: 1
>>>>>>>>>> Transient : false
>>>>>>>>>> Many : false
>>>>>>>>>> EOpposite : products
>>>>>>>>>>
>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>
>>>>>>>>>> container:false
>>>>>>>>>> containment: true
>>>>>>>>>> resolve proxies: true
>>>>>>>>>> required: false
>>>>>>>>>> lower bound: 0
>>>>>>>>>> upper bound: -1
>>>>>>>>>> Transient : true
>>>>>>>>>> Many : true
>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606750 is a reply to message #84280] Sun, 20 May 2007 06:13 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
The latest release of Teneo should have a getReferers method.

gr. Martin

Anthony wrote:
> Martin,
>
> agree,'protected' would be better.
>
> isContained() method can be copy, but it need a private member
> 'referers' and no method(protected or public) could return this member.
>
>
> Any idea?
>
>
> ( rt.isContainer could be replace with rt.isContainer())
>
>
>
> Anthony
>
>> Hi Anthony,
>> No stupid question at all (I forgot myself that these were private
>> when copy-pasting the code in the previous post), over time I noticed
>> that I should make more and more methods in HbDataStore protected to
>> facilitate customization, probably these methods are also candidates.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> OK. (Sorry for the stupid question.I have done that before.)
>>> I will enter a bugzilla later.
>>>
>>> Anthony
>>>
>>>
>>>> Anthony,
>>>> I would copy these methods also, each of them is only a few lines.
>>>> Btw, this is just a workaround to get you going. If you enter a
>>>> bugzilla for this then I can look at it more thoroughly for the next
>>>> build.
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>> private
>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>
>>>>> Is there another way to work around?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Anthony
>>>>>
>>>>>> Anthony,
>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin,
>>>>>>>
>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>
>>>>>>> So I need to upgrade to 0.8.
>>>>>>>
>>>>>>>
>>>>>>> Tomorrow I will try it.
>>>>>>>
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>
>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>> field in the product but it does not do addcontainermapping for
>>>>>>>> this type.
>>>>>>>>
>>>>>>>> Can you try the following:
>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>> method with the method below. The only change I made is that in
>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>
>>>>>>>> /**
>>>>>>>> * Adds a econtainer mapping to the class mapping, is only
>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>> feature which points to the container */
>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>
>>>>>>>> // always first check if the super class should have a
>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>
>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>
>>>>>>>> final EClass eclass;
>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>> eclass =
>>>>>>>> getPersistenceOptions
>>>>> ().getEClassNameStrateg
>>>>>>>> y
>>>>>>> (
>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>> getEPackages());
>>>>>>>> } else {
>>>>>>>> eclass =
>>>>>>>> EModelResolver.instance().getEClass
>>> (pc.getMappedClas
>>>>>>>> s
>>>>>>> ())
>>>>>>>> ;
>>>>>>>> }
>>>>>>>>
>>>>>>>> // DCB: Provide a way to avoid container mappings for
>>>>>>>> a particular // class. You'd do this if, for example,
>>>>>>>> // you never load the contained objects except through
>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>> // for which this was put together (i.e., the
>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>> resolve the // container)
>>>>>>>> if (eclass == null
>>>>>>>> || eclass.getEAnnotation
>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>> return; // featuremap
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>> for (EReference eref :
>>>>>>>> eclass.getEAllReferences())
>>>>>>>> {
>>>>>>>> if (eref.isContainer()) {
>>>>>>>> log
>>>>>>>> .debug("There are container
>>>>>>>> ereferences
>>>>>>>> present, assuming that no separate
>>>>>>>> econta iner columns
>>>>>>>> are required.");
>>>>>>>> return;
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>
>>>>>>>> final Property eContainer = new Property();
>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>> Object>());
>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>> (EContainerAccessor.class.g
>>>>>>>> etName());
>>>>>>>>
>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable());
>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>
>>>>>>>> final Column eccColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> eccColumn));
>>>>>>>>
>>>>>>>> final Column ecColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> ecColumn));
>>>>>>>>
>>>>>>>> eContainer.setValue(sv);
>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>
>>>>>>>> final Property ecFID = new Property();
>>>>>>>> ecFID.setName
>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>
>>>>>>>> final Column ecfColumn = new
>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>> ecfColumn));
>>>>>>>>
>>>>>>>> ecFID.setValue(svfid);
>>>>>>>> pc.addProperty(ecFID);
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>
>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>> very large). Is that correct?
>>>>>>>>> YES.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Otherwise setting
>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>> the db. Even now if the products are read from the db through
>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>> their econtainer should normally be set correctly. Did you try
>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>> I load ProductRegistry first,
>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>> pagination,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> In the last case you can get the
>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>> Right?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> So in short is it an issue for your app that the econtainer is
>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>
>>>>>>>>> ?
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> gr. Martin
>>>>>>>>>>
>>>>>>>>>> Anthony wrote:
>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>
>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>> Martin,
>>>>>>>>>>>
>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>
>>>>>>>>>>> container:true
>>>>>>>>>>> containment: false
>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>> required: true
>>>>>>>>>>> lower bound: 1
>>>>>>>>>>> upper bound: 1
>>>>>>>>>>> Transient : false
>>>>>>>>>>> Many : false
>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>
>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>
>>>>>>>>>>> container:false
>>>>>>>>>>> containment: true
>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>> required: false
>>>>>>>>>>> lower bound: 0
>>>>>>>>>>> upper bound: -1
>>>>>>>>>>> Transient : true
>>>>>>>>>>> Many : true
>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>>
>>>>>>>>>>> Anthony
>>>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606751 is a reply to message #84295] Sun, 20 May 2007 07:59 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

After I use customed HbSessionDataStore , I got en exception said
org.hibernate.MappingException: Unknown entity: SND(my top model class)

BTW, where to input bugzilla and when will next release be ready?


Anthony


> Anthony,
> The latest release of Teneo should have a getReferers method.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> agree,'protected' would be better.
>>
>> isContained() method can be copy, but it need a private member
>> 'referers' and no method(protected or public) could return this
member.
>>
>>
>> Any idea?
>>
>>
>> ( rt.isContainer could be replace with rt.isContainer())
>>
>>
>>
>> Anthony
>>
>>> Hi Anthony,
>>> No stupid question at all (I forgot myself that these were private
>>> when copy-pasting the code in the previous post), over time I
noticed
>>> that I should make more and more methods in HbDataStore protected to
>>> facilitate customization, probably these methods are also
candidates.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>> I will enter a bugzilla later.
>>>>
>>>> Anthony
>>>>
>>>>
>>>>> Anthony,
>>>>> I would copy these methods also, each of them is only a few lines.
>>>>> Btw, this is just a workaround to get you going. If you enter a
>>>>> bugzilla for this then I can look at it more thoroughly for the
next
>>>>> build.
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>> private
>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>
>>>>>> Is there another way to work around?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>> Anthony,
>>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>>
>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>
>>>>>>>>
>>>>>>>> Tomorrow I will try it.
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>
>>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>>> field in the product but it does not do addcontainermapping
for
>>>>>>>>> this type.
>>>>>>>>>
>>>>>>>>> Can you try the following:
>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>> method with the method below. The only change I made is that
in
>>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>>
>>>>>>>>> /**
>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
only
>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>> feature which points to the container */
>>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>>
>>>>>>>>> // always first check if the super class should have
a
>>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>
>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>
>>>>>>>>> final EClass eclass;
>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>> eclass =
>>>>>>>>> getPersistenceOptions
>>>>>> ().getEClassNameStrateg
>>>>>>>>> y
>>>>>>>> (
>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>> getEPackages());
>>>>>>>>> } else {
>>>>>>>>> eclass =
>>>>>>>>> EModelResolver.instance().getEClass
>>>> (pc.getMappedClas
>>>>>>>>> s
>>>>>>>> ())
>>>>>>>>> ;
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> // DCB: Provide a way to avoid container mappings
for
>>>>>>>>> a particular // class. You'd do this if, for
example,
>>>>>>>>> // you never load the contained objects except
through
>>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>>> // for which this was put together (i.e., the
>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>> resolve the // container)
>>>>>>>>> if (eclass == null
>>>>>>>>> || eclass.getEAnnotation
>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>> return; // featuremap
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>> for (EReference eref :
>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>> {
>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>> log
>>>>>>>>> .debug("There are container
>>>>>>>>> ereferences
>>>>>>>>> present, assuming that no
separate
>>>>>>>>> econta iner columns
>>>>>>>>> are required.");
>>>>>>>>> return;
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>>
>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>> Object>());
>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>> etName());
>>>>>>>>>
>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
());
>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>
>>>>>>>>> final Column eccColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> eccColumn));
>>>>>>>>>
>>>>>>>>> final Column ecColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> ecColumn));
>>>>>>>>>
>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>
>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>> ecFID.setName
>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>
>>>>>>>>> final Column ecfColumn = new
>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>> ecfColumn));
>>>>>>>>>
>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>
>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>>> very large). Is that correct?
>>>>>>>>>> YES.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Otherwise setting
>>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>>> the db. Even now if the products are read from the db
through
>>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>>> their econtainer should normally be set correctly. Did you
try
>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>> pagination,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>>> Right?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> So in short is it an issue for your app that the econtainer
is
>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>
>>>>>>>>>> ?
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> gr. Martin
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>> Martin,
>>>>>>>>>>>>
>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>
>>>>>>>>>>>> container:true
>>>>>>>>>>>> containment: false
>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>> required: true
>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>> Transient : false
>>>>>>>>>>>> Many : false
>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>
>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>
>>>>>>>>>>>> container:false
>>>>>>>>>>>> containment: true
>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>> required: false
>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>> Transient : true
>>>>>>>>>>>> Many : true
>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>
>>>>>>>>>>>> Regards,
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606752 is a reply to message #84310] Sun, 20 May 2007 08:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Can you post the complete stacktrace?

Which version of Teneo are you using?

Bugzilla can be entered here:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT

I had hoped to do a next release this week but it will be a few weeks later.

gr. Martin

Anthony wrote:
> Martin,
>
> After I use customed HbSessionDataStore , I got en exception said
> org.hibernate.MappingException: Unknown entity: SND(my top model class)
>
> BTW, where to input bugzilla and when will next release be ready?
>
>
> Anthony
>
>
>> Anthony,
>> The latest release of Teneo should have a getReferers method.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> agree,'protected' would be better.
>>>
>>> isContained() method can be copy, but it need a private member
>>> 'referers' and no method(protected or public) could return this
> member.
>>>
>>> Any idea?
>>>
>>>
>>> ( rt.isContainer could be replace with rt.isContainer())
>>>
>>>
>>>
>>> Anthony
>>>
>>>> Hi Anthony,
>>>> No stupid question at all (I forgot myself that these were private
>>>> when copy-pasting the code in the previous post), over time I
> noticed
>>>> that I should make more and more methods in HbDataStore protected to
>>>> facilitate customization, probably these methods are also
> candidates.
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>> I will enter a bugzilla later.
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>> Anthony,
>>>>>> I would copy these methods also, each of them is only a few lines.
>>>>>> Btw, this is just a workaround to get you going. If you enter a
>>>>>> bugzilla for this then I can look at it more thoroughly for the
> next
>>>>>> build.
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Martin,
>>>>>>>
>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>> private
>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>
>>>>>>> Is there another way to work around?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>>> Anthony,
>>>>>>>> This part of the code did not change that much since 0.7.5. For
>>>>>>>> 0.7.5 you can override the HbDataStore.
>>>>>>>>
>>>>>>>> gr. Martin
>>>>>>>>
>>>>>>>> Anthony wrote:
>>>>>>>>> Martin,
>>>>>>>>>
>>>>>>>>> At this time I am using Teneo 0.7.5, it has only HbDataStore.
>>>>>>>>>
>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Anthony
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> Okay, one thing I find strange is that there is an econtainer
>>>>>>>>>> field in the product but it does not do addcontainermapping
> for
>>>>>>>>>> this type.
>>>>>>>>>>
>>>>>>>>>> Can you try the following:
>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>> method with the method below. The only change I made is that
> in
>>>>>>>>>> this method if a isContainer ereference is found no econtainer
>>>>>>>>>> mapping is added. Also you need to replace the code
>>>>>>>>>> NAME_IS_PRODUCT with something meaningfull. It is not a nice
>>>>>>>>>> solution but it can help to identify how to solve this.
>>>>>>>>>>
>>>>>>>>>> /**
>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
> only
>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>> feature which points to the container */
>>>>>>>>>> protected void addContainerMapping(PersistentClass pc) {
>>>>>>>>>>
>>>>>>>>>> // always first check if the super class should have
> a
>>>>>>>>>> container mapping if (pc.getSuperclass() != null) {
>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>
>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>
>>>>>>>>>> final EClass eclass;
>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>> eclass =
>>>>>>>>>> getPersistenceOptions
>>>>>>> ().getEClassNameStrateg
>>>>>>>>>> y
>>>>>>>>> (
>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>> getEPackages());
>>>>>>>>>> } else {
>>>>>>>>>> eclass =
>>>>>>>>>> EModelResolver.instance().getEClass
>>>>> (pc.getMappedClas
>>>>>>>>>> s
>>>>>>>>> ())
>>>>>>>>>> ;
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> // DCB: Provide a way to avoid container mappings
> for
>>>>>>>>>> a particular // class. You'd do this if, for
> example,
>>>>>>>>>> // you never load the contained objects except
> through
>>>>>>>>>> the containers... // or, you don't fit the use case
>>>>>>>>>> // for which this was put together (i.e., the
>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>> resolve the // container)
>>>>>>>>>> if (eclass == null
>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>> return; // featuremap
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>> for (EReference eref :
>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>> {
>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>> log
>>>>>>>>>> .debug("There are container
>>>>>>>>>> ereferences
>>>>>>>>>> present, assuming that no
> separate
>>>>>>>>>> econta iner columns
>>>>>>>>>> are required.");
>>>>>>>>>> return;
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> log.debug("Adding eContainer and econtainerfeatureid
>>>>>>>>>> properties to " + pc.getClassName());
>>>>>>>>>>
>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER);
>>>>>>>>>> eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>> Object>());
>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>> etName());
>>>>>>>>>>
>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
> ());
>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>>
>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> eccColumn));
>>>>>>>>>>
>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> ecColumn));
>>>>>>>>>>
>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>
>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>> ecFID.setName
>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>
>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>> ecfColumn));
>>>>>>>>>>
>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony wrote:
>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>
>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with a
>>>>>>>>>>>> performance issue in your case (the products collection is
>>>>>>>>>>>> very large). Is that correct?
>>>>>>>>>>> YES.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>> transient to false will ensure that the container is set in
>>>>>>>>>>>> the db. Even now if the products are read from the db
> through
>>>>>>>>>>>> the ProductRegistry.products then when loading the products
>>>>>>>>>>>> their econtainer should normally be set correctly. Did you
> try
>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>> pagination,
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>> In fact , the product table has no ProductRegistry , it only
>>>>>>>>>>> have field EContainer , I guess they has been merged as one.
>>>>>>>>>>> Right?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> So in short is it an issue for your app that the econtainer
> is
>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>
>>>>>>>>>>> ?
>>>>>>>>>>>
>>>>>>>>>>> Anthony
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>
>>>>>>>>>>>>> container:true
>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>> required: true
>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>
>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>
>>>>>>>>>>>>> container:false
>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>> required: false
>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>
>>
>


--

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: [Teneo] eContainer has not been saved? [message #606753 is a reply to message #84327] Sun, 20 May 2007 10:36 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Now I am using 0.8.

Just a few minutes ago , I try it again(after clear schema and mapping
file) and it's OK .

It seems that the previous exception was caused by other reason.

I will input a bugzilla.

Thanks.

Anthony




> Anthony,
> Can you post the complete stacktrace?
>
> Which version of Teneo are you using?
>
> Bugzilla can be entered here:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT
>
> I had hoped to do a next release this week but it will be a few weeks
> later.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> After I use customed HbSessionDataStore , I got en exception said
>> org.hibernate.MappingException: Unknown entity: SND(my top model
>> class)
>>
>> BTW, where to input bugzilla and when will next release be ready?
>>
>>
>> Anthony
>>
>>
>>> Anthony,
>>> The latest release of Teneo should have a getReferers method.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> agree,'protected' would be better.
>>>>
>>>> isContained() method can be copy, but it need a private member
>>>> 'referers' and no method(protected or public) could return this
>> member.
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> ( rt.isContainer could be replace with rt.isContainer())
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>> Hi Anthony,
>>>>> No stupid question at all (I forgot myself that these were private
>>>>> when copy-pasting the code in the previous post), over time I
>> noticed
>>>>> that I should make more and more methods in HbDataStore protected
>>>>> to facilitate customization, probably these methods are also
>> candidates.
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>>> I will enter a bugzilla later.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>> I would copy these methods also, each of them is only a few
>>>>>>> lines. Btw, this is just a workaround to get you going. If you
>>>>>>> enter a bugzilla for this then I can look at it more thoroughly
>>>>>>> for the
>> next
>>>>>>> build.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>>> private
>>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>>
>>>>>>>> Is there another way to work around?
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>> This part of the code did not change that much since 0.7.5.
>>>>>>>>> For 0.7.5 you can override the HbDataStore.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> At this time I am using Teneo 0.7.5, it has only
>>>>>>>>>> HbDataStore.
>>>>>>>>>>
>>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Okay, one thing I find strange is that there is an
>>>>>>>>>>> econtainer field in the product but it does not do
>>>>>>>>>>> addcontainermapping
>> for
>>>>>>>>>>> this type.
>>>>>>>>>>>
>>>>>>>>>>> Can you try the following:
>>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>>> method with the method below. The only change I made is that
>> in
>>>>>>>>>>> this method if a isContainer ereference is found no
>>>>>>>>>>> econtainer mapping is added. Also you need to replace the
>>>>>>>>>>> code NAME_IS_PRODUCT with something meaningfull. It is not a
>>>>>>>>>>> nice solution but it can help to identify how to solve this.
>>>>>>>>>>>
>>>>>>>>>>> /**
>>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
>> only
>>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>>> feature which points to the container */
>>>>>>>>>>> protected void addContainerMapping(PersistentClass pc)
>>>>>>>>>>> {
>>>>>>>>>>>
>>>>>>>>>>> // always first check if the super class should
>>>>>>>>>>> have
>> a
>>>>>>>>>>> container mapping if (pc.getSuperclass() != null)
>>>>>>>>>>> {
>>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>>
>>>>>>>>>>> final EClass eclass;
>>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>>> eclass =
>>>>>>>>>>> getPersistenceOptions
>>>>>>>> ().getEClassNameStrateg
>>>>>>>>>>> y
>>>>>>>>>> (
>>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>>> getEPackages());
>>>>>>>>>>> } else {
>>>>>>>>>>> eclass =
>>>>>>>>>>> EModelResolver.instance().getEClass
>>>>>> (pc.getMappedClas
>>>>>>>>>>> s
>>>>>>>>>> ())
>>>>>>>>>>> ;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> // DCB: Provide a way to avoid container mappings
>> for
>>>>>>>>>>> a particular // class. You'd do this if, for
>> example,
>>>>>>>>>>> // you never load the contained objects except
>> through
>>>>>>>>>>> the containers... // or, you don't fit the use
>>>>>>>>>>> case // for which this was put together (i.e., the
>>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>>> resolve the // container)
>>>>>>>>>>> if (eclass == null
>>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>>> return; // featuremap
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>>> for (EReference eref :
>>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>>> {
>>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>>> log
>>>>>>>>>>> .debug("There are container
>>>>>>>>>>> ereferences
>>>>>>>>>>> present, assuming that no
>> separate
>>>>>>>>>>> econta iner columns
>>>>>>>>>>> are required.");
>>>>>>>>>>> return;
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding eContainer and
>>>>>>>>>>> econtainerfeatureid properties to " +
>>>>>>>>>>> pc.getClassName());
>>>>>>>>>>>
>>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>>> eContainer.setName(HbConstants.PROPERTY_ECONTAINER)
>>>>>>>>>>> ; eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>());
>>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>>> etName());
>>>>>>>>>>>
>>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
>> ());
>>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName());
>>>>>>>>>>>
>>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> eccColumn));
>>>>>>>>>>>
>>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecColumn));
>>>>>>>>>>>
>>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>>
>>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>>> ecFID.setName
>>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>>
>>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecfColumn));
>>>>>>>>>>>
>>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with
>>>>>>>>>>>>> a performance issue in your case (the products collection
>>>>>>>>>>>>> is very large). Is that correct?
>>>>>>>>>>>> YES.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>>> transient to false will ensure that the container is set
>>>>>>>>>>>>> in the db. Even now if the products are read from the db
>> through
>>>>>>>>>>>>> the ProductRegistry.products then when loading the
>>>>>>>>>>>>> products their econtainer should normally be set
>>>>>>>>>>>>> correctly. Did you
>> try
>>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>>> pagination,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>>> In fact , the product table has no ProductRegistry , it
>>>>>>>>>>>> only have field EContainer , I guess they has been merged
>>>>>>>>>>>> as one. Right?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> So in short is it an issue for your app that the
>>>>>>>>>>>>> econtainer
>> is
>>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>>
>>>>>>>>>>>> ?
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:true
>>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: true
>>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:false
>>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: false
>>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>>
>>>
>>
>
>
Re: [Teneo] eContainer has not been saved? [message #606754 is a reply to message #84327] Sun, 20 May 2007 10:57 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin :

bug# is 187984 .



Anthony

> Anthony,
> Can you post the complete stacktrace?
>
> Which version of Teneo are you using?
>
> Bugzilla can be entered here:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT
>
> I had hoped to do a next release this week but it will be a few weeks
> later.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> After I use customed HbSessionDataStore , I got en exception said
>> org.hibernate.MappingException: Unknown entity: SND(my top model
>> class)
>>
>> BTW, where to input bugzilla and when will next release be ready?
>>
>>
>> Anthony
>>
>>
>>> Anthony,
>>> The latest release of Teneo should have a getReferers method.
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> agree,'protected' would be better.
>>>>
>>>> isContained() method can be copy, but it need a private member
>>>> 'referers' and no method(protected or public) could return this
>> member.
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> ( rt.isContainer could be replace with rt.isContainer())
>>>>
>>>>
>>>>
>>>> Anthony
>>>>
>>>>> Hi Anthony,
>>>>> No stupid question at all (I forgot myself that these were private
>>>>> when copy-pasting the code in the previous post), over time I
>> noticed
>>>>> that I should make more and more methods in HbDataStore protected
>>>>> to facilitate customization, probably these methods are also
>> candidates.
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Martin,
>>>>>>
>>>>>> OK. (Sorry for the stupid question.I have done that before.)
>>>>>> I will enter a bugzilla later.
>>>>>>
>>>>>> Anthony
>>>>>>
>>>>>>
>>>>>>> Anthony,
>>>>>>> I would copy these methods also, each of them is only a few
>>>>>>> lines. Btw, this is just a workaround to get you going. If you
>>>>>>> enter a bugzilla for this then I can look at it more thoroughly
>>>>>>> for the
>> next
>>>>>>> build.
>>>>>>>
>>>>>>> gr. Martin
>>>>>>>
>>>>>>> Anthony wrote:
>>>>>>>> Martin,
>>>>>>>>
>>>>>>>> As isContained(),hasEContainerProp(),checkColumnExists() are
>>>>>>>> private
>>>>>>>> method,HbDataStore's addContainerMapping() cannot be overrided.
>>>>>>>>
>>>>>>>> Is there another way to work around?
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>> Anthony
>>>>>>>>
>>>>>>>>> Anthony,
>>>>>>>>> This part of the code did not change that much since 0.7.5.
>>>>>>>>> For 0.7.5 you can override the HbDataStore.
>>>>>>>>>
>>>>>>>>> gr. Martin
>>>>>>>>>
>>>>>>>>> Anthony wrote:
>>>>>>>>>> Martin,
>>>>>>>>>>
>>>>>>>>>> At this time I am using Teneo 0.7.5, it has only
>>>>>>>>>> HbDataStore.
>>>>>>>>>>
>>>>>>>>>> So I need to upgrade to 0.8.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Tomorrow I will try it.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Anthony
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> Okay, one thing I find strange is that there is an
>>>>>>>>>>> econtainer field in the product but it does not do
>>>>>>>>>>> addcontainermapping
>> for
>>>>>>>>>>> this type.
>>>>>>>>>>>
>>>>>>>>>>> Can you try the following:
>>>>>>>>>>> override the HbSessionDataStore and the addContainerMapping
>>>>>>>>>>> method with the method below. The only change I made is that
>> in
>>>>>>>>>>> this method if a isContainer ereference is found no
>>>>>>>>>>> econtainer mapping is added. Also you need to replace the
>>>>>>>>>>> code NAME_IS_PRODUCT with something meaningfull. It is not a
>>>>>>>>>>> nice solution but it can help to identify how to solve this.
>>>>>>>>>>>
>>>>>>>>>>> /**
>>>>>>>>>>> * Adds a econtainer mapping to the class mapping, is
>> only
>>>>>>>>>>> called for eclasses which do not have * am explicit
>>>>>>>>>>> feature which points to the container */
>>>>>>>>>>> protected void addContainerMapping(PersistentClass pc)
>>>>>>>>>>> {
>>>>>>>>>>>
>>>>>>>>>>> // always first check if the super class should
>>>>>>>>>>> have
>> a
>>>>>>>>>>> container mapping if (pc.getSuperclass() != null)
>>>>>>>>>>> {
>>>>>>>>>>> addContainerMapping(pc.getSuperclass());
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!isContained(pc) && !NAME_IS_PRODUCT) return;
>>>>>>>>>>> if (hasEContainerProp(pc)) return;
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding container mapping for " +
>>>>>>>>>>> getMappedName(pc)); // check if there are not
>>>>>>>>>>> alreadyecontai ner features for the eclass
>>>>>>>>>>>
>>>>>>>>>>> final EClass eclass;
>>>>>>>>>>> if (pc.getEntityName() != null) {
>>>>>>>>>>> eclass =
>>>>>>>>>>> getPersistenceOptions
>>>>>>>> ().getEClassNameStrateg
>>>>>>>>>>> y
>>>>>>>>>> (
>>>>>>>>>>> ).toEClass(pc.getEntityName(),
>>>>>>>>>>> getEPackages());
>>>>>>>>>>> } else {
>>>>>>>>>>> eclass =
>>>>>>>>>>> EModelResolver.instance().getEClass
>>>>>> (pc.getMappedClas
>>>>>>>>>>> s
>>>>>>>>>> ())
>>>>>>>>>>> ;
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> // DCB: Provide a way to avoid container mappings
>> for
>>>>>>>>>>> a particular // class. You'd do this if, for
>> example,
>>>>>>>>>>> // you never load the contained objects except
>> through
>>>>>>>>>>> the containers... // or, you don't fit the use
>>>>>>>>>>> case // for which this was put together (i.e., the
>>>>>>>>>>> generated model editing // code tries to eagerly
>>>>>>>>>>> resolve the // container)
>>>>>>>>>>> if (eclass == null
>>>>>>>>>>> || eclass.getEAnnotation
>>>>>>>>>> ("http://facet.elver.org/Sk
>>>>>>>>>>> || ipContainerMappings") != null) {
>>>>>>>>>>> return; // featuremap
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> if (!NAME_IS_PRODUCT) {
>>>>>>>>>>> for (EReference eref :
>>>>>>>>>>> eclass.getEAllReferences())
>>>>>>>>>>> {
>>>>>>>>>>> if (eref.isContainer()) {
>>>>>>>>>>> log
>>>>>>>>>>> .debug("There are container
>>>>>>>>>>> ereferences
>>>>>>>>>>> present, assuming that no
>> separate
>>>>>>>>>>> econta iner columns
>>>>>>>>>>> are required.");
>>>>>>>>>>> return;
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>> log.debug("Adding eContainer and
>>>>>>>>>>> econtainerfeatureid properties to " +
>>>>>>>>>>> pc.getClassName());
>>>>>>>>>>>
>>>>>>>>>>> final Property eContainer = new Property();
>>>>>>>>>>> eContainer.setName
(HbConstants.PROPERTY_ECONTAINER)
>>>>>>>>>>> ; eContainer.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>());
>>>>>>>>>>> eContainer.setNodeName(eContainer.getName());
>>>>>>>>>>> eContainer.setPropertyAccessorName
>>>>>>>>>> (EContainerAccessor.class.g
>>>>>>>>>>> etName());
>>>>>>>>>>>
>>>>>>>>>>> final SimpleValue sv = new SimpleValue(pc.getTable
>> ());
>>>>>>>>>>> sv.setTypeName(EContainerUserType.class.getName
());
>>>>>>>>>>>
>>>>>>>>>>> final Column eccColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_CLASS);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> eccColumn));
>>>>>>>>>>>
>>>>>>>>>>> final Column ecColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER);
>>>>>>>>>>> sv.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecColumn));
>>>>>>>>>>>
>>>>>>>>>>> eContainer.setValue(sv);
>>>>>>>>>>> pc.addProperty(eContainer);
>>>>>>>>>>>
>>>>>>>>>>> final Property ecFID = new Property();
>>>>>>>>>>> ecFID.setName
>>>>>> (HbConstants.PROPERTY_ECONTAINER_FEATURE_ID)
>>>>>>>>>>> ; ecFID.setMetaAttributes(new HashMap<Object,
>>>>>>>>>>> Object>()); ecFID.setNodeName(ecFID.getName());
>>>>>>>>>>> ecFID.setPropertyAccessorName
>>>>>>>>>> (EContainerFeatureIDAccessor.cla
>>>>>>>>>>> ss.getName()); final SimpleValue svfid = new
>>>>>>>>>>> SimpleValue(pc.getTable());
>>>>>>>>>>> svfid.setTypeName("integer");
>>>>>>>>>>>
>>>>>>>>>>> final Column ecfColumn = new
>>>>>>>>>>> Column(HbConstants.COLUMN_ECONTAINER_FEATUREID);
>>>>>>>>>>> svfid.addColumn(checkColumnExists(pc.getTable(),
>>>>>>>>>>> ecfColumn));
>>>>>>>>>>>
>>>>>>>>>>> ecFID.setValue(svfid);
>>>>>>>>>>> pc.addProperty(ecFID);
>>>>>>>>>>> }
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in
>>>>>>>>>>>> news:f2ml6i$j5i$1@build.eclipse.org:
>>>>>>>>>>>>
>>>>>>>>>>>>> The cause is that transient is true for
>>>>>>>>>>>>> ProductRegistry.products. I think that this has to do with
>>>>>>>>>>>>> a performance issue in your case (the products collection
>>>>>>>>>>>>> is very large). Is that correct?
>>>>>>>>>>>> YES.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> Otherwise setting
>>>>>>>>>>>>> transient to false will ensure that the container is set
>>>>>>>>>>>>> in the db. Even now if the products are read from the db
>> through
>>>>>>>>>>>>> the ProductRegistry.products then when loading the
>>>>>>>>>>>>> products their econtainer should normally be set
>>>>>>>>>>>>> correctly. Did you
>> try
>>>>>>>>>>>>> that? Or do you read products independently?
>>>>>>>>>>>> I load ProductRegistry first,
>>>>>>>>>>>> and then I load product in another resource as I need to do
>>>>>>>>>>>> pagination,
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> In the last case you can get the
>>>>>>>>>>>>> container from the product.ProductRegistry.
>>>>>>>>>>>> In fact , the product table has no ProductRegistry , it
>>>>>>>>>>>> only have field EContainer , I guess they has been merged
>>>>>>>>>>>> as one. Right?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> So in short is it an issue for your app that the
>>>>>>>>>>>>> econtainer
>> is
>>>>>>>>>>>>> not stored separately in the econtainer fields in the db?
>>>>>>>>>>>> In DB the econtainer field is always null.
>>>>>>>>>>>>
>>>>>>>>>>>> ?
>>>>>>>>>>>>
>>>>>>>>>>>> Anthony
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> gr. Martin
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anthony wrote:
>>>>>>>>>>>>>> Martin Taal <mtaal@elver.org> wrote in news:f2kh1h$pth$1
>>>>>>>>>>>>>> @build.eclipse.org:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Product.productRegistry
>>>>>>>>>>>>>> Martin,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Product.ProductRegistry :
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:true
>>>>>>>>>>>>>> containment: false
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: true
>>>>>>>>>>>>>> lower bound: 1
>>>>>>>>>>>>>> upper bound: 1
>>>>>>>>>>>>>> Transient : false
>>>>>>>>>>>>>> Many : false
>>>>>>>>>>>>>> EOpposite : products
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ProductRegistry.products:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> container:false
>>>>>>>>>>>>>> containment: true
>>>>>>>>>>>>>> resolve proxies: true
>>>>>>>>>>>>>> required: false
>>>>>>>>>>>>>> lower bound: 0
>>>>>>>>>>>>>> upper bound: -1
>>>>>>>>>>>>>> Transient : true
>>>>>>>>>>>>>> Many : true
>>>>>>>>>>>>>> EOpposite : productRegistry
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Anthony
>>>>>>>>>>>>>>
>>>
>>
>
>
Previous Topic:[Teneo] eContainer saving
Next Topic:[Teneo+Hibernate]Help! A hibernate mapping question
Goto Forum:
  


Current Time: Thu Mar 28 09:42:32 GMT 2024

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

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

Back to the top