Announcement Announcement Module
Collapse
No announcement yet.
Persistence setup with DB2/400 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Do you have maven central in your list of repositories in your pom.xml. I don't, I assume it would just default back up to there. But all the files are out there, I don't seem to be able to resolve them.

    Comment


    • #17
      I got it to connect.

      I upgraded roo to 1.1.0.M3 and re-ran the persistence setup to add DB2400 as the datasource.

      However, that did not solve the issue.

      In applicationContext.xml, I modified it as follows:
      Code:
      	<bean id="dataSource" class="com.ibm.as400.access.AS400JDBCDataSource"
      		p:user="${database.user}"
              p:password="${database.password}"
              p:libraries="${database.libraries}" 
              p:translateBinary="${database.translateBinary}">
          	<constructor-arg index="0" value="${database.server}" />
          </bean>
      
          <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          	p:dataSource-ref="dataSource"
          	p:persistenceUnitName="persistenceUnit" />
      
          <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
          	p:entityManagerFactory-ref="entityManagerFactory" />
      
          <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
      Now it connects. It added jt400.jar version 6.7 and was able to connect.

      Now, i have to see why unit tests fail Seems to be failing based on the validation rules @NotNull, etc.

      Comment


      • #18
        Just on a side note, you don't really need to define an AS400JDBCDataSource unless you have a reason to. You can simply use what is generated by Roo, which is a org.apache.commons.dbcp.BasicDataSource. Both classes implement the DataSource interface.

        Comment


        • #19
          I got it...meant to post an update to my last post.

          I upgraded to spring roo 1.1.0.m3, but not all the dependencies were updated. Once i got all that ironed out, it now works the way spring roo created it.

          This is what spring roo 1.1.0.m3 generated
          Code:
              <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
                  <property name="driverClassName" value="${database.driverClassName}"/>
                  <property name="url" value="${database.url}"/>
                  <property name="username" value="${database.username}"/>
                  <property name="password" value="${database.password}"/>
              </bean>
          
              <bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
                  <property name="entityManagerFactory" ref="entityManagerFactory"/>
              </bean>
          
              <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
          
              <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
                  <property name="dataSource" ref="dataSource"/>
              </bean>
          and this is how it connects to db2400 without having to add a schema in an annotation
          Code:
          database.url=jdbc\:as400\://<SERVER>;libraries=<SCHEMA>
          Thanks again for all your help.

          Comment

          Working...
          X