tags:

views:

80

answers:

2

I have schema, with such mapping.

Next code don't work:

IList<User> userList = session.CreateCriteria<User>()
                              .Add(Restrictions.Eq("Login", login))
                              .List<User>();

Exception: System.InvalidCastException: Specified cast is not valid

Full stacktrace: link

A: 

Try this :

IList<User> userList = session.CreateCriteria(typeof(User))
         .Add(Restrictions.Eq("Login", login))
         .List<User>();
Kris-I
Don't work. Already tried
SaD
A: 

Bug in mapping:

<component name="UserRole">
  <property name="Role" column="role" not-null="true" type="System.String" />
</component>

should:

<component name="UserRole">
  <property name="Role" column="role" not-null="true" />
</component>
SaD