Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate DataSource in hibernate.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ratna rathor
DataSource in hibernate.
1 Answer(s)      2 years and 6 months ago
Posted in : Hibernate


What is DataSource in hibernate?


Advertisement
View Answers

May 30, 2012 at 7:21 PM


Generally, in spring hibernate integration or struts hibernate integration we set data source class for integration. Here is a example of spring hibernate integration- dispatcher-servelet.xml configration file.This is saved in WEB-INF -

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <!-- Enable annotation driven controllers, validation etc... -->
    <!-- Spring Web Mapping -->
    <context:component-scan base-package="net.roseindia.controller" />


    <bean id="viewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/views/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

    <!-- Spring Web Mapping End-->

    <!-- Spring Hibernate Mapping -->

    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/spring_hibernate" />
        <property name="username" value="root" />
        <property name="password" value="root" />
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="annotatedClasses">
            <list>
                <value>net.roseindia.domain.Student</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">none</prop>
            </props>
        </property>
    </bean>

    <!-- Spring Message Resources Mapping End-->
    <bean id="studentDao" class="net.roseindia.dao.daoImpl.StudentDaoImpl">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
<bean id="service" class="net.roseindia.services.impl.StudentServiceImpl">
        <property name="studentDao" ref="studentDao" />
    </bean>


</beans>


Related Tutorials/Questions & Answers:
DataSource in hibernate.
DataSource in hibernate.  What is DataSource in hibernate?   Generally, in spring hibernate integration or struts hibernate integration we set data source class for integration. Here is a example of spring hibernate
hibernate tomcat
In this section, you will learn about Hibernate datasource configuration in Tomcat
Advertisements
hibernate jndi
In this section, you will learn about configuring hibernate to connect to database via JNDI datasource
datasource in jsp using struts
datasource in jsp using struts  how to get the datasource object in jsp.datasource is configured in struts-config.xml
Datasource - JSP-Servlet
Datasource   in web.xml datasource com.zetcode.DataSourceExample /DataSource datasource in index.jsp when i deploy the application i am getting
property datasource required - Spring
property datasource required  Hi I am using java springs I am using mysql as backend I am getting one error when i compile the application.property datasource required. This is my dispatcher-servlet.xml
Managing Datasource in struts Application
Managing Datasource in struts Application  Hi i need to know how to do set up of Oracle data base with struts using Data source.I have defined datasource in struts-config.xml as data-sources> <data-source type
configure Datasource in enterprise application - EJB
configure Datasource in enterprise application  I wanted to know that how can configure the DataSource in the Enterprise Application.Thanks Rohit Chauhan  which type of IDE u r using???If NetBeans ..Then i have
JDBC DataSource Example
; } JDBC DataSource Example You can establish a connection to a database either using DriverManager class or DataSource interface. JDBC DataSource... application program. DataSource object increases the application portability
Registering DataSource with JNDI
; } Registering The DataSource With JNDI Java Naming Directory Interface (JNDI... for objects for their associating attributes etc. An Example of DataSource...(); ConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource
How to create datasource and connectionpool in websphere 6.0 - Java Beginners
How to create datasource and connectionpool in websphere 6.0  how to create datasource and connection pool in websphere version 6.0? and give complete example on connectionpool datasource
UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath  HI, What is the solution of UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath error? Thanks
How to create datasource and connectionpool in weblogic 9.1 - Java Beginners
How to create datasource and connectionpool in weblogic 9.1  How to create datasource and connectionpool in weblogic 9.1? give compleate example on connectionpool datasourceusin weblogic 9.1
Configuring Struts DataSource Manager on Tomcat 5
Configuring Struts DataSource Manager on Tomcat 5... can configure Struts DataSource Manager on the Tomcat 5.5.9 server. We will use... DataSource Manager to use MySQL Database and use the connection provided by Struts
HIBERNATE
HIBERNATE   What is difference between Jdbc and Hibernate
hibernate
hibernate  what is hibernate flow
hibernate
hibernate  what is hibernate listeners
windows authentication with hibernate - Hibernate
windows authentication with hibernate  Does anyone know how to setup a datasource for SQL Server that uses Windows authentication instead of SQL Server mixed mood authentication? Is it possible with hibernate framwork? Thanks
Hibernate
Hibernate  how to use pagination concept in Hibernate
hibernate
hibernate  what is hibernate why we use
Hibernate
Hibernate  hibernate delete query execution
hibernate
hibernate  please give me the link where i can freely download hibernate software(with dependencies)   Learn hibernate, if you want to learn hibernate, please visit the following link: Hibernate Tutorials
hibernate
hibernate  how to uses optional column in hibernate
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
hibernate
why hibernate?  why hibernate?   Hibernate: -Hibernate... library. It solves object-relational impedance mismatch problems. Hibernate makes the application development process easy Hibernate saves the development
Hibernate
Hibernate  Please tell me the difference between hibernate and jdbc
hibernate
hibernate  why we should use hibernate projection
hibernate
hibernate  pls give one simple example program for hibernate
 

 

 

DMCA.com