Announcement Announcement Module
Collapse
No announcement yet.
iBats/Spring Sample Application Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • iBats/Spring Sample Application

    Hello,

    I am new to spring framework. I have read the data access methods and I feel iBatis is more suitable for my needs.

    Is there any easy, good and complete spring sample application that uses iBatis (other than jpetstore). I am unable to make appfuse working using iBatis.

    Many Thanks
    Binu

  • #2
    What are your issues with AppFuse and iBATIS? We'd be more than happy to help you on the AppFuse user mailing list ([email protected]). There's also a simpler version of AppFuse (Equinox) - I can build a Spring+iBATIS version of Equinox if you'd like.

    Matt

    Comment


    • #3
      iBats/Spring Sample Application

      Thanks Matt, It would be great if you make available a spring+iBatis version of equinox.

      BTW, I bought Spring Live from SourceBeat.

      Hope to hear from you soon.

      Binu

      Comment


      • #4
        Binu - great to hear you bought Spring Live. Make sure and send me an e-mail if you have any questions. You'll also want to watch the Spring Live Blog for updates to the book.

        I created a Spring+iBATIS version of Equinox that you can download at https://equinox.dev.java.net/files/d...ibatis-1.3.zip.

        Matt

        Comment


        • #5
          iBats/Spring Sample Application

          Thanks Matt, I will try out this and keep you troubling..

          Binu

          Comment


          • #6
            Spring+iBATIS version of Equinox

            Matt,

            How do I change this to work with MySQL exactly?

            1) DO I have to change classpath:jdbc.properties to classpath:jdbc.properties.mysql in applicationContext.xml?

            2) I think I should change jdbc.properties or jdbc.properties.mysql to work with MySQL.

            I get the error -- Could not obtain identity(); nested exception is java.sql.SQLException: General error message from server: "Table 'strutswithstruts.user_sequence' doesn't exist" --

            What are the changes needed in other files to get rid of looking for sequence nos ?

            Thanks
            Binu

            Comment


            • #7
              You have to run "ant createdb" to create the database from the create-hsqldb.sql in the "src/org/appfuse/dao/ibatis" directory. Then if you start Tomcat from the same directory that you ran Ant it, everything should work fine. Run "ant deploy" to deploy it to Tomcat.

              To switch to MySQL, replace jdbc.properties with jdbc.properties.mysql. You'll have to copy the create-hsqldb.sql to create-mysql.sql and then modify the "createdb" task in build.xml to make this work. Finally, you'll need to change the "userIncrementer" bean in web/WEB-INF/applicationContext-ibatis.xml to use a MySQLMaxValueIncrementor instead of HsqlMaxValueIncrementer.

              If you don't want to use the incrementor stuff, you'll have to modify the ibatis mapping files to get the last key inserted (which is proprietary for each database). Chapter 7 of Spring Live explains iBATIS and these different options.

              Matt

              Comment


              • #8
                MaxDB Issue

                Matt,

                Thanks, it worked.

                In this project, I have to use MaxDB as the database. So i was searching the corresponding MySQLMaxValueIncrementor method for MaxDB. I found that spring API does not support MaxDB specific functions. Am I correct? In that case, is it advisable to use MaxDB with spring?

                I have useed OracleSequenceMaxValueIncrementer to get the
                incrementor sequence id from MaxDB and it worked!

                Binu

                Comment

                Working...
                X