Results 1 to 2 of 2

Thread: Derby + spring + JPA : how to access embeded derby db

  1. #1

    Default Derby + spring + JPA : how to access embeded derby db

    Hello,
    I have used Roo to generate code by reverse engineering on MYSQL. I have got the code ready and working fine with MYSQL . But now my requirement has changed and I have to use embedded Derby database in place of MYSQL. I have done changes related to it in context.xml and its connecting to the derby db as well.
    Context.xml
    Code:
    <bean id="dataSource"
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
    		<property name="url"
    			value="jdbc:derby:target/database/message;create=true" />
    		<property name="username" value="app" />
    		<property name="password" value="app" />
    	</bean>
    
    	<bean id="entityManagerFactory"
    		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    		<property name="dataSource" ref="dataSource"></property>
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
    				<property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect" />
    			</bean>
    		</property>
    		<property name="jpaProperties">
    			<props>
    				<prop key="hibernate.hbm2ddl.auto">update</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hbm2ddl.auto">update</prop>
    			</props>
    		</property>
    		
    	</bean>
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
        <property name="dataSource" ref="dataSource" />
      </bean>
    Below are console details. However the funny part is , when I connect using sqirrel to connect to this derby db-url I dont see any tables created , not on eveh inserting of any record through application. I can see sqls printed on console too . Can any one please help me in, how can I view and admin the data from squirrel or is there any thing I am missing or using incorrectly?

    Code:
    [STDOUT] INFO  2012-07-26 13:58:41,944   [main] o.h.tool.hbm2ddl.SchemaUpdate - updating schema
    [STDOUT] INFO  2012-07-26 13:58:42,110   [main] o.h.tool.hbm2ddl.TableMetadata - table found: .APP.D
    EVICE_ISCI_INFO
    [STDOUT] INFO  2012-07-26 13:58:42,110   [main] o.h.tool.hbm2ddl.TableMetadata - columns: [iscsi_inf
    o, id, active, device_id]
    [STDOUT] INFO  2012-07-26 13:58:42,110   [main] o.h.tool.hbm2ddl.TableMetadata - foreign keys: [fk87
    8d35d479fc905f]
    [STDOUT] INFO  2012-07-26 13:58:42,110   [main] o.h.tool.hbm2ddl.TableMetadata - indexes: [sql120726
    135010710, sql120726135010840]
    [STDOUT] INFO  2012-07-26 13:58:42,124   [main] o.h.tool.hbm2ddl.TableMetadata - table found: .APP.D
    EVICE_RAID_INFO
    [STDOUT] INFO  2012-07-26 13:58:42,124   [main] o.h.tool.hbm2ddl.TableMetadata - columns: [id, activ
    e, device_id, raid_info]
    [STDOUT] INFO  2012-07-26 13:58:42,124   [main] o.h.tool.hbm2ddl.TableMetadata - foreign keys: [fka4
    fd1d9a79fc905f]
    [STDOUT] INFO  2012-07-26 13:58:42,124   [main] o.h.tool.hbm2ddl.TableMetadata - indexes: [sql120726
    135010750, sql120726135010870]
    [STDOUT] INFO  2012-07-26 13:58:42,136   [main] o.h.tool.hbm2ddl.TableMetadata - table found: .APP.P
    ERFORMANCE_DATA
    [STDOUT] INFO  2012-07-26 13:58:42,137   [main] o.h.tool.hbm2ddl.TableMetadata - columns: [iops, tim
    e_duration, mo_ref_id, active, device_id]

  2. #2

    Default

    got the solution of this problem. I am using maven + embedded jetty , the data base was getting created in maven modules target folder names 'messages'. for accessing the db , I have to shut down jetty since embedded derby cannt accept multiple client connections .

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
  •