Cached queries now working :)
But adding lazy load property leads to another exception:
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: System.NotSupportedException: Specified method is not
supported.
BTW, inner exception (GenericADOException looks strange, because generated
SQL can be executed via SQL Managemenet Studio without errors).
Please see exception and mappings below:
Line 51: public User GetByEmail(string email)
Line 52: {
Line 53: return Session.QueryOver<User>()
Line 54: .Where(u => u.Email == email).And(u =>
!u.IsDeleted)
Line 55: .Cacheable().CacheMode(CacheMode.Normal)
Stack Trace:
*[NotSupportedException: Specified method is not supported.]*
NHibernate.Proxy.AbstractProxyFactory.GetFieldInterceptionProxy(Object
instanceToWrap) +55
NHibernate.Tuple.PocoInstantiator.Instantiate() +182
NHibernate.Tuple.PocoInstantiator.Instantiate(Object id) +121
NHibernate.Tuple.Entity.AbstractEntityTuplizer.Instantiate(Object id) +69
NHibernate.Persister.Entity.AbstractEntityPersister.Instantiate(Object
id, EntityMode entityMode) +58
NHibernate.Impl.SessionImpl.Instantiate(IEntityPersister persister,
Object id) +238
NHibernate.Impl.SessionImpl.Instantiate(String clazz, Object id) +179
NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i,
ILoadable persister, EntityKey key, LockMode lockMode, String rowIdAlias,
EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects,
ISessionImplementor session) +236
NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters,
EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey,
LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session)
+548
NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet,
ISessionImplementor session, QueryParameters queryParameters, LockMode[]
lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects,
EntityKey[] keys, Boolean returnProxies) +442
NHibernate.Loader.Loader.DoQuery(ISessionImplementor session,
QueryParameters queryParameters, Boolean returnProxies) +1435
NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor
session, QueryParameters queryParameters, Boolean returnProxies) +250
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) +205
*[GenericADOException: could not execute query*
[ SELECT this_.ID as ID10_2_, this_.CreatedDateTime as CreatedD2_10_2_,
this_.LastAccessDateTime as LastAcce3_10_2_, this_.UserRoleID as
UserRoleID10_2_, this_.Email as Email10_2_, this_.Password as Password10_2_,
this_.NickName as NickName10_2_, this_.FirstName as FirstName10_2_,
this_.LastName as LastName10_2_, this_.MobilePhone as MobileP10_10_2_,
this_.MobilePhone2 as MobileP11_10_2_, this_.IsFirstNameVisible as
IsFirst12_10_2_, this_.IsLastNameVisible as IsLastN13_10_2_,
this_.IsMobilePhoneVisible as IsMobil14_10_2_, this_.IsMobilePhone2Visible
as IsMobil15_10_2_, this_.IsMale as IsMale10_2_, this_.BirthdayYear as
Birthda17_10_2_, this_.InhabitedLocalityID as Inhabit18_10_2_, this_.Avatar
as Avatar10_2_, this_.AvatarFileName as AvatarF20_10_2_,
this_.AvatarVisibilityTypeID as AvatarV21_10_2_,
this_.LastEmailVerificationError as LastEma22_10_2_, this_.IsEmailVerified
as IsEmail23_10_2_, this_.IsDeleted as IsDeleted10_2_, userrole2_.ID as
ID11_0_, userrole2_.Name as Name11_0_, usercar3_.UserID as UserID3_1_,
usercar3_.CarBrandID as CarBrandID3_1_, usercar3_.CarModel as CarModel3_1_,
usercar3_.CarComfortTypeID as CarComfo4_3_1_, usercar3_.NumberOfSeats as
NumberOf5_3_1_, usercar3_.RegistrationNumber as Registra6_3_1_,
usercar3_.CarColorID as CarColorID3_1_, usercar3_.PhotoOriginal800x600 as
PhotoOri9_3_1_, usercar3_.PhotoFileName as PhotoFi10_3_1_ FROM dbo.[User]
this_ left outer join dbo.UserRole userrole2_ on
this_.UserRoleID=userrole2_.ID left outer join dbo.UserCar usercar3_ on
this_.ID=usercar3_.UserID WHERE this_.Email = @p0 and this_.IsDeleted = @p1
]
Positional parameters: #0>[email protected] #1>False
[SQL: SELECT this_.ID as ID10_2_, this_.CreatedDateTime as CreatedD2_10_2_,
this_.LastAccessDateTime as LastAcce3_10_2_, this_.UserRoleID as
UserRoleID10_2_, this_.Email as Email10_2_, this_.Password as Password10_2_,
this_.NickName as NickName10_2_, this_.FirstName as FirstName10_2_,
this_.LastName as LastName10_2_, this_.MobilePhone as MobileP10_10_2_,
this_.MobilePhone2 as MobileP11_10_2_, this_.IsFirstNameVisible as
IsFirst12_10_2_, this_.IsLastNameVisible as IsLastN13_10_2_,
this_.IsMobilePhoneVisible as IsMobil14_10_2_, this_.IsMobilePhone2Visible
as IsMobil15_10_2_, this_.IsMale as IsMale10_2_, this_.BirthdayYear as
Birthda17_10_2_, this_.InhabitedLocalityID as Inhabit18_10_2_, this_.Avatar
as Avatar10_2_, this_.AvatarFileName as AvatarF20_10_2_,
this_.AvatarVisibilityTypeID as AvatarV21_10_2_,
this_.LastEmailVerificationError as LastEma22_10_2_, this_.IsEmailVerified
as IsEmail23_10_2_, this_.IsDeleted as IsDeleted10_2_, userrole2_.ID as
ID11_0_, userrole2_.Name as Name11_0_, usercar3_.UserID as UserID3_1_,
usercar3_.CarBrandID as CarBrandID3_1_, usercar3_.CarModel as CarModel3_1_,
usercar3_.CarComfortTypeID as CarComfo4_3_1_, usercar3_.NumberOfSeats as
NumberOf5_3_1_, usercar3_.RegistrationNumber as Registra6_3_1_,
usercar3_.CarColorID as CarColorID3_1_, usercar3_.PhotoOriginal800x600 as
PhotoOri9_3_1_, usercar3_.PhotoFileName as PhotoFi10_3_1_ FROM dbo.[User]
this_ left outer join dbo.UserRole userrole2_ on
this_.UserRoleID=userrole2_.ID left outer join dbo.UserCar usercar3_ on
this_.ID=usercar3_.UserID WHERE this_.Email = @p0 and this_.IsDeleted =
@p1]]
NHibernate.Loader.Loader.DoList(ISessionImplementor session,
QueryParameters queryParameters) +387
NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor session,
QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
+282
NHibernate.Loader.Loader.List(ISessionImplementor session,
QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
+155
NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor
session) +87
NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
+670
NHibernate.Impl.CriteriaImpl.List(IList results) +83
NHibernate.Impl.CriteriaImpl.List() +71
NHibernate.Impl.CriteriaImpl.UniqueResult() +37
NHibernate.Impl.CriteriaImpl.UniqueResult() +63
NHibernate.Criterion.QueryOver`1.SingleOrDefault() +106
NHibernate.Criterion.QueryOver`1.NHibernate.IQueryOver<TRoot>.SingleOrDefault()
+37
KudaNado.Data.UserRepository.GetByEmail(String email) in
D:\Work\vk\Projects\KudaNado\Src\KudaNado.Data\UserRepository.cs:53
KudaNado.MvcApplication.OnPostAuthenticateRequest(Object sender,
EventArgs eventArgs) in
D:\Work\vk\Projects\KudaNado\Src\KudaNado\Global.asax.cs:89
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +75
*Mappings:*
<class name="UserCar" table="UserCar">
<cache usage="read-write" region="ShortTerm"/>
<id name="Id" column="UserID">
<generator class="foreign">
<param name="property">Owner</param>
</generator>
</id>
<one-to-one name="Owner" class="User" constrained="true"
foreign-key="FK_UserCar_User" />
<many-to-one name="Brand" class="CarBrand" column="CarBrandID"
not-null="true" foreign-key="FK_UserCar_CarBrand" />
<property name="Model" column="CarModel" length="150" not-null="true" />
<property name="Comfort" column="CarComfortTypeID" not-null="true" />
<property name="NumberOfSeats" not-null="true" />
<property name="RegistrationNumber" length="30" not-null="true" />
<many-to-one name="Color" column="CarColorID" not-null="true"
foreign-key="FK_UserCar_CarColor" />
* <property name="PhotoSmall" lazy="true"/> <!-- lazy="true" -->
* <property name="Photo" column="PhotoOriginal800x600" /> <!--
lazy="true" -->
<property name="PhotoFileName" />
</class>
<class name="User" table="User">
<cache usage="read-write" region="ShortTerm" />
<id name="Id" column="ID" unsaved-value="0">
<column sql-type="int identity" name="ID" not-null="true" />
<generator class="identity" />
</id>
<property name="Created" column="CreatedDateTime" not-null="true" />
<property name="LastAccessed" column="LastAccessDateTime" />
<many-to-one name="Role" column="UserRoleID" fetch="join"
foreign-key="FK_User_UserRole"/>
<property name="Email" length="50" not-null="true" unique="true"/>
<property name="Password" length="150" not-null="true" />
<property name="NickName" length="150" />
<property name="FirstName" length="150" />
<property name="LastName" length="150" />
<property name="MobilePhone" length="150" />
<property name="MobilePhone2" length="150" />
<property name="IsFirstNameVisible" not-null="true"/>
<property name="IsLastNameVisible" not-null="true"/>
<property name="IsMobilePhoneVisible" not-null="true"/>
<property name="IsMobilePhone2Visible" not-null="true"/>
<property name="IsMale" not-null="true"/>
<property name="BirthdayYear" />
<property name="LocationId" column="InhabitedLocalityID"
not-null="true"/>
<property name="Avatar" /> <!-- lazy="true" -->
<property name="AvatarFileName" />
<property name="AvatarVisibility" column="AvatarVisibilityTypeID" />
<property name="LastEmailVerificationError" /> <!-- lazy="true" -->
<property name="IsEmailVerified" not-null="true"/>
<property name="IsDeleted" not-null="true"/>
<one-to-one name="Car" class="UserCar" cascade="save-update"
access="field.camelcase-underscore"/>
</class>
--
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.