Thursday, 16 February 2012

60 TOP Hibernate Interview Questions and Answers for Freshers pdf

Hibernate Interview Questions and Answers for experienced pdf
1. What is Hibernate? 
2. What is ORM? 
3. What does an ORM solution comprises of? 
4. What are the different levels of ORM quality? 
5. What is a pure relational ORM? 
6. What is a meant by light object mapping? 
7. What is a meant by medium object mapping? 
8. What is meant by full object mapping? 
9. What are the benefits of ORM and Hibernate? 
10. How does hibernate code looks like? 
11. What is a hibernate xml mapping document and how does it look like? 
12. What are the benefits of HibernateTemplate? 
13. What the Core interfaces are of hibernate framework? 
14. What are Callback interfaces? 
15. What are Extension interfaces? 
16. What are the Extension interfaces that are there in hibernate? 
17. What are different environments to configure hibernate? 
18. What is the file extension you use for hibernate mapping file? 
19. What do you create a SessionFactory? 
20. What is meant by Method chaining? 
21. What does hibernate.properties file consist of? 
22. What should SessionFactory be placed so that it can be easily accessed? 
23. What are POJOs? 
24. What is object/relational mapping metadata? 
25. What is HQL? 
26. What are the different types of property and class mappings? 
27. What is Attribute Oriented Programming? 
28. What are the different methods of identifying an object? 
29. What are the different approaches to represent an inheritance hierarchy? 
30. What are managed associations and hibernate associations? 
31. Why do you need ORM tool like Hibernate?
32. What are the main advantages of ORM like hibernate?
33. What are the core interfaces of Hibernate framework? 
34. Explain how to configure Hibernate? 
35. What is a HibernateTemplate? 
36. What is Hibernate proxy?
37. What are Collection types in Hibernate?
38. What is lazy initialization in hibernate? 
39. What is lazy fetching in hibernate?
40. What is the difference between sorted and ordered collection in hibernate? 
41. Explain the advantages and disadvantages of detached objects? 
42. What is Hibernate Query Language (HQL)? 
43. Explain the general flow of Hibernate communication with RDBMS?. 
44. Explain the role of Session interface in Hibernate?
45. State the role of SessionFactory interface plays in Hibernate?
46. What is the difference between merge and update? 
47. What is the advantage of Hibernate over jdbc? 
48. Why hibernate is advantageous over Entity Beans & JDBC? 
49. Explain the main difference between Entity Beans and Hibernate? 
50. Explain the difference between hibernate and Spring?
51. How will you configure Hibernate?
52. What is a SessionFactory? Is it a thread-safe object?
53. What is a Session? Can you share a session object between different threads?
54. What are the benefits of detached objects?
55. What are the pros and cons of detached objects?
56. How does Hibernate distinguish between transient (i.e. newly instantiated) and detached objects?
57. What is the difference between the session.update() method and the session.lock() method?
58. How would you reatach detached objects to a session when the same object has already been loaded into the session?
59. What are the general considerations or best practices for defining your Hibernate persistent classes?
60.  What is the difference between the session.update() method and the session.lock() method?

How to Make Updates to Updatable Result Sets in JDBC? | Java JDBC


Another new feature in the JDBC 2.0 API is the ability to update rows in a result set using methods in the Java programming language rather than having to send an SQL command. But before you can take advantage of this capability, you need to create a ResultSet object that is updatable. In order to do this, you supply the ResultSet constant CONCUR_UPDATABLE to the createStatement method.
E.g.
Connection con = DriverManager.getConnection(”jdbc:mySubprotocol:mySubName”);
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = (”SELECT COF_NAME, PRICE FROM COFFEES”); 

How to call a Stored Procedure from JDBC? | Java JDBC


The first step is to create a CallableStatement object. As with Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure;
E.g.
CallableStatement cs = con.prepareCall(”{call SHOW_SUPPLIERS}”);
ResultSet rs = cs.executeQuery(); 

How can you use PreparedStatement in JDBC? | Java JDBC


This special type of statement is derived from the more general class, Statement. If you want to execute a Statement object many times, it will normally reduce execution time to use a PreparedStatement object instead. The advantage to this is that in most cases, this SQL statement will be sent to the DBMS right away, where it will be compiled. As a result, the PreparedStatement object contains not just an SQL statement, but an SQL statement that has been precompiled. This means that when the PreparedStatement is executed, the DBMS can just run the PreparedStatement ’s SQL statement without having to compile it first.
E.g.
PreparedStatement updateSales = con.prepareStatement(”UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?”); 

Wednesday, 15 February 2012

What type of sound file formats can I use for the applets? | Java Applets

Java vi .02 only supports the ‘voice format” of the .au sound files. This is also know as “μ-law, 8/16-bit, mono, 8000hz sample rate"

How do you Canvas? | Java Applets

The Canvas class of java.awt is used to provide custom drawing and event handling. It provides a general GUI component for drawing images and text on the screen it does not support any drawing methods of its own, but provides access to a Graphics object through its paint() method. The paint() method is invoked upon the creation and update of a canvas so that the Graphics object associated with a Canvas object can be updated.

What is Difference between AWT and Swing? | Java Applets

Swing provides a richer set of components than AWT. They are 100% Java-based. AWT on the other hand was developed with the mind set that if a component or capability of a component werent available on one platform, it wouldnt be available on any platform. Due to the peer-based nature of AWT, what might work on one implementation might not work on another, as the peer-integration might not be as robust. There are a few other advantages to Swing over AWT:
  1. Swing provides both additional components and added functionality to AWTr eplacement components
  2. Swing components can change their appearance based on the current “look and feel” libraiy that’s being used
  3. Swing components follow the Model-View-Controller (MVC) paradigm, and thus can provide a much more flexible UI.
  4. Swing provides “extras’ for components, such as:
  5. Icons on many components
  6. Decorative borders for components
  7. Tool tips for components
  8. Swing components are lightweight (less resource intensive than AWT)
  9. Swing provides built-in double buffering
  10. Swing provides paint debugging support for when you build your own components
Swing also has a few disadvantages:
  1. It requires Java 2 or a separate JAR file
  2. If you’re not very careful when programming, it can be slower than AWT (all components are drawn)
  3. Swing components that look like native components might not act exactly like native components.