Sculpture Community  Sculpture Discu...  Sculpture 2.1  One to One Relationship
Previous Previous
 
Next Next
New Post 3/14/2010 5:17 AM
  MicL
43 posts


Re: One to One Relationship 

Hi TAboraya,

Even with the One-To-One primary key association mode, the nHibernate XML generated only contains

<one-to-one name="Test" class="TestRes"/>

I have to manually changed it to:

<one-to-one name="Test" class="TestRes"  cascade="save-update"/>

Otherwise, I need to Insert or Update the two associated entities separately. Have I missed out something?

Regards,

Michael Leung

 
New Post 3/16/2010 2:15 PM
  TAboraya
258 posts


Re: One to One Relationship 

Michael,

The default behavior is to insert or update the two associated entities separately.

In the next release we plan to add the "cascade" option during the modeling process for all association types, so you can determine the cascade type for each individual association.

 

Best Regards,


Tamer Aboraya - Product Manager - Sculpture project
 
New Post 4/23/2010 1:00 PM
  MicL
43 posts


Re: One to One Relationship 

TAboraya,

With your help I have successfully added an custom attribute (isComposition) to the relationships and generate the cascade option accordingly in the TT. If your next release will have a cascade option, I would like to know the attribute name (e.g. CascadeOption), such that our model can be reconized by your next version.

Or, you can send us the new NHibernateMold.Mold

Regards,

Michael Leung

 
New Post 4/24/2010 7:00 PM
  TAboraya
258 posts


Re: One to One Relationship 

Hi Micheal,

Actually we did not set the final names of the new properties yet but I think that this will be the short term "Cascade" as the property name.

 

Best Regards,


Tamer Aboraya - Product Manager - Sculpture project
 
New Post 8/14/2010 9:26 AM
  MicL
43 posts


Re: One to One Relationship 

Dear Support,

We are still using 2.1 and would like to report two bugs related to "1 to 0..1" relationships. I understand that you are currently busy with 3.0. However, as a licensed 2.1 user, I expect that 2.1 will still be supported until its end-of-life.

Both bugs appear when generating SQL server DB using nHibernate mold. The error message is "Error while tring to write changes into your database, Error Details: Length cannot be less than zero. Parameter name: length See output window for more details". The output showed that the 1 to 0..1 DB constraint is not generated.

1. Define a Parent with Sid (Int32, Indentity); a Child inherited from Parent with Text1 (string) and an Friend with Sid (Int32 primary key). The Child is having a 1 to 0..1 relationship with the Friend (target). The error above will appear. If we define the Firend before the Parent & Child, there will be no error and DB constraint can be generated.

2. Define a Parent with Sid (Int32, Primary key); a Child inherited from Parent with Text1 (string) and an Friend with Sid (Int32 Identity). Friend is having a 1 to 0..1 relationship with Parent (target). No mater how we swap the sequence of drawing these entities, the error will appear.

Regards,
Michael Leung

 
Previous Previous
 
Next Next
  Sculpture Community  Sculpture Discu...  Sculpture 2.1  One to One Relationship
Users Minimize
 
Membership Membership:
Latest New User Latest: EricNichols
New Today New Today: 4
New Yesterday New Yesterday: 3
User Count Overall: 2776

People Online People Online:
Visitors Visitors: 0
Members Members: 0
Total Total: 0

Online Now Online Now: