Hi Richard ,thanks for help. If ignorecase from Criterion.Example uses Criterion.LikeExpression, it seems that problem is solved.
But just a test with new version to confirm. Is there a defined date to release new version(2.1.1)? Att, On 24 set, 12:01, "Richard Brown \(gmail\)" <[email protected]> wrote: > Hi Victor, > > There was an issue already resolved that is ready to be released in 2.1.1 > (http://nhjira.koah.net/browse/NH-1938). > > Can you confirm that this is the source of your problem? > > Cheers, > Richard > > -------------------------------------------------- > From: "Victor Hugo" <[email protected]> > Sent: Thursday, September 24, 2009 2:21 PM > To: "nhusers" <[email protected]> > Subject: [nhusers] Re: bug in Query By Example > > > > > I've found the exact problem, it happens in IgnoreCase. The query that > > nhibernate generates is not correct. I posted it together with code > > i'm using. > > > I realized that Nhibernate UnitTest that uses Criterion.Example() with > > IgnoreCase uses a number as datatype. Because that, the test will > > always work correctly. > > > Follows: > > > private void button1_Click(object sender, EventArgs e) > > { > > ISessionFactory sf; > > NHibernate.Cfg.Configuration config = new > > NHibernate.Cfg.Configuration(); > > > Assembly assembly = Assembly.Load("BusinessEntities"); > > string[] resourceNames = assembly.GetManifestResourceNames > > (); > > System.IO.Stream streamHbm = > > assembly.GetManifestResourceStream(resourceNames[0]); > > config.AddInputStream(streamHbm, resourceNames[0]); > > > log4net.Config.XmlConfigurator.Configure(); > > > sf = config.BuildSessionFactory(); > > > log4net.Config.XmlConfigurator.Configure(); > > > ISession session = sf.OpenSession(); > > > log4net.Config.XmlConfigurator.Configure(); > > > BusinessEntities.Pessoa pessoa = new > > BusinessEntities.Pessoa(); > > pessoa.PessNmNome = "ROBALO"; > > > IList pessoas = session.CreateCriteria(typeof > > (BusinessEntities.Pessoa)).Add(NHibernate.Criterion.Example.Create(new > > { PessNmNome = "ROBALO" }).EnableLike().IgnoreCase()).List(); > > /*example.EnableLike(); > > example.IgnoreCase(); > > example. > > > criteria.Add(example); > > criteria.List<BusinessEntities.Pessoa>(); > > */ > > } > > > SELECT this_.PESS_CD_PESSOA as PESS1_0_0_, this_.PESS_NM_NOME as > > PESS2_0_0_ FROM PESSOA this_ WHERE (lower(this_.PESS_NM_NOME) > > like :p0);:p0 = 'ROBALO' > > > Thanks for help! > > > On 24 set, 05:26, "Richard Brown \(gmail\)" <[email protected]> > > wrote: > >> Hi Victor, > > >> Is this related to NH-1972? (http://nhjira.koah.net/browse/NH-1972) > > >> I'm not sure we have enough information to help yet. The > >> query-by-example > >> tests pass using the Oracle9iDialect. > > >> Are you able to provide a failing test case? > >> Or even the log output (including SQL) that your application is > >> generating? > > >> Cheers, > >> Richard > > >> -------------------------------------------------- > >> From: "Victor Hugo" <[email protected]> > >> Sent: Wednesday, September 23, 2009 6:56 PM > >> To: "nhusers" <[email protected]> > >> Subject: [nhusers] Re: bug in Query By Example > > >> > Sorry, > > >> > I forgot the most basic thing. > > >> > Follows: > > >> > public IList<BE> GetList<BE>(BE businessEntity,bool ignoreCase,bool > >> > enabledLike) > >> > { > >> > ICriteria criteria = Session.CreateCriteria(typeof(BE)); > >> > NHibernate.Criterion.Example example = > >> > NHibernate.Criterion.Example.Create(businessEntity); > > >> > if (ignoreCase == true) > >> > { > >> > example.IgnoreCase(); > >> > } > >> > if (enableLike == true) > >> > { > >> > example.EnableLike(); > >> > } > > >> > criteria.Add(example); > > >> > return criteria.List<BE>(); > >> > } > > >> > I was using MsOracleProvider and Oracle9Dialect, now i m using > >> > Oracle9iDialect with the same provider. > > >> > Both with .NET Framework 2.0 > > >> > Att, > > >> > Victor > > >> > On 23 set, 12:14, Fabio Maulo <[email protected]> wrote: > >> >> Try this.Get a break and go to take a coffee. > > >> >> After 10 minutes come back to read your mail and try to understand the > >> >> problem and give you a solution in the same way can do it somebody > >> >> haven't > >> >> seen your code. > > >> >> 2009/9/23 Victor Hugo <[email protected]> > > >> >> > I think i ve found a bug. After upgrading from 2.0 to 2.1, my pieces > >> >> > of code with "Query By Example" dont work anymore. > > >> >> > The code compiles, but at runtime time, the collections dont bring > >> >> > elements. > > >> >> > Anyone got this problem? > > >> >> > Att, > > >> >> > Victor > > >> >> -- > >> >> 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 -~----------~----~----~----~------~----~------~--~---
