ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kris Barnhoorn" <k...@biassweb.be>
Subject RE: access a resultmap
Date Sat, 08 Jan 2005 17:05:38 GMT
Meanwhile this seems to work

public class LinkSqlMapDAO extends BaseSqlMapDAO implements LinkDAO{
    private final static String resultMapName = "Link.linkResult";
    private HashMap resultMappings;


    private void initResultMappings(){
       resultMappings = new HashMap();
       SqlMapClientImpl smci = (SqlMapClientImpl)getSqlMapExecutor();
       SqlMapExecutorDelegate smed =
       ResultMap rm = smed.getResultMap(resultMapName);
       ResultMapping[] rms = rm.getResultMappings();
       for (int i =0;i<rms.length;i++){

    public String getColumnName(String property){
       if (resultMappings==null){
       String columnName = (String)resultMappings.get(property);
       return (columnName!=null)?columnName:property;


-----Oorspronkelijk bericht-----
Van: Kris Barnhoorn [mailto:kris@biassweb.be] 
Verzonden: vrijdag 7 januari 2005 12:27
Aan: ibatis-user-java@incubator.apache.org; cbegin@ibatis.com
Onderwerp: RE: access a resultmap

Hi Clinton,

Thank you for taking interest in my case.

I'd like to access this to create some sql fragment.

In my web pages I have a list where users can define dynamic criteria.
for this to work I have to send the actual name of the column.

But if I would create some method that translates a particular property
to his sql column based on the resultmap, I could use propertynames and
not sql column names.


In webpage: propertyName / value / [AND | OR]  
		Add filter

In page handler(struts action):

	Create criteria (I use a own version of the Criteria class in
	Send it with DAO

	In DAO:
	Set the Criteria in the SqlQuery class

       <select id="getPojos" parameterClass="org.foo.SqlQuery"
             SELECT *
             FROM `pojos`
                   <isNotEmpty property="whereCriteriaString">
	So it is in the Criteria class I would create a method that
handles 	the conversion.	


-----Oorspronkelijk bericht-----
Van: Clinton Begin [mailto:clinton.begin@gmail.com] 
Verzonden: vrijdag 31 december 2004 18:38
Aan: ibatis-user-java@incubator.apache.org
Onderwerp: Re: access a resultmap

I'd be more interested in why.  ;-)

The short answer to your question is "no".  But of course, there's ways.

What are you trying to do?


On Fri, 31 Dec 2004 17:26:38 +0100, Kris Barnhoorn <kris@biassweb.be>
> Hi,
> I was wondering if you can access a resultmap through the iBatis API
> To know what sql column is attached to a specific property
> something like
> ResultMap rm = getResultMap("rmName");
> rm.getColumnOfProperty("reference");
> Thank you,
> Kris.

View raw message