How to write the new Criteria Query in my case?

Ads
 

How to write the new Criteria Query in my case?

Hi expert,

I am using hibernate 5.2.1.

However, I do not know how to change the following deprecated code into the new Criteria Query.

My old code is :

try{ tx = session.getTransaction(); tx.begin(); session.flush();
Query query = (Query) session.createQuery("from tutor where tutorid = '" + tutor.getTutorid() + "'"); Tutor t = (Tutor)((org.hibernate.Query) query).uniqueResult(); tx.commit(); if(t !=null)result = true; }catch (Exception ex){ if(tx !=null){ tx.rollback();

Hope someone can advise me. Tk.s

View Answers

Ads









Related Tutorials/Questions & Answers:
How to use AND operator in hibernate Detached criteria query?
How to use AND OR operator in hibernate Detached criteria query?
Advertisements
How to use OR operator in hibernate Detached criteria query?
Hibernate Criteria Query Example Program
how to write a query for adding records in database
How to get unique list in Hibernate using Criteria Query?
How to write file text In New Line
Criteria Query Examples in Hibernate
Hibernate Criteria Query Example
how to call list objects as string into my sql query?
how do i use sql like query in my jsp page
How to execute my query fast..When A date filter is there in a query it takes more time for execution.?
Hibernate criteria query
Equal and Not Equal criteria query
Hibernate Criteria Query
Hibernate criteria query using avg()
Hibernate criteria query using Min().
Criteria Query Examples
how do i update my database with the help of update syntax in html <text/javascript>? How to write 'where' statement in this?
Hibernate Detached Criteria Subquery
plz solve my query?
Hibernate criteria query using Max()
find SQL query created by Criteria - Hibernate
Write Text To File In New Line.
Hibernate Criteria Detached Query And Subquery
Examples of Hibernate Criteria Query
Hibernate Criteria Query Example with source code
How to create wildcard query in Hibernate?
Write a query to insert a record into a table
Hibernate Criteria Query Example
Write a query to display a row using index

Ads