ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Maves" <nathan.ma...@gmail.com>
Subject Re: Updating from ibatis 1.3.1 to 2.1.7 .. should I? Does it worth the effort?: ... Upgrade question II
Date Wed, 16 Aug 2006 14:42:41 GMT
Not sure what you are asking?  If you are asking if you have to keep all of
your sqlMaps in the main config file then the answer is no.

Here is an example of a sqm map config file that includes multiple sqlMap
files.

<sqlMapConfig>

    <properties resource="lighthouse/resources/database.properties"/>

    <settings
    cacheModelsEnabled="true"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"
    useStatementNamespaces="false"/>

    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="${JDBC.Driver}"/>
            <property name="JDBC.ConnectionURL" value="${JDBC.ConnectionURL
}"/>
            <property name="JDBC.Username" value="${JDBC.Username}"/>
            <property name="JDBC.Password" value="${JDBC.Password}"/>
            <property name="Pool.MaximumActiveConnections" value="${
Pool.MaximumActiveConnections}"/>
            <property name="Pool.MaximumIdleConnections" value="${
Pool.MaximumIdleConnections}"/>
        </dataSource>
    </transactionManager>

    <!-- SQLMaps go here -->

    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Load.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Metrics.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Note.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Hierarchy.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Thresholds.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/Trend.xml"/>
    <sqlMap resource="lighthouse/persistence/sqlMapDao/sql/CaseData.xml"/>

</sqlMapConfig>

As a side note your main sql map config could be called anything you want
:)  Here is an example of the sqlmap dao framework with a sqlmapConfig file
called myConfig.xml

<transactionManager type="SQLMAP">
      <property name="SqlMapConfigResource"
        value="lighthouse/persistence/sqlMapDao/myConfig.xml"/>
    </transactionManager>

On 8/16/06, David Gagnon <dgagnon@siunik.com> wrote:
>
> Hi all,
>
>   Another question:
> -I created an sqlMapConfig but it seems that from the sqlMap you cannot
> load the sqlMapConfig (i.e.: global config).  I really need to declare
> all my sqlMap in sqlMapCOnfig.xml???
>
> I use this code in my DAO to load the corresponding sqlMap:
>
> sqlNewMap =
> XmlSqlMapBuilder.buildSqlMap(ResourceManager.getResourceAsReader(file));
>
> I seem to still be valid but this piece of code tells to load the sqlMap
> directly.  How can you link to the sqlMapConfig?
>
> Thanks for your help !!!
> /David
>
>
>   David Gagnon wrote:
> > Hi all,
> >
> >  I'm in the process of upgrading now and I found answer to some of my
> > questions but I was wondering what should I do with the modification I
> > made.  I created  PaginatedDataListWithRowCount class because I need
> > to have the number of row returned when I used a paginatedDataList.
> > This way I can show the number of row on the screen.  I was wondering
> > what was the official way to implements that?  I doubt that I chose
> > the right way when I did it 3 years ago!
> >
> > Thanks for your advice.. I'm proceeding with the upgrade now :-)
> > /David
> >
> >
> >
> >
> >
> >
> >
> >> You can set it with the resultSetType attribute of the <select>
> element.
> >>
> >> PS:  2.2.0 is coming out in a few days.  Feel free to continue your
> >> upgrade efforts, as it will be compatible, but I'd suggest going to
> >> production with 2.2.0 (after testing of course).
> >>
> >> Cheers,
> >> Clinton
> >>
> >> On 8/14/06, *David Gagnon* <dgagnon@siunik.com
> >> <mailto:dgagnon@siunik.com>> wrote:
> >>
> >>     Hi,
> >>
> >>       Thanks for the help!  I will then ;-)
> >>
> >>     I'm using 1.5 so this shouldn`t be a problem.
> >>
> >>     Maybe another question that you may answer since your know well
> >>     all the
> >>     db stuff.  I came to the idea of upgrading ibatis because I tried
> to
> >>     upgrade my postgresql jdbc driver.  I get this exception:
> >>
> >>     DEBUG [main] ( MappedStatement.java:908)  2006-08-14 13:23:03,000
> >>     : Error
> >>     executing 'role.getList' in '[Reader passed to buildSqlMap()]'.
> >> Check
> >>     the SQL statement. Cause: org.postgresql.util.PSQLException:
> >>     L'opération
> >>     nécessite un scrollable ResultSet, mais ce ResultSet est
> >>     FORWARD_ONLY.
> >>     org.postgresql.util.PSQLException: L'opération nécessite un
> >> scrollable
> >>     ResultSet, mais ce ResultSet est FORWARD_ONLY.
> >>         at
> >>
> >> com.ibatis.db.sqlmap.MappedStatement.runQueryForList(
> MappedStatement.java:908)
> >>
> >>         at
> >>
> >> com.ibatis.db.sqlmap.MappedStatement.executeQueryForList(
> MappedStatement.java:665)
> >>
> >>         at
> >>
> >> com.ibatis.db.sqlmap.MappedStatement.executeQueryForList(
> MappedStatement.java:643)
> >>
> >>
> >>
> >>     (sorry for the french exception)  But it complain about the
> >> resultSet
> >>     being Forward_Only.  I check and found that the type of ResulSet
> >>     must be
> >>     given in the prepareStatement.  But I search the source of 2.1.7and
> >>     didn`t find a place where this was set.  Will I run into the same
> >>     problem with 2.1.7 ?  Any Idea how to fix this problem ?
> >>
> >>     Anyway Thanks for the help!
> >>
> >>     Best Regards
> >>     /David
> >>
> >>     Clinton Begin wrote:
> >>     > YES! CONCURE!!!   ;-)
> >>     >
> >>     > David:  Are you using JDK 1.4 or greater?
> >>     >
> >>     > Cheers,
> >>     > Clinton
> >>     >
> >>     >
> >>     >
> >>     >
> >>     > On 8/14/06, *Nathan Maves* < nathan.maves@gmail.com
> >>     <mailto:nathan.maves@gmail.com>
> >>     > <mailto: nathan.maves@gmail.com
> >>     <mailto:nathan.maves@gmail.com>>> wrote:
> >>     >
> >>     >     I even *concur* :)
> >>     >
> >>     >
> >>     >     On 8/14/06, *Nathan Maves* <nathan.maves@gmail.com
> >>     <mailto:nathan.maves@gmail.com>
> >>     >     <mailto: nathan.maves@gmail.com
> >>     <mailto:nathan.maves@gmail.com>>> wrote:
> >>     >
> >>     >         I concure.  Please upgrade and let us know if you have
> any
> >>     >         problems.
> >>     >
> >>     >         nathan
> >>     >
> >>     >
> >>     >
> >>     >         On 8/14/06, *Jeff Butler* <jeffgbutler@gmail.com
> >>     <mailto:jeffgbutler@gmail.com>
> >>     >         <mailto:jeffgbutler@gmail.com
> >>     <mailto:jeffgbutler@gmail.com>>> wrote:
> >>     >
> >>     >             You can use the Ant task to upgrade your sql maps,
> >>     or just
> >>     >             a find/replace.  On one project with about 80 result
> >>     maps
> >>     >             I did it with find/replace - it's pretty easy.
> >>     >
> >>     >             The only real issue we had with upgrading that
> >>     project is
> >>     >             that iBATIS 2.x will throw an exception if you
> >> execute a
> >>     >             queryForObject but the query returns more than one
> >> row.
> >>     >             This has actually helped us find several errors in
> our
> >>     >             code, but it was hard to test all the code paths to
> >> root
> >>     >             out these errors.  We still find them every once in
> >>     a while!
> >>     >
> >>     >             Other than that, I'll say YES - definitely
> >> upgrade.  We
> >>     >             don't support version 1.x anymore
> >>     >
> >>     >             Jeff Butler
> >>     >
> >>     >
> >>     >             On 8/14/06, *David Gagnon* < dgagnon@siunik.com
> >>     <mailto:dgagnon@siunik.com>
> >>     >             <mailto:dgagnon@siunik.com
> >>     <mailto:dgagnon@siunik.com>> > wrote:
> >>     >
> >>     >                 Hi all,
> >>     >
> >>     >                 I've been working with ibatis for several years
> >> but
> >>     >                 because version
> >>     >                 1.3+ wasn't supporting multiple datasource in the
> >>     >                 sqlmap I didn't update
> >>     >                 since this time:-(  I don't have this limitation
> >>     >                 anymore and  I wonder
> >>     >                 if the upgrade worth the effort.
> >>     >
> >>     >                 I probably have arroud 60 sql maps.  I patched
> >>     1.3 to
> >>     >                 support some
> >>     >                 custom type too!  Is 2.1.7 is faster ?
> >>     >
> >>     >                 Too for the migration path what is that gone be
> >>     >                 hard?  I remembered I
> >>     >                 need to use some ant task to convert my map to
> >>     the new
> >>     >                 format.
> >>     >
> >>     >                 Since the gap is growing between the releases it
> >>     >                 getting more and more
> >>     >                 difficult  to have a clear view...
> >>     >
> >>     >                 Thanks for any help.. it`s really appreciated!
> >>     >                 Best Regards
> >>     >                 /David
> >>     >
> >>     >
> >>     >
> >>     >
> >>     >
> >>
> >>
> >>
> >
> >
> >
> >
> >
>
>
>

Mime
View raw message