Announcement Announcement Module
Collapse
No announcement yet.
Spring and Hibernate Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring and Hibernate

    Try to set up spring to work with hibernate. Tried several examples. None of them worked. I suspect I may miss some jar files. What are the jar files for setting up:

    <bean id="sessionFactory" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">

    OR

    <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">

    OR

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">


    Thanks

    Scott

  • #2
    While spring documentation is the right place where you can find the related details, I would say that the second and third options are needed for configuring the datasource and session factory and a txmanager would also be required further for you to complete the application configuration.

    Check this article out on Spring integration with Hibernate. I am sure that would help you a lot!

    Comment


    • #3
      Jars needed for Spring Hibernate Integration

      What are the Jar Files needed for Spring Hibernate Integration? And where to download, if any?


      Thanks

      Scott

      Comment


      • #4
        Hibernate - Spring

        Hello,

        If you are using spring 2.5 download spring with dependencies zip file, when you extract zip file you see several folders out of these in the library you require are in "spring2.5/lib/hibernate". This is the download link. http://www.springsource.org/download.
        I did configure it, and I needed atleast hibernate3.jar, spring.jar, spring-hibernate3.jar and configuration files like hsqlbd.jar if you are using hsqldb or mysql-connector-java-5.x.jar if you are using mysql database.

        Below I am showing how you can configure your datasource:
        <!-- Hibernate -->
        <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost/mydb" />
        <property name="username" value="userroot" />
        <property name="password" value="userroot" />
        </bean>

        of course you give your own parameters for database name as well as username & password.

        Comment

        Working...
        X