Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate Hibernate case sensitive comparison.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ratna rathor
Hibernate case sensitive comparison.
1 Answer(s)      2 years and 7 months ago
Posted in : Hibernate


How to check for case sensitive in Hibernate criteria?


Advertisement
View Answers

May 31, 2012 at 6:45 PM


package net.roseindia.main;

import java.util.*;
import net.roseindia.table.Employee;
import net.roseindia.util.ConnectionUtil;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

public class CaseSensitiveComprision{
    public static void main(String[] args){
        SessionFactory sessionFactory = ConnectionUtil.getSessionFactory();
        Session session = sessionFactory.openSession();
        Criteria criteria = session.createCriteria(Employee.class);
        criteria.add(Restrictions.eq("name", "Ron"));
        criteria.add(Restrictions.ge("salary",10000));
        List<Employee> employeeList = new ArrayList<Employee>();
        employeeList = criteria.list();
        Iterator it = employeeList.iterator();
        while ( it.hasNext()) {
            Employee employee = (Employee) it.next();
            System.out.println(employee.getName());
        }
        session.close();

    }
}

Output:
Hibernate: select this_.emp_id as emp1_0_0_, this_.date_of_join as date2_0_0_, this_.name as name0_0_, this_.salary as salary0_0_ from employee this_ where this_.name=? and this_.salary>=?
Ron

Description: Here you are comparing name to ?Ron? by using Restrictions.eq().and also comparing the salary for greater than and equal to ?10000?.

       Restrictions.eq() ?used for checking equality .
       Restrictions.ge()-used for checking greater than equal.
       Restrictions.gt()-comparing for greater value.
       Restrictions.le() ?checks for less than equal to
       Restrictions.lt() ?comparing for lesser value.


Related Tutorials/Questions & Answers:
Hibernate case sensitive comparison.
Hibernate case sensitive comparison.  How to check for case sensitive in Hibernate criteria?   package net.roseindia.main; import...(); } } Output: Hibernate: select this_.emp_id as emp1_0_0_, this_.date_of_join
Case-sensitive equals using Hibernate Criteria.
Case-sensitive equals using Hibernate Criteria.  How to check for case sensitive equals in Hibernate criteria?   package net.roseindia.main...()); } session.close(); } } Output: Hibernate: select this_.emp_id
Advertisements
uisearchbar case sensitive
uisearchbar case sensitive  uisearchbar case sensitive
XML is case-sensitive
XML is case-sensitive  hello, can some body can tell me that Is XML case-sensitive or not ?   HELLO MAN, YEAH, XML IS A CASE SENSITIVE LANGUAGE
XML case-sensitive
XML case-sensitive  Hi please anyone tell me Which parts of an XML document are case-sensitive? Thanks
Java is case sensitive
Java is case sensitive  hello, Why Java is case sensitive?   hii, Java is Platform Independent Language, so its used widely in very big... that huge no of variables,Java is Case Sensitive
MySQL Case Sensitive
MySQL Case Sensitive      ... sensitive is a term that tells you to check lettercase either upper case or lower case. In Windows, database and table names, table aliases are not case sensitive
PHP Variables Case Sensitive
PHP Variables Case Sensitive A variable is the location where we stores... declaring the variable in PHP, we always keep in mind that PHP is case sensitive. You should always remember that in which case you define the variable at the time
Hibernate Criteria Case Insensitive Search.
Hibernate Criteria Case Insensitive Search.  How to use Case Insensitive Search in Hibernate?   The Case Insensitive ignores the case... parameters. Create hibernate configuration file (hibernate.cfg.xml) and save
Hibernate Criteria Case Insensitive
Hibernate Criteria Case Insensitive The Case Insensitive ignores the case... = criteria.list(); An example of Case insensitive is given below please consider... as shown below: Hibernate: select this_.roll_no as roll1_0_0
Case-insensitive ordering using Hibernate Criteria.
Case-insensitive ordering using Hibernate Criteria.  What is Case-insensitive ordering in Hibernate Criteria
Case-insensitive equals using Hibernate Criteria.
Case-insensitive equals using Hibernate Criteria.  How to use Case-insensitive equals with Hibernate Criteria?   The Case Insensitive ignores the case of the latter. It Selects all the records of the table related
Case-insensitive search using Hibernate Query Language(HQL).
Case-insensitive search using Hibernate Query Language(HQL).  What is Case-insensitive search using Hibernate Query Language
Setting Case Sensitivity in a Regular Expression
the patter is either case sensitive or not. Actually, by default the patter is in the case sensitive. Whenever it need to be set for the case insensitivity then you... in case sensitive mode. By passing the Pattern.CASE_INSESITIVE field
Character Comparison Example
Character Comparison Example       In this section, you will learn how to compare characters in Java. The java.lang package provides a method for comparing two case
java string comparison example
java string comparison example  how to use equals method in String Comparison?   package Compare; public class StringTest { public... and using the method equals(), we have compared the strings. This method is case
Date comparison
Date comparison  Hi..i have developed an application in which i pop up a message by comparing the dates.the comparison is done by the current date and the date previously stored in the database.the database value is first
Matching Case
Matching Case  Hi, i want some code for matching case from an text file. i.e if i give an query called Java from the user,i need to get an output searching the text file all the names in that without case sensitive
Comparison of corresponding rows in a DB
Comparison of corresponding rows in a DB  How to compare corressponding rows in a database using Java????? ex...!!! Thankin u
comparison with null - Framework
comparison with null  String value = txtfld.getText(); if (value == null) ----- failing step----control goes to else part { // some code } else { // some code } Here comparison is not done.   Hi
Date comparison in PHP - PHP
Date comparison in PHP  I am looking for a date comparison code in PHP that can compare the date in between two different date formate.. for example: 11/12/1999 and 11/12/2001 to 11.11.1888 00:00:00 any idea on how
Comparison Operators
Comparison Operators Operator is used to perform operation on variable and values. Comparison Operators are used to compare two values. Given below the complete list of available comparison operator in PHP : OPERATOR NAME
Comparison date - JSP-Servlet
Comparison date  sir i need to display a new web page when system date is equal to given date.iit is like birthday.i am using tomact server.when birth date is reached,a new page should be displayed automatically saying happy
comparison with null - Framework
comparison with null  I am having one textfield, from which I am getting text using getText() method. Now I want to compare this value with null (i.e. to check whether the entered value is null or not) How should I check
Article Marketing ? Time-Sensitive vs. Timeless Information
Article Marketing ? Time-Sensitive vs. Timeless Information...-Sensitive: These appear as some kind of news such as world news, lawsuits, press... to submit articles which are time-sensitive only rarely and never frequently
Business case
Business case  hii, For which phase of RUP the "business case" for the project established ?   hello, Inception phase of RUP the "business case" for the project established
test case
test case  Hi Can you explain me how to write test case in java. regards kennedy
switch case
switch case  program to input 2 numbers and a choice.Using switch case we need to perform all the mathematical operation.Print a suitable error message if the choice is wrong
switch case
switch case  program to input 2 numbers and a choice.Using switch case we need to perform all the mathematical operation.Print a suitable error message if the choice is wrong
Comparison between the types of sorting in java
Comparison between the types of sorting in java  welcome all i wanna program in java compare between selection,insertion,bubble,merge,quick sort In terms of timer and put all types in frame and find the timer for example array
Mysql Date Comparison
Mysql Date Comparison       Mysql Date Comparison is used to return the date from a table on the basis of comparison between any two values of dates. Understand
 

 

 

DMCA.com