Why, write a new .NET3.5 application, shouldn’t mean re-think the DB ? The
DB is not a part of the old application ?

We are working in software, is the relational DB a piece of granite
technology of the past century and nothing more ?

....again and again... The Eliot Ness of IT still alive

2010/2/19 John Davidson <[email protected]>

> The problem is that this is a legacy table (immutable), with more than 5000
> rows which need to be displayed to end users as a pick list, based on
> province. When it gets stored when used by another entity it can be mapped
> as a value object, but I still need it as a stand alone entity that can be
> queried. Is there any way to do this without duplicating all the values in
> another table with an added ID column?
>
> John Davidson
>
>
> On Fri, Feb 19, 2010 at 3:55 PM, Jason Meckley <[email protected]>wrote:
>
>> "I have marked the class 'Serializable' and overridden Equals and
>> GetHashCode (although there were no compile error or exceptions when I
>> did not do this)"
>> nor would there be. By marking the object serializable you can
>> serialize the configuration. This is useful if you want to save the
>> configuration to file and then load it from file, rather than building
>> the configuration each time.
>> Equals and GetHashCode are used by the session to manage the identity
>> map (1st level cache) not implementing them will not prevent
>> complication, but you will get side effects in the session because the
>> identity map may contain multiple instances of the same object)
>>
>> the sql may not be generated because you have no properties associated
>> wit the entity. if the entity is just city and providence you may want
>> to consider mapping this as a list of components (value objects)
>> rather than an entity.
>>
>> On Feb 19, 1:44 pm, John Davidson <[email protected]> wrote:
>> > I could really use some help with this as it is taking too long todo
>> > something I thought was relatively simple.
>> >
>> > I am unable to get data from a legacy table with a composite key. The
>> > mapping, class and test query are below. I have marked the class
>> > 'Serializable' and overridden Equals and GetHashCode (although there
>> were no
>> > compile error or exceptions when I did not do this). When the sample
>> query
>> > executes there is no sql (or exception) generated.
>> >
>> > <?xml version="1.0" encoding="utf-8" ?>
>> > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>> >                    schema="HCOMS_USER"
>> >                    assembly="SIS.Model"
>> >                    namespace="SIS.Model">
>> >   <class name="CityRef" table="CORE_CITY_TOWN">
>> >     <composite-id>
>> >       <key-property name="CityName" column="CITY_TOWN_NAME_TXT"
>> > type="string"/>
>> >       <key-property name="ProvinceCD" column="PROVINCE_CD"
>> type="string"/>
>> >     </composite-id>
>> >   </class>
>> > </hibernate-mapping>
>> >
>> > =================================================================
>> >
>> > <Serializable()> _
>> > Public Class CityRef
>> >     Implements IAggregateRoot
>> >
>> >     Private _cityName As String
>> >     Private _provinceCd As String
>> >
>> >     Public Sub New()
>> >
>> >     End Sub
>> >
>> >     Public Sub New(ByVal CityName As String, ByVal ProvinceCd As String)
>> >         _cityName = CityName
>> >         _provinceCd = ProvinceCd
>> >     End Sub
>> >
>> >     Public Overridable Property CityName() As String
>> >         Get
>> >             Return _cityName
>> >         End Get
>> >         Set(ByVal value As String)
>> >             _cityName = value
>> >         End Set
>> >     End Property
>> >
>> >     Public Overridable Property ProvinceCD() As String
>> >         Get
>> >             Return _provinceCd
>> >         End Get
>> >         Set(ByVal value As String)
>> >             _provinceCd = value
>> >         End Set
>> >     End Property
>> >
>> >     Public Overrides Function Equals(ByVal obj As Object) As Boolean
>> >         If obj Is Nothing Then
>> >             Return False
>> >         End If
>> >         Dim t As CityRef = CType(obj, CityRef)
>> >         If t Is Nothing Then
>> >             Return False
>> >         End If
>> >         If (Me._cityName = t._cityName AndAlso Me._provinceCd =
>> > t._provinceCd) Then
>> >             Return True
>> >         Else
>> >             Return False
>> >         End If
>> >     End Function
>> >
>> >     Public Overrides Function GetHashCode() As Integer
>> >         Return _cityName.GetHashCode Xor _provinceCd.GetHashCode
>> >     End Function
>> > End Class
>> >
>> > ==============================================================
>> >
>> >         Dim myList As IList(Of CityRef) =  _
>> >                            SessionManager.GetCurrentSession _
>> >                          .CreateCriteria(GetType(CityRef)).List(Of
>> > CityRef)()
>> >
>> > John Davidson
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>



-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to