Showing posts with label Hibernate questions. Show all posts
Showing posts with label Hibernate questions. Show all posts

HR hibernate Interview Questions

0 comments Posted by Unknown at 18:29

What is component mapping in Hibernate?
  • A component is an object saved as a value, not as a reference
  • A component can be saved directly without needing to declare interfaces or identifier properties
  • Required to define an empty constructor
  • Shared references not supported
Read More »

Hibernate interview Questions Part1

0 comments Posted by Unknown at 18:28

What is Hibernate?


Hibernate is a powerful, high performance object/relational persistence and query service.It is an open-source technology which fits well both with Java and .NET technologies.Hibernate lets developers write persistence classes with hibernate query features of HQL within principles of Object Oriented paradigm.It means one can include association,inheritance,polymorphism,composition and collection of these persisting objects to build applications.

Hibernate Architecture

The main objective of Hibernate is to relieve the developers from manual handling of SQLs,JDBC APIs for resultsets handling and it helps in keeping your data portable to various SQL databases,just by switching the delegate and driver details in hibernate.cfg.xml file.
Read More »

Using Hibernate with Tomcat

0 comments Posted by Unknown at 18:26
Using Hibernate with Tomcat

If you use Hibernate on Tomcat you don't have to use Tomcat's JNDI-bound JDBC connections. You can let Hibernate manage the JDBC connection pool. This works on all versions of Tomcat and is very easy to configure.
First, create a hibernate.cfg.xml or hibernate.propertiesfile, as per documentation (no, property names in cfg.xml don't have to be prefixed with "hibernate.xxx"):
<!DOCTYPE hibernate-configuration PUBLIC 
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
<hibernate-configuration>
    <session-factory>
    
        <!-- Settings for a local HSQL (testing) database. -->
        <property name="dialect">org.hibernate.dialect.HSQLDialect</property>
        <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
        <property name="connection.url">jdbc:hsqldb:hsql://localhost</property>
        <property name="connection.username">sa</property>
        <property name="connection.password"></property>
 
        <!-- Use the C3P0 connection pool. -->
        <property name="c3p0.min_size">3</property>
        <property name="c3p0.max_size">5</property>
        <property name="c3p0.timeout">1800</property>
    
        <!-- Disable second-level cache. -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
        <property name="cache.use_query_cache">false</property>
        <property name="cache.use_minimal_puts">false</property>
        <property name="max_fetch_depth">3</property>
    
        <!-- Print SQL to stdout. -->
        <property name="show_sql">true</property>
        <property name="format_sql">true</property>
    
        <!-- Drop and then re-create schema on SessionFactory build, for testing. -->
        <property name="hbm2ddl.auto">create</property>
    
        <!-- Bind the getCurrentSession() method to the thread. -->
        <property name="current_session_context_class">thread</property>
 
        <!-- Hibernate XML mapping files -->
        <mapping resource="org/MyClass.hbm.xml"/>
    
        <!-- Hibernate Annotations (and package-info.java)
        <mapping package="org.mypackage"/>
        <mapping class="org.MyClass/>
        -->
 
    </session-factory>
 
</hibernate-configuration>
Now copy this file into your WEB-INF/classes directory of your web application. Copy hibernate3.jar into your WEB-INF/libdirectory and with it all required 3rd party libraries (see lib/README.txt in the Hibernate distribution). Don't forget to also copy your JDBC driver to common/libor WEB-INF/lib. Never ever copy anything in Tomcat into a global directory outside of your web application or you are in classloader hell!
Start Hibernate by building a SessionFactory, as shown here with HibernateUtil.
This listener initializes and closes Hibernate on deployment and undeployment, instead of the first user request hitting the application:
public class HibernateListener implements ServletContextListener {
 
    public void contextInitialized(ServletContextEvent event) {
        HibernateUtil.getSessionFactory(); // Just call the static initializer of that class    
    }
 
    public void contextDestroyed(ServletContextEvent event) {
        HibernateUtil.getSessionFactory().close(); // Free all resources
    }
}
Add it to your web.xml:
<listener>
    <listener-class>org.mypackage.HibernateListener</listener-class>
</listener>


click the Below link download this file 
Read More »

Tcs Hibernate questions and answers

6 comments Posted by Unknown at 18:22

What is Hibernate?


Hibernate is a powerful, high performance object/relational persistence and query service.It is an open-source technology which fits well both with Java and .NET technologies.Hibernate lets developers write persistence classes with hibernate query features of HQL within principles of Object Oriented paradigm.It means one can include association,inheritance,polymorphism,composition and collection of these persisting objects to build applications.

Hibernate Architecture

The main objective of Hibernate is to relieve the developers from manual handling of SQLs,JDBC APIs for resultsets handling and it helps in keeping your data portable to various SQL databases,just by switching the delegate and driver details in hibernate.cfg.xml file.
Hibernate offers sophisticated query options, you can write plain SQL, object-oriented HQL (Hibernate Query Language), or create programmatic criteria and example queries. Hibernate can optimize object loading all the time, with various fetching and caching options.
Some snapshots of Hibernate:
-Free open source
-OO Concepts can be implemented.
-A rich variety of mappings for collections and dependent objects
-No extra code generation or bytecode processing steps in your build procedure
-Great performance, has a dual-layer cache architecture, and may be used in a cluster
-Its own query language support
Read More »
 

© 2011. All Rights Reserved | Interview Questions | Template by Blogger Widgets

Home | About | Top