Announcement Announcement Module
Collapse
No announcement yet.
Spring webapp database setup wizard on first run Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring webapp database setup wizard on first run

    I want my Spring 3.1 + JPA + Hibernate web app to have a set up wizard for database properties on first run. I use JPA annotations for my model layer and all the configurations are in xml format i.e (dispatcher-servlet.xml, application-context.xml, dataAccess.xml ). I have a pre-existing mysql.jdbc.properties files that is read to the application context during deployment using org.springframework.context.support.ReloadableReso urceBundleMessageSource bean class.
    My data configuration beans look like these:

    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
    </bean>

    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean"
    p:dataSource-ref="dataSource"
    packagesToScan-ref="jpaPackages"
    p:jpaVendorAdapter-ref="hibernateVendor"
    p:jpaPropertyMap-ref="jpaPropertyMap" />

    <util:list id="jpaPackages">
    <value>org.kemri.wellcome.dhisreport.api.model</value>
    <value>org.hisp.dhis.dxf2.importsummary</value>
    </util:list>

    <bean id="hibernateVendor" class="org.springframework.orm.jpa.vendor.Hibernat eJpaVendorAdapter"
    p:showSql="false"/>

    <util:map id="jpaPropertyMap">
    <entry key="hibernate.hbm2ddl.auto" value="update"/>
    <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
    </util:map>

    I want to allow the user to enter the database properties in a web browser(database name,url,username,password) then the app generates the database tables on web app first-run. How do I do that?
Working...
X