1.
Why is addScalar() used in the following Hibernate code:
Double max = (Double) sess.createSQLQuery("select max(b.weight) as maxWeight from books b")
.addScalar("maxWeight", Hibernate.DOUBLE);
.uniqueResult();
2.
In Hibernate, what is the output of the following SQL statement:
SELECT SUBSTR('741258963', INSTR(xyzxyzxyz','y'), 4) FROM EMP;
3.
In Hibernate, consider the following table named employees: |emp_id | emp_name| |:-:||:-:| |1| Brush| |2| Jerrin|
What is the output of the following query:
Select count(*) from employees
4.
______________________ instance objects are created in the following Hibernate code.
Configuration cfg=new Configuration();
cfg=cfg.configure();
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.openSession();
tx=session.beginTransaction();
Customer c1=new Customer("sd","sd@gmail","Bangalore");
session.save(c1);
Customer c2=new Customer("pd","pd@gmail","Bangalore");
session.save(c2);
5.
________________ instance objects are created in the following Hibernate code.
Configuration cfg=new Configuration();
cfg=(AnnotationConfiguration)cfg.configure();
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.openSession();
tx=session.beginTransaction();
Customer c1=new Customer("sd","sd@gmail","Bangalore");
session.save(c1);
Customer c2=new Customer("pd","pd@gmail","Bangalore");
session.save(c2);
6.
In the following Hibernate code, which of these lines create the primary key for Customer.hbm.xml:
 
  <hibernate-mapping>/*Line 1*/

 
 
    <class name="com.jlcindia.hibernate.Customer" table="customers">/*Line 2*/

 
 
    <id name="cid" column="cid" type="int">/*Line 3*/
    <generator class="increment"/>/*Line 4*/
    </id>/*Line 5*/

 
 
    <property name="cname"/>/*Line 6*/
    <property name="email"/>/*Line 7*/
    <property name="phone" type="double"/>/*Line 8*/
    <property name="city"/>/*Line 9*/
    <property name="bal" type="double"/>/*Line 10*/

 
 
    </class>/*Line 11*/

 
 
    </hibernate-mapping>/*Line 12*/