Hi All,
When I do a search using a Criteria and Example objects, it of course ignores letter case due to MS SQL Server case-insensitiviy by default.
For example, the following code:
Criteria c = s.createCriteria(Invoice.class);
Invoice exampleInvoice = new Invoice();
exampleInvoice.setName("Denis");
c.add(Example.create(exampleInvoice));
c.list()
will also return invoices with names "denis" or "DENIS".
However, this kinda affects Hibernate's cross-database portability and makes Example.ignoreCase() method actually depending on the database being used. For example, my code may stop working once I move to a database that is case sensitive by default.
Can all SQL Dialects, including SQL Server's one, be changed to do case sensitiviy by default and thus increase the portability? If I say "exampleInvoice.setName("Denis");" then I want to get invoices with names exactly "Denis" and i do not want to know or worry about underlying database specifics and I do not want to get bugs once database server has been changed.
Thanks.
Denis.
|