-->
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.  [ 3 posts ] 
Author Message
 Post subject: NHibernate Generics
PostPosted: Wed Nov 01, 2006 11:29 am 
Regular
Regular

Joined: Fri May 05, 2006 11:54 am
Posts: 51
Hi,

Where can I find information on how to use Generics and Nullable types that are now available with NHibernate 1.2.

Thanks

Paul


Top
 Profile  
 
 Post subject: Re: NHibernate Generics
PostPosted: Thu Nov 02, 2006 5:16 am 
Beginner
Beginner

Joined: Sat Sep 09, 2006 5:55 am
Posts: 23
dagda1 wrote:
Hi,

Where can I find information on how to use Generics and Nullable types that are now available with NHibernate 1.2.

Thanks

Paul


My best guess would be the doc folder that comes with the installation.

For generics it basically it comes down to setting the 'generic="true" attribute on collections in your mapping files:
Code:
<set name="SomeCollection"  ... generic="true">

and setting the type of the collection in your entity to a generic one, like ISet<SomeType>

For nullable types your property mapping would look like:
Code:
<property name="SomeNumber" ... type="Double" not-null="false" />

and the type of this property in your entity would be double? or Nullable<double>.

_________________
Cheers,

Guy Mahieu


Top
 Profile  
 
 Post subject: Re: NHibernate Generics
PostPosted: Thu Nov 02, 2006 6:05 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
guymahieu wrote:
dagda1 wrote:
Hi,

Where can I find information on how to use Generics and Nullable types that are now available with NHibernate 1.2.

Thanks

Paul


My best guess would be the doc folder that comes with the installation.

For generics it basically it comes down to setting the 'generic="true" attribute on collections in your mapping files:
Code:
<set name="SomeCollection"  ... generic="true">

and setting the type of the collection in your entity to a generic one, like ISet<SomeType>

For nullable types your property mapping would look like:
Code:
<property name="SomeNumber" ... type="Double" not-null="false" />

and the type of this property in your entity would be double? or Nullable<double>.


I think You do not need to consider generics/nullables at all when writing mapping. Just use them in code.

Gert

_________________
If a reply helps You, rate it!


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