These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Broken .NET class mapping attributes
PostPosted: Tue May 12, 2009 12:32 am 
Newbie

Joined: Tue May 12, 2009 12:17 am
Posts: 2
For the Caveat Emptor project in the Hibernate In Action book, I decided to go bleeding edge and use NH 2.1.0 Alpha 2 with ASP.NET 3.5 SP1. Thus there were several straightforward adjustments that I had to make to converge towards a clean build.

However, the build is almost there but not quite clean yet. What remain are the errors in certain mapping
.NET class attributes (Lazy and Cascade) that are listed below.

These settings all fail in the build because an implicit type conversion not possible. The "true" for Lazy cannot be converted to NHibernate.Mapping.Attributes.CollectionLazy, and the various Cascade settings cannot be converted to string.

Why? How should these .NET class attribute settings be equivalently coded for the NH 2.0+? I did not see any indication of this being broken going to 2.0+.

Thanks for any help,

Dwight Spencer (toketeeman)
Portland, Oregon

Code:
   [Set(... , Cascade = CascadeStyle.AllDeleteOrphan, ...)]

   [Set(... , Cascade = CascadeStyle.All, ...)]

   [Set(... , Cascade = CascadeStyle.None, ...)]

   [Set(... , Lazy = true, ...)]


Top
 Profile  
 
 Post subject: Re: Broken .NET class mapping attributes
PostPosted: Tue May 12, 2009 3:57 pm 
Newbie

Joined: Tue May 12, 2009 12:17 am
Posts: 2
This issue has been answered by one of the authors.

For NH 2.0+, the .NET attribute cascade must now be assigned to a string instead of a CascadeStyle enumeration value. The possible values are: "none", "save-update", "delete", "all", "all-delete-orphan", "delete-orphan", "persist", "merge", "lock", "refresh", "replicate", "evict", and "remove". This is necessary to permit cascade to be assigned also a CSV string containing some of these string values in order to achieve a combination setting. The change was forced by the fact that the supporting mapping .xsd cannot be coded to support both a CSV value and an enumeration value simultaneously. Of course, to allow the CSV feature is also a step backward debugging-wise since Intellisense no longer can be used for cascade settings.

For NH 2.0+, the .NET attribute lazy must now be assigned a NHibernate.Mapping.Attributes.CollectionLazy enumeration value instead of a boolean. The possible values are CollectionLazy.True and CollectionLazy.False.

Dwight Spencer
Portland, Oregon


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.