Niels,

 

For the block below I get an exception. The property SELECTKEY_TYPE is definitely set to “post”.

 

com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: org.xml.sax.SAXParseException: Attribute "type" with value "${SELECTKEY_TYPE}" must have a value from the list "pre post ".

            at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89)

            at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:75)

            at com.intland.codebeamer.persistence.rdbms.DataAccessSupport.getSqlMapInstance(DataAccessSupport.java:152)

            at com.intland.codebeamer.persistence.dao.AbstractDao.getSqlMapInstance(AbstractDao.java:70)

            at com.intland.codebeamer.persistence.dao.AbstractDao.create(AbstractDao.java:83)

 

 

 

  <insert id="createTrackerItem" parameterClass="trackerItemDto">

            INSERT INTO task

              ( ${PRE_ID_COMMENT}id,${POST_ID_COMMENT} type_id, parent_id, status_id, priority,

                        submitted_at, submitted_by, modified_at, modified_by, assigned_at, approver_user_id,

                        summary, details, ishtml, start_date, close_date, estimated_hours, spent_hours,

                        nr_of_attachments, closed_at, indexed, isdeleted)

            VALUES

              ( ${PRE_ID_COMMENT}#id#,${POST_ID_COMMENT} #tracker.id#, #parent.id#, #status.id#, #priority#,

                #submittedAt#, #submitter.id#, #modifiedAt#, #modifier.id#, #assignedAt#, #approver#,

                        #name#, #description#, #descriptionFormat#, #startDate#, #endDate#, #estimatedHours#, #spentHours#,

                        #noOfAttachments#, #closedAt#, #indexed#, #deleted#)

            <selectKey resultClass="java.lang.Integer" keyProperty="id" type="${SELECTKEY_TYPE}" >

              ${SELECTKEY_BEFORE_TABLE_NAME_SQL_PART}task${SELECTKEY_AFTER_TABLE_NAME_SQL_PART}

            </selectKey>

  </insert>

 

Zsolt


From: Niels Beekman [mailto:n.beekman@wis.nl]
Sent: Saturday, October 18, 2008 12:18 PM
To: user-java@ibatis.apache.org
Subject: RE: 2.3.4.726 and XmlConverter

 

I’m talking about DaoManagerBuilder.buildDaoManager or SqlMapClientBuilder.buildSqlMapClient, these classes have an overload that takes a Properties instance. These properties can then be used in all queries, regardless of parameter classes.

 

Niels


From: Zsolt Koppany [mailto:zkoppanylist@intland.com]
Sent: Saturday, October 18, 2008 10:01 AM
To: user-java@ibatis.apache.org
Subject: RE: 2.3.4.726 and XmlConverter

 

Neils,

 

as I described it in a previous email we know this option with properties, but that would me that we should modify a lot of classes additionally where we pass a class as property we cannot set properties.

 

Zsolt


From: Niels Beekman [mailto:n.beekman@wis.nl]
Sent: Friday, October 17, 2008 8:57 AM
To: user-java@ibatis.apache.org
Subject: RE: 2.3.4.726 and XmlConverter

 

You could easily do this with properties, unless you are connecting to databases on the fly. Search the archives for some examples of this. We use this for purposes similar like yours.

 

Niels


From: Zsolt Koppany [mailto:zkoppanylist@intland.com]
Sent: Friday, October 17, 2008 6:41 AM
To: user-java@ibatis.apache.org
Subject: RE: 2.3.4.726 and XmlConverter

 

I’m not sure whether my problem is clear. Please check the code below (just an example). The expression ${INT_NULL_FIELD_VALUE} has different value on different database thus during the xml file is read we transfer the expression into a database dependent string.

 

I understand that we could do that setting the property from Dao but in this case the Dao would be database dependent what we don’t like.

 

Zsolt

 

            <select id="loadBlob" parameterClass="java.util.Map" resultMap="inputStreamResult" >

                         SELECT $queryParams.fileNameField$ as fileName,

                                     <isEqual property="fetchBlob" compareValue="true">

                                                 LENGTH($queryParams.blobFieldName$) AS length,

                                                 $blobFetchStmt$ AS blobData

                                     </isEqual>

                                     <!-- even when no need to fetch blob, still have to select a null value, to get the resultmaps satisfied -->

                                     <isEqual property="fetchBlob" compareValue="false">

                                                 ${INT_NULL_FIELD_VALUE} AS length,

                                                 NULL AS blobData

                                     </isEqual>

                           FROM $queryParams.tableName$

                          WHERE $queryParams.idFieldName$=#id#

            </select>

 

Zsolt


From: Clinton Begin [mailto:clinton.begin@gmail.com]
Sent: Friday, October 17, 2008 4:09 AM
To: user-java@ibatis.apache.org
Subject: Re: 2.3.4.726 and XmlConverter

 

I don't think Zsolt is talking about the XML results/parameters support in iBATIS.  XMLConverter was a class used to literally translate iBATIS 1.x mapping files into iBATIS 2.x mapping files using XSLT. It allowed either runtime conversion or batch conversion. 

 

Zsolt could use the old version to do the one-time conversion of all of his files if he wants, but it sounds like he is extending the class for some reason, in which case he could just grab the code and make it his own.

 

Clinton

On Thu, Oct 16, 2008 at 5:02 PM, <Christopher.Mathrusse@sybase.com> wrote:


As a suggestion Zsolt, iBatis does OR mapping extremely well. What you are looking for is something that will map Objects into XML extremely well. Why not take a look at XStream by thoughtworks. I'm using their library for several projects pertaining to Object -> XML and it handles them exceptionally well. And by utilizing a library like this it will give you a clean separation of concern as well as better control over the XML that you want to generate.

http://xstream.codehaus.org/

"Clinton Begin" <clinton.begin@gmail.com>

10/16/2008 03:42 PM

Please respond to

To

cc

 

Subject

Re: 2.3.4.726 and XmlConverter

 

 

 

 

 

 




Zsolt,

This feature is really old and was only there to support 1.x clients during the transition to 2.x.  If you're still have 1.x maps, it might be a good time to move them.  Otherwise, consider it a deprecated feature.  Thus, the long-term solution is for you to either adopt the code as your own, or migrate your SQL mapping files.

cheers
Clinton

On Thu, Oct 16, 2008 at 2:56 PM, Zsolt Koppany <zkoppanylist@intland.com> wrote:
Larry,

are there better options that will work long term?

What is the recommended way today?

Zsolt


> -----Original Message-----
> From: Larry Meadors [mailto:larry.meadors@gmail.com]
> Sent: Thursday, October 16, 2008 3:55 PM
> To: user-java@ibatis.apache.org
> Subject: Re: 2.3.4.726 and XmlConverter
>
> Two options:
>
>  - stick with the older version of ibatis that has all the parts you need
>  - extract the parts you need from the older version of ibatis and use
> them alongside the new release
>
> Larry