java - How to call oracle function using Hibernate criteria? -
i new hibernate. building login portal. have used db function encrypt user password. seems using hibernate complex queries/functions/procedures on existing databases difficult. possible write below queries using hibernate criteria? sql query 1 :
select first_name user.emp_group username = 'xxx' , user.decrypt(password, 2) = 'yyyy';
sql query 2 :
select a.desc ,b.total user.status ,( select status ,count(*) total user.emp group status ) b a.type = b.status (+)
user
schema name , decrypt function name.
i faced problem getting data views resolved stackoverflow post. how hibernate retrieve data existing database view? that.
you can use native sql hibernate.
the way (for example):
string sql = "select first_name, salary employee"; sqlquery query = session.createsqlquery(sql); list data = query.list(); for(object object : data) { map row = (map)object; system.out.print("first name: " + row.get("first_name")); system.out.println(", salary: " + row.get("salary")); }
Comments
Post a Comment