-->
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.  [ 7 posts ] 
Author Message
 Post subject: NHibernate.Mapping.Attributes coverage?
PostPosted: Thu May 26, 2005 1:08 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 1:00 pm
Posts: 29
I'm looking to port a project from our custom O/R persister to NHibernate. We currently use attributes to map our objects and fields, and I noticed that the NHibernate contrib package has something similar.

Using attributes would ease the port but I'm wondering how much of the mapping functionality the attributes cover. Do the attributes cover all the standard XML mappings?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 26, 2005 6:55 pm 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
The library doesn't have 100% coverage of the current XML tags. However, the major items are covered. Let us know which ones you may need. The are pretty easy to add into the library.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 11:00 am 
Beginner
Beginner

Joined: Thu May 26, 2005 1:00 pm
Posts: 29
NHibernate provides a superset of the functionality of our customer mapper, so as long as we can decorate object fields (not properties) with attributes and have them persisted, as well as the various collections (many-many, many-one, one-one) we should be good. I don't think we require any of the more exotic functionality yet.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 27, 2005 11:35 am 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
Currently, the library supports placing [Property()] attributes on properties only. However, these properties can be private, internal or public. You can also provide a custom access strategy using the Access and AccessType settings on the PropertyAttribute class.

In a nutshell, you cannot currently assign these attributes the the fields of your objects. They must be associated with a property, even if the property isn't used to accessing the underlying data fields.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 09, 2005 11:18 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
The NHibernate.Mapping.Attributes.IdAttribute class doesn't seem to support choosing the "native" generator. I like the ability to specify "native" in the xml file because it allows persisting to a wide variety of database backends, and would hate to give that flexibility up in order to have the convenience of the Attributes. Can this be implemented?


Top
 Profile  
 
 Post subject: not-null coverage
PostPosted: Thu Jun 09, 2005 11:21 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
It seems not-null is totally unavailable through the attributes as well.


Top
 Profile  
 
 Post subject: StringClob access missing
PostPosted: Thu Jun 09, 2005 11:26 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
Since we are restricted to using only .NET-defined types, it seems that StringClob isn't a type we can use while using just Attributes as well. I am trying to save large XmlDocuments by persisting their OuterXml property. The simple String type is insufficient, because even when I set the length to some long value, an nvarchar(255) is all I get. But if I use StringClob with the same length, everything works.

So, can we get support added for StringClob through the attributes? Or better yet, get StringClob automatically output instead of just "string" when the string length is obviously too long for NHibernate to persist as a string.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.