Hello Everyone!
I'm hoping someone here can help me with this error. I've spent the
last couple hours searching on google for some kind of solution.
Here's My Map:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping assembly="VolunteerImpact.Domain"
namespace="VolunteerImpact.Domain" xmlns="urn:nhibernate-mapping-2.2">
<class name="UserInfo" table="UserInfo" lazy="true" >
<id name="UserID" type="Int32" column="UserID" access="property">
<generator class="identity" />
</id>
<version name="Version2" generated="always" unsaved-value="null"
type="BinaryBlob" column="Version2"></version>
<property name="Address1" column="Address1" access="property" />
<property name="Address2" column="Address2" access="property" />
<property name="Birthday" column="Birthday" access="property" />
<property name="CellPhone" column="CellPhone" access="property" />
<property name="City" column="City" access="property" />
<property name="CommunitySearchPermissionID"
column="CommunitySearchPermissionID" access="property" />
<property name="Country" column="Country" access="property" />
<property name="DateCreated" column="DateCreated"
access="property" />
<property name="DateJoined" column="DateJoined" access="property" /
>
<property name="DateUpdated"
type="VolunteerImpact.Data.CurrentDateTimeType,
VolunteerImpact.Data"></property>
<property name="EducationLevelID" column="EducationLevelID"
access="property" />
<property name="EmailAddress" column="EmailAddress"
access="property" />
<property name="EmailSignature" column="EmailSignature"
access="property" />
<property name="EmploymentStatusID" column="EmploymentStatusID"
access="property" />
<property name="Fax" column="Fax" access="property" />
<property name="FirstName" column="FirstName" access="property" />
<property name="GenderID" column="GenderID" access="property" />
<property name="HomePhone" column="HomePhone" access="property" />
<property name="Language" column="Language" access="property" />
<property name="LastName" column="LastName" access="property" />
<property name="Login" column="Login" access="property" />
<property name="MiddleName" column="MiddleName" access="property" /
>
<property name="Password" column="Password" access="property" />
<property name="PhonePreferenceID" column="PhonePreferenceID" />
<property name="PostalCode" column="PostalCode" access="property" /
>
<property name="Province" column="Province" access="property" />
<property name="RaceID" column="RaceID" access="property" />
<property name="Suffix" column="Suffix" access="property" />
<property name="Title" column="Title" access="property" />
<property name="UserGUID" column="UserGUID" access="property"
generated="insert" insert="false" update="false"/>
<property name="WorkPhone" column="WorkPhone" access="property" />
<property name="WorkPhoneExt" column="WorkPhoneExt"
access="property" />
<property name="TotalTime" access="nosetter.camelcase-underscore"
formula="(select datediff(hour, '19000101', convert(varchar(20),
dateadd(minute, sum(datediff(minute, t.startdate, t.enddate)) ,
'19000101'),20)) from TimelogEntry t where t.userID = UserID)" />
<bag name="TimeLogs" table="TimelogEntry" >
<key column="UserID" on-delete="noaction"></key>
<many-to-many class="TimelogEntry" column="TimelogEntryID" />
</bag>
<bag name="OrganizationMemberships" table="OrganizationMember" >
<key column="UserID" on-delete="noaction"></key>
<one-to-many class="OrganizationMember" not-found="ignore" />
</bag>
<bag name="Organizations" table="OrganizationMember" >
<key column="UserID" on-delete="noaction"></key>
<many-to-many class="Organization" column="OrganizationID" />
</bag>
</class>
</hibernate-mapping>
Here's the usertype class:
Imports NHibernate
Imports NHibernate.UserTypes
<Serializable()> _
Public Class CurrentDateTimeType
Implements IUserType
Public Function Assemble(ByVal cached As Object, ByVal owner As
Object) As Object Implements NHibernate.UserTypes.IUserType.Assemble
Return cached
End Function
Public Function DeepCopy(ByVal value As Object) As Object
Implements NHibernate.UserTypes.IUserType.DeepCopy
Return value
End Function
Public Function Disassemble(ByVal value As Object) As Object
Implements NHibernate.UserTypes.IUserType.Disassemble
Return value
End Function
Public Function Equals1(ByVal x As Object, ByVal y As Object) As
Boolean Implements NHibernate.UserTypes.IUserType.Equals
If x Is Nothing Then
Return False
End If
If y Is Nothing Then
Return False
End If
If x.Equals(y) Then
Return True
Else
Return False
End If
End Function
Public Function GetHashCode1(ByVal x As Object) As Integer
Implements NHibernate.UserTypes.IUserType.GetHashCode
Return x.GetHashCode
End Function
Public ReadOnly Property IsMutable() As Boolean Implements
NHibernate.UserTypes.IUserType.IsMutable
Get
Return True
End Get
End Property
Public Function NullSafeGet(ByVal rs As System.Data.IDataReader,
ByVal names() As String, ByVal owner As Object) As Object Implements
NHibernate.UserTypes.IUserType.NullSafeGet
Dim thedate As DateTime
thedate = Convert.ToDateTime
(NHibernateUtil.DateTime.NullSafeGet(rs, names))
Return thedate
End Function
Public Sub NullSafeSet(ByVal cmd As System.Data.IDbCommand, ByVal
value As Object, ByVal index As Integer) Implements
NHibernate.UserTypes.IUserType.NullSafeSet
NHibernateUtil.DateTime.NullSafeSet(cmd, Now(), index)
End Sub
Public Function Replace(ByVal original As Object, ByVal target As
Object, ByVal owner As Object) As Object Implements
NHibernate.UserTypes.IUserType.Replace
Return original
End Function
Public ReadOnly Property ReturnedType() As System.Type Implements
NHibernate.UserTypes.IUserType.ReturnedType
Get
Return GetType(DateTime)
End Get
End Property
Public ReadOnly Property SqlTypes() As NHibernate.SqlTypes.SqlType
() Implements NHibernate.UserTypes.IUserType.SqlTypes
Get
Dim types(1) As NHibernate.SqlTypes.SqlType
types(0) = New SqlTypes.SqlType(DbType.DateTime)
Return types
End Get
End Property
End Class
Basically What I'm trying to do is have it put the current time in the
Database whenever It inserts/updates a row. The DateUpdated is the
property in question.
The complete error message is this:
property mapping has wrong number of columns:
VolunteerImpact.Domain.UserInfo.DateUpdated type: CurrentDateTimeType
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: NHibernate.MappingException: property mapping has
wrong number of columns: VolunteerImpact.Domain.UserInfo.DateUpdated
type: CurrentDateTimeType
Any points in the right direction would be greatly appreciated!
Thanks Very Much!
Patricia
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---