Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo+Hibernate]Help! A hibernate mapping question
[Teneo+Hibernate]Help! A hibernate mapping question [message #84377] Tue, 22 May 2007 03:37 Go to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Hi,

I have several classes in a EMF model and these classes will be mapped
into ONE table . How to write the mapping file to only let one class to
insert/update/delete the table record and the others just mapped to some
fields?

Thanks in advance!


Anthony
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #84410 is a reply to message #84377] Tue, 22 May 2007 07:27 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
I think you mean embedded but to be sure can you give a small example of what you want to achieve?

gr. Martin

Anthony wrote:
> Hi,
>
> I have several classes in a EMF model and these classes will be mapped
> into ONE table . How to write the mapping file to only let one class to
> insert/update/delete the table record and the others just mapped to some
> fields?
>
> Thanks in advance!
>
>
> 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+Hibernate]Help! A hibernate mapping question [message #84440 is a reply to message #84410] Tue, 22 May 2007 08:57 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Thank you for help.

I just learn to write my mapping file.

It seems that when a new persistable object was saved
a new record will be inserted into its mapped table.

In my case, the sample structure of my EMF model list below:

Model
|____Network
|
|____OptimizedResult


There is a table called T_Model which will store all the attribute in

Model,Netwrok and OptimizedResult.

So I cannot map 3 classes into T_Model.

But I am not sure if it is possible to map into DB View.


Regards,

Anthony



> Hi Anthony,
> I think you mean embedded but to be sure can you give a small example
> of what you want to achieve?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> I have several classes in a EMF model and these classes will be
>> mapped
>> into ONE table . How to write the mapping file to only let one class
>> to insert/update/delete the table record and the others just mapped
>> to some fields?
>>
>> Thanks in advance!
>>
>>
>> Anthony
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #84453 is a reply to message #84440] Tue, 22 May 2007 09:09 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Model refers to one instance of Network and one instance of OptimizedResult and you want the
features of Network and OptimizedResult to be mapped to the same table as Model. When a Model is
saved also the Network and OptimizedResult are saved.
Is this what you want?

gr. Martin

Anthony wrote:
> Martin,
>
> Thank you for help.
>
> I just learn to write my mapping file.
>
> It seems that when a new persistable object was saved
> a new record will be inserted into its mapped table.
>
> In my case, the sample structure of my EMF model list below:
>
> Model
> |____Network
> |
> |____OptimizedResult
>
>
> There is a table called T_Model which will store all the attribute in
>
> Model,Netwrok and OptimizedResult.
>
> So I cannot map 3 classes into T_Model.
>
> But I am not sure if it is possible to map into DB View.
>
>
> Regards,
>
> Anthony
>
>
>
>> Hi Anthony,
>> I think you mean embedded but to be sure can you give a small example
>> of what you want to achieve?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I have several classes in a EMF model and these classes will be
>>> mapped
>>> into ONE table . How to write the mapping file to only let one class
>>> to insert/update/delete the table record and the others just mapped
>>> to some fields?
>>>
>>> Thanks in advance!
>>>
>>>
>>> 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+Hibernate]Help! A hibernate mapping question [message #84465 is a reply to message #84453] Tue, 22 May 2007 09:13 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Exactly.


Anthony

> Anthony,
> Model refers to one instance of Network and one instance of
> OptimizedResult and you want the features of Network and
> OptimizedResult to be mapped to the same table as Model. When a Model
> is saved also the Network and OptimizedResult are saved.
> Is this what you want?
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> Thank you for help.
>>
>> I just learn to write my mapping file.
>>
>> It seems that when a new persistable object was saved
>> a new record will be inserted into its mapped table.
>>
>> In my case, the sample structure of my EMF model list below:
>>
>> Model
>> |____Network
>> |
>> |____OptimizedResult
>>
>>
>> There is a table called T_Model which will store all the attribute
>> in
>>
>> Model,Netwrok and OptimizedResult.
>>
>> So I cannot map 3 classes into T_Model.
>>
>> But I am not sure if it is possible to map into DB View.
>>
>>
>> Regards,
>>
>> Anthony
>>
>>
>>
>>> Hi Anthony,
>>> I think you mean embedded but to be sure can you give a small
>>> example of what you want to achieve?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Hi,
>>>>
>>>> I have several classes in a EMF model and these classes will be
>>>> mapped
>>>> into ONE table . How to write the mapping file to only let one
>>>> class to insert/update/delete the table record and the others just
>>>> mapped to some fields?
>>>>
>>>> Thanks in advance!
>>>>
>>>>
>>>> Anthony
>>>
>>
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #84479 is a reply to message #84465] Tue, 22 May 2007 09:21 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
To achieve this you can set the @Embedded annotation in the ereferences Model.Network and
Model.OptimizedResult.

If there are nameclashes between Network, OptimizedResult and Model then you can use
@AttributeOverrides.

gr. Martin

Anthony wrote:
> Martin,
>
> Exactly.
>
>
> Anthony
>
>> Anthony,
>> Model refers to one instance of Network and one instance of
>> OptimizedResult and you want the features of Network and
>> OptimizedResult to be mapped to the same table as Model. When a Model
>> is saved also the Network and OptimizedResult are saved.
>> Is this what you want?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> Thank you for help.
>>>
>>> I just learn to write my mapping file.
>>>
>>> It seems that when a new persistable object was saved
>>> a new record will be inserted into its mapped table.
>>>
>>> In my case, the sample structure of my EMF model list below:
>>>
>>> Model
>>> |____Network
>>> |
>>> |____OptimizedResult
>>>
>>>
>>> There is a table called T_Model which will store all the attribute
>>> in
>>>
>>> Model,Netwrok and OptimizedResult.
>>>
>>> So I cannot map 3 classes into T_Model.
>>>
>>> But I am not sure if it is possible to map into DB View.
>>>
>>>
>>> Regards,
>>>
>>> Anthony
>>>
>>>
>>>
>>>> Hi Anthony,
>>>> I think you mean embedded but to be sure can you give a small
>>>> example of what you want to achieve?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Hi,
>>>>>
>>>>> I have several classes in a EMF model and these classes will be
>>>>> mapped
>>>>> into ONE table . How to write the mapping file to only let one
>>>>> class to insert/update/delete the table record and the others just
>>>>> mapped to some fields?
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>> 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+Hibernate]Help! A hibernate mapping question [message #84489 is a reply to message #84479] Tue, 22 May 2007 10:02 Go to previous messageGo to next message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

OK. I will try it.

I have another question :

In my case ,the model structure list as below:

Network
|________ProductCatalog
| |_______Product collection
|
|________CustomerCatlog
|_______Customer collection


When UI want to show product collections,
the ProductCatalog object will act as collection's
parent object to avoid getting customer collecitons.

(If no ***catalog, ContentProvider will return Network's children)


Do I have to have table to mapped ***Catalog class?


Anthony






> Anthony,
> To achieve this you can set the @Embedded annotation in the
> ereferences Model.Network and Model.OptimizedResult.
>
> If there are nameclashes between Network, OptimizedResult and Model
> then you can use @AttributeOverrides.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> Exactly.
>>
>>
>> Anthony
>>
>>> Anthony,
>>> Model refers to one instance of Network and one instance of
>>> OptimizedResult and you want the features of Network and
>>> OptimizedResult to be mapped to the same table as Model. When a
>>> Model is saved also the Network and OptimizedResult are saved.
>>> Is this what you want?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> Thank you for help.
>>>>
>>>> I just learn to write my mapping file.
>>>>
>>>> It seems that when a new persistable object was saved
>>>> a new record will be inserted into its mapped table.
>>>>
>>>> In my case, the sample structure of my EMF model list below:
>>>>
>>>> Model
>>>> |____Network
>>>> |
>>>> |____OptimizedResult
>>>>
>>>>
>>>> There is a table called T_Model which will store all the
>>>> attribute in
>>>>
>>>> Model,Netwrok and OptimizedResult.
>>>>
>>>> So I cannot map 3 classes into T_Model.
>>>>
>>>> But I am not sure if it is possible to map into DB View.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>> Hi Anthony,
>>>>> I think you mean embedded but to be sure can you give a small
>>>>> example of what you want to achieve?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I have several classes in a EMF model and these classes will be
>>>>>> mapped
>>>>>> into ONE table . How to write the mapping file to only let one
>>>>>> class to insert/update/delete the table record and the others
>>>>>> just mapped to some fields?
>>>>>>
>>>>>> Thanks in advance!
>>>>>>
>>>>>>
>>>>>> Anthony
>>>
>>
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #84501 is a reply to message #84489] Tue, 22 May 2007 10:10 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
You can try to set @Embedded also on Network.ProductCatalog/CustomerCatalog to get it into the same
table as Model and Network. Is that whay you want/mean?

gr. Martin

Anthony wrote:
> Martin,
>
> OK. I will try it.
>
> I have another question :
>
> In my case ,the model structure list as below:
>
> Network
> |________ProductCatalog
> | |_______Product collection
> |
> |________CustomerCatlog
> |_______Customer collection
>
>
> When UI want to show product collections,
> the ProductCatalog object will act as collection's
> parent object to avoid getting customer collecitons.
>
> (If no ***catalog, ContentProvider will return Network's children)
>
>
> Do I have to have table to mapped ***Catalog class?
>
>
> Anthony
>
>
>
>
>
>
>> Anthony,
>> To achieve this you can set the @Embedded annotation in the
>> ereferences Model.Network and Model.OptimizedResult.
>>
>> If there are nameclashes between Network, OptimizedResult and Model
>> then you can use @AttributeOverrides.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> Exactly.
>>>
>>>
>>> Anthony
>>>
>>>> Anthony,
>>>> Model refers to one instance of Network and one instance of
>>>> OptimizedResult and you want the features of Network and
>>>> OptimizedResult to be mapped to the same table as Model. When a
>>>> Model is saved also the Network and OptimizedResult are saved.
>>>> Is this what you want?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> Thank you for help.
>>>>>
>>>>> I just learn to write my mapping file.
>>>>>
>>>>> It seems that when a new persistable object was saved
>>>>> a new record will be inserted into its mapped table.
>>>>>
>>>>> In my case, the sample structure of my EMF model list below:
>>>>>
>>>>> Model
>>>>> |____Network
>>>>> |
>>>>> |____OptimizedResult
>>>>>
>>>>>
>>>>> There is a table called T_Model which will store all the
>>>>> attribute in
>>>>>
>>>>> Model,Netwrok and OptimizedResult.
>>>>>
>>>>> So I cannot map 3 classes into T_Model.
>>>>>
>>>>> But I am not sure if it is possible to map into DB View.
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>> Hi Anthony,
>>>>>> I think you mean embedded but to be sure can you give a small
>>>>>> example of what you want to achieve?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have several classes in a EMF model and these classes will be
>>>>>>> mapped
>>>>>>> into ONE table . How to write the mapping file to only let one
>>>>>>> class to insert/update/delete the table record and the others
>>>>>>> just mapped to some fields?
>>>>>>>
>>>>>>> Thanks in advance!
>>>>>>>
>>>>>>>
>>>>>>> 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+Hibernate]Help! A hibernate mapping question [message #606757 is a reply to message #84377] Tue, 22 May 2007 07:27 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Anthony,
I think you mean embedded but to be sure can you give a small example of what you want to achieve?

gr. Martin

Anthony wrote:
> Hi,
>
> I have several classes in a EMF model and these classes will be mapped
> into ONE table . How to write the mapping file to only let one class to
> insert/update/delete the table record and the others just mapped to some
> fields?
>
> Thanks in advance!
>
>
> 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+Hibernate]Help! A hibernate mapping question [message #606759 is a reply to message #84410] Tue, 22 May 2007 08:57 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Thank you for help.

I just learn to write my mapping file.

It seems that when a new persistable object was saved
a new record will be inserted into its mapped table.

In my case, the sample structure of my EMF model list below:

Model
|____Network
|
|____OptimizedResult


There is a table called T_Model which will store all the attribute in

Model,Netwrok and OptimizedResult.

So I cannot map 3 classes into T_Model.

But I am not sure if it is possible to map into DB View.


Regards,

Anthony



> Hi Anthony,
> I think you mean embedded but to be sure can you give a small example
> of what you want to achieve?
>
> gr. Martin
>
> Anthony wrote:
>> Hi,
>>
>> I have several classes in a EMF model and these classes will be
>> mapped
>> into ONE table . How to write the mapping file to only let one class
>> to insert/update/delete the table record and the others just mapped
>> to some fields?
>>
>> Thanks in advance!
>>
>>
>> Anthony
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #606760 is a reply to message #84440] Tue, 22 May 2007 09:09 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
Model refers to one instance of Network and one instance of OptimizedResult and you want the
features of Network and OptimizedResult to be mapped to the same table as Model. When a Model is
saved also the Network and OptimizedResult are saved.
Is this what you want?

gr. Martin

Anthony wrote:
> Martin,
>
> Thank you for help.
>
> I just learn to write my mapping file.
>
> It seems that when a new persistable object was saved
> a new record will be inserted into its mapped table.
>
> In my case, the sample structure of my EMF model list below:
>
> Model
> |____Network
> |
> |____OptimizedResult
>
>
> There is a table called T_Model which will store all the attribute in
>
> Model,Netwrok and OptimizedResult.
>
> So I cannot map 3 classes into T_Model.
>
> But I am not sure if it is possible to map into DB View.
>
>
> Regards,
>
> Anthony
>
>
>
>> Hi Anthony,
>> I think you mean embedded but to be sure can you give a small example
>> of what you want to achieve?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Hi,
>>>
>>> I have several classes in a EMF model and these classes will be
>>> mapped
>>> into ONE table . How to write the mapping file to only let one class
>>> to insert/update/delete the table record and the others just mapped
>>> to some fields?
>>>
>>> Thanks in advance!
>>>
>>>
>>> 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+Hibernate]Help! A hibernate mapping question [message #606761 is a reply to message #84453] Tue, 22 May 2007 09:13 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

Exactly.


Anthony

> Anthony,
> Model refers to one instance of Network and one instance of
> OptimizedResult and you want the features of Network and
> OptimizedResult to be mapped to the same table as Model. When a Model
> is saved also the Network and OptimizedResult are saved.
> Is this what you want?
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> Thank you for help.
>>
>> I just learn to write my mapping file.
>>
>> It seems that when a new persistable object was saved
>> a new record will be inserted into its mapped table.
>>
>> In my case, the sample structure of my EMF model list below:
>>
>> Model
>> |____Network
>> |
>> |____OptimizedResult
>>
>>
>> There is a table called T_Model which will store all the attribute
>> in
>>
>> Model,Netwrok and OptimizedResult.
>>
>> So I cannot map 3 classes into T_Model.
>>
>> But I am not sure if it is possible to map into DB View.
>>
>>
>> Regards,
>>
>> Anthony
>>
>>
>>
>>> Hi Anthony,
>>> I think you mean embedded but to be sure can you give a small
>>> example of what you want to achieve?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Hi,
>>>>
>>>> I have several classes in a EMF model and these classes will be
>>>> mapped
>>>> into ONE table . How to write the mapping file to only let one
>>>> class to insert/update/delete the table record and the others just
>>>> mapped to some fields?
>>>>
>>>> Thanks in advance!
>>>>
>>>>
>>>> Anthony
>>>
>>
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #606762 is a reply to message #84465] Tue, 22 May 2007 09:21 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
To achieve this you can set the @Embedded annotation in the ereferences Model.Network and
Model.OptimizedResult.

If there are nameclashes between Network, OptimizedResult and Model then you can use
@AttributeOverrides.

gr. Martin

Anthony wrote:
> Martin,
>
> Exactly.
>
>
> Anthony
>
>> Anthony,
>> Model refers to one instance of Network and one instance of
>> OptimizedResult and you want the features of Network and
>> OptimizedResult to be mapped to the same table as Model. When a Model
>> is saved also the Network and OptimizedResult are saved.
>> Is this what you want?
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> Thank you for help.
>>>
>>> I just learn to write my mapping file.
>>>
>>> It seems that when a new persistable object was saved
>>> a new record will be inserted into its mapped table.
>>>
>>> In my case, the sample structure of my EMF model list below:
>>>
>>> Model
>>> |____Network
>>> |
>>> |____OptimizedResult
>>>
>>>
>>> There is a table called T_Model which will store all the attribute
>>> in
>>>
>>> Model,Netwrok and OptimizedResult.
>>>
>>> So I cannot map 3 classes into T_Model.
>>>
>>> But I am not sure if it is possible to map into DB View.
>>>
>>>
>>> Regards,
>>>
>>> Anthony
>>>
>>>
>>>
>>>> Hi Anthony,
>>>> I think you mean embedded but to be sure can you give a small
>>>> example of what you want to achieve?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Hi,
>>>>>
>>>>> I have several classes in a EMF model and these classes will be
>>>>> mapped
>>>>> into ONE table . How to write the mapping file to only let one
>>>>> class to insert/update/delete the table record and the others just
>>>>> mapped to some fields?
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>> 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+Hibernate]Help! A hibernate mapping question [message #606763 is a reply to message #84479] Tue, 22 May 2007 10:02 Go to previous message
Anthony Lee is currently offline Anthony LeeFriend
Messages: 114
Registered: July 2009
Senior Member
Martin,

OK. I will try it.

I have another question :

In my case ,the model structure list as below:

Network
|________ProductCatalog
| |_______Product collection
|
|________CustomerCatlog
|_______Customer collection


When UI want to show product collections,
the ProductCatalog object will act as collection's
parent object to avoid getting customer collecitons.

(If no ***catalog, ContentProvider will return Network's children)


Do I have to have table to mapped ***Catalog class?


Anthony






> Anthony,
> To achieve this you can set the @Embedded annotation in the
> ereferences Model.Network and Model.OptimizedResult.
>
> If there are nameclashes between Network, OptimizedResult and Model
> then you can use @AttributeOverrides.
>
> gr. Martin
>
> Anthony wrote:
>> Martin,
>>
>> Exactly.
>>
>>
>> Anthony
>>
>>> Anthony,
>>> Model refers to one instance of Network and one instance of
>>> OptimizedResult and you want the features of Network and
>>> OptimizedResult to be mapped to the same table as Model. When a
>>> Model is saved also the Network and OptimizedResult are saved.
>>> Is this what you want?
>>>
>>> gr. Martin
>>>
>>> Anthony wrote:
>>>> Martin,
>>>>
>>>> Thank you for help.
>>>>
>>>> I just learn to write my mapping file.
>>>>
>>>> It seems that when a new persistable object was saved
>>>> a new record will be inserted into its mapped table.
>>>>
>>>> In my case, the sample structure of my EMF model list below:
>>>>
>>>> Model
>>>> |____Network
>>>> |
>>>> |____OptimizedResult
>>>>
>>>>
>>>> There is a table called T_Model which will store all the
>>>> attribute in
>>>>
>>>> Model,Netwrok and OptimizedResult.
>>>>
>>>> So I cannot map 3 classes into T_Model.
>>>>
>>>> But I am not sure if it is possible to map into DB View.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Anthony
>>>>
>>>>
>>>>
>>>>> Hi Anthony,
>>>>> I think you mean embedded but to be sure can you give a small
>>>>> example of what you want to achieve?
>>>>>
>>>>> gr. Martin
>>>>>
>>>>> Anthony wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I have several classes in a EMF model and these classes will be
>>>>>> mapped
>>>>>> into ONE table . How to write the mapping file to only let one
>>>>>> class to insert/update/delete the table record and the others
>>>>>> just mapped to some fields?
>>>>>>
>>>>>> Thanks in advance!
>>>>>>
>>>>>>
>>>>>> Anthony
>>>
>>
>
>
Re: [Teneo+Hibernate]Help! A hibernate mapping question [message #606764 is a reply to message #84489] Tue, 22 May 2007 10:10 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Anthony,
You can try to set @Embedded also on Network.ProductCatalog/CustomerCatalog to get it into the same
table as Model and Network. Is that whay you want/mean?

gr. Martin

Anthony wrote:
> Martin,
>
> OK. I will try it.
>
> I have another question :
>
> In my case ,the model structure list as below:
>
> Network
> |________ProductCatalog
> | |_______Product collection
> |
> |________CustomerCatlog
> |_______Customer collection
>
>
> When UI want to show product collections,
> the ProductCatalog object will act as collection's
> parent object to avoid getting customer collecitons.
>
> (If no ***catalog, ContentProvider will return Network's children)
>
>
> Do I have to have table to mapped ***Catalog class?
>
>
> Anthony
>
>
>
>
>
>
>> Anthony,
>> To achieve this you can set the @Embedded annotation in the
>> ereferences Model.Network and Model.OptimizedResult.
>>
>> If there are nameclashes between Network, OptimizedResult and Model
>> then you can use @AttributeOverrides.
>>
>> gr. Martin
>>
>> Anthony wrote:
>>> Martin,
>>>
>>> Exactly.
>>>
>>>
>>> Anthony
>>>
>>>> Anthony,
>>>> Model refers to one instance of Network and one instance of
>>>> OptimizedResult and you want the features of Network and
>>>> OptimizedResult to be mapped to the same table as Model. When a
>>>> Model is saved also the Network and OptimizedResult are saved.
>>>> Is this what you want?
>>>>
>>>> gr. Martin
>>>>
>>>> Anthony wrote:
>>>>> Martin,
>>>>>
>>>>> Thank you for help.
>>>>>
>>>>> I just learn to write my mapping file.
>>>>>
>>>>> It seems that when a new persistable object was saved
>>>>> a new record will be inserted into its mapped table.
>>>>>
>>>>> In my case, the sample structure of my EMF model list below:
>>>>>
>>>>> Model
>>>>> |____Network
>>>>> |
>>>>> |____OptimizedResult
>>>>>
>>>>>
>>>>> There is a table called T_Model which will store all the
>>>>> attribute in
>>>>>
>>>>> Model,Netwrok and OptimizedResult.
>>>>>
>>>>> So I cannot map 3 classes into T_Model.
>>>>>
>>>>> But I am not sure if it is possible to map into DB View.
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>
>>>>>> Hi Anthony,
>>>>>> I think you mean embedded but to be sure can you give a small
>>>>>> example of what you want to achieve?
>>>>>>
>>>>>> gr. Martin
>>>>>>
>>>>>> Anthony wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have several classes in a EMF model and these classes will be
>>>>>>> mapped
>>>>>>> into ONE table . How to write the mapping file to only let one
>>>>>>> class to insert/update/delete the table record and the others
>>>>>>> just mapped to some fields?
>>>>>>>
>>>>>>> Thanks in advance!
>>>>>>>
>>>>>>>
>>>>>>> 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
Previous Topic:[Transaction] Redo(Undo)ActionWrapper memory leak?
Next Topic:[Transaction] Redo(Undo)ActionWrapper memory leak?
Goto Forum:
  


Current Time: Fri Mar 29 10:21:19 GMT 2024

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

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

Back to the top