Results 1 to 5 of 5

Thread: HIbernate POJO generater

  1. #1
    Join Date
    Jun 2010
    Posts
    2

    Default HIbernate POJO generater

    Hi ,

    I m new to hibernate and spring . I generated the data layer code using hibernate POJO generator with mysql DB after database work is over . configured well and application was working well. But now I wanna make a slight change , changing the database name in the config file (need to connect another database consisting same structure but data different) .

    Still it was going to the old database and retaining the old data


    --------- actual config file ---------------
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property>
    <property name="url"><value>jdbc:mysql://localhost/goals</value> </property>
    <property name="username"><value>root</value></property>
    <property name="password"><value>test</value></property>
    </bean>


    -------- new config file changed database name in the URL ----------

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property>
    <property name="url"><value>jdbc:mysql://localhost/magic</value> </property>
    <property name="username"><value>root</value></property>
    <property name="password"><value>test</value></property>
    </bean>





    can anyone please help

  2. #2
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    285

    Default

    What is the problem you are facing?
    Amila Domingo

  3. #3

    Default

    Use the property override configurator instead (i.e. just create a properties file to override the settings you want)

  4. #4
    Join Date
    Nov 2010
    Posts
    1

    Default

    use org.springframework.beans.factory.config.PropertyP laceholderConfigurer bean factory post processor

    oracle.properties
    ============
    db.driverClassName=oracle.jdbc.driver.OracleDriver
    db.url=jdbc:oracle:thin:@db-server:1521:db-schema
    db.username=username
    db.password=password

    applicationcontext.xml
    =================

    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer ">
    <property name="location"><value>Oracle.properties</value> </property>
    </bean>
    <bean id="dataSource" destroy-method="close">
    <property name="driverClassName"><value>${db.driverClassName }</value></property>
    <property name="url"><value>${db.url}</value></property>
    <property name="username"><value>${db.username}</value></property>
    <property name="password"><value>${db.password}</value></property>
    </bean>

  5. #5
    Join Date
    Mar 2011
    Posts
    1

    Default

    Sounds complicated!

    How about a web-based code generator that produces for you:

    - DDL statement for your DB table
    - JavaBean class to represent rows in the table
    - Full-CRUD (Create/Read/Update/Delete) JDBC DAO class
    - A full-CRUD, working web application (UI) with modern AJAX tachniques

    Basically everything you need to implement a new feature that involves a new DB table. Better than Grails, and it's all pure Java, and totally free.

    You're gonna love this, check it out here: http://www.timechannels.com/WhatIsPOJOJenerator

    John

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •