Hibernate version:2.0.1.4000
Hi,
I have a class(EPLIGAF) which schema is from a linked server to a db2 database.
When I query the table from that class using CreateCriteria everything works but very slow compared to the other methods(CreateQuery and CreateSQLQuery).
CreateCriteria(works slow):
IList<EPLIGAF> list = NHibernateSession.Current.CreateCriteria(typeof(EPLIGAF))
.Add(Restrictions.Eq("Marca", "OC")).List<EPLIGAF>();
CreateQuery(works fast):
IList<EPLIGAF> list = NHibernateSession.Current.CreateQuery("from EPLIGAF ep where ep.Marca = 'OC'").List<EPLIGAF>();
CreateSQLQuery(works fast):
IList<EPLIGAF> list = NHibernateSession.Current.CreateSQLQuery("select LGMRC1 as Marca,LGART1 as Artigo from AS400.S65F18FB.EPLBF01.EPLIGAF where LGMRC1 = 'OC'").SetResultTransformer(Transformers.AliasToBean(typeof(EPLIGAF))).List<EPLIGAF>();
This is very strange and I have no idea of what's happening.
Thanks.
|