Picon

RE: LazyLoading and CGLib problem

> Please take a look at http://issues.apache.org/jira/browse/IBATIS-596
> The Problem is that the CGLib-Proxy use the type of the
> property in "myClassMap"-ResultMap instead of the result 
> class of "permissionMap". The patch "lazy-loading.txt" at 
> IBATIS-596 solves this problem.

Hello Stefan,

  Thanks a lot, it worked! I also liked the exception throwing when the
sub-select returns null. 

All the best,
Gustavo   
Fred Janon | 2 Jul 2009 05:58
Picon

queryForObject/queryForList where is the documentation for the "Object parameter"?

Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList

SqlMapExecutorjava.util.List queryForList(java.lang.String id, java.lang.Object parameterObject, int skip, int max) throws java.sql.SQLException Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Parameters: id - The name of the statement to execute. parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<< Where in the doc or the book is that described in more details?
How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now...

Thanks

Fred

meindert | 2 Jul 2009 08:49

RE: queryForObject/queryForList where is the documentation for the "Object parameter"?

You can only have one input Object. For simple parameters I use a Map object;

As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>();

param.put("id", yourInt);

param.put("description", yourString);

 

In you sqlmap you can revere to these parameters like #id# and #description#, or $id$ and $description$ if you want to do a literary replacement.

 

 

From: Fred Janon [mailto:fjanon <at> gmail.com]
Sent: 02 July 2009 05:59 AM
To: user-java <at> ibatis.apache.org
Subject: queryForObject/queryForList where is the documentation for the "Object parameter"?

 

Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList

java.util.List queryForList(java.lang.String id,

                            java.lang.Object parameterObject,

                            int skip,

                            int max)

                            throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Parameters:

id - The name of the statement to execute.

parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<< Where in the doc or the book is that described in more details?

How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now...

Thanks

Fred

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00

Fred Janon | 2 Jul 2009 09:52
Picon

Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

Thanks. It seems though that there are more facets to it, like XML which is particularly interesting for RESTful services.

Fred


On Thu, Jul 2, 2009 at 14:49, meindert <meindert <at> eduflex.com> wrote:

You can only have one input Object. For simple parameters I use a Map object;

As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>();

param.put("id", yourInt);

param.put("description", yourString);

 

In you sqlmap you can revere to these parameters like #id# and #description#, or $id$ and $description$ if you want to do a literary replacement.

 

 

From: Fred Janon [mailto:fjanon <at> gmail.com]
Sent: 02 July 2009 05:59 AM
To: user-java <at> ibatis.apache.org
Subject: queryForObject/queryForList where is the documentation for the "Object parameter"?

 

Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList

java.util.List queryForList(java.lang.String id,                            java.lang.Object parameterObject,                            int skip,                            int max)                             throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Parameters:

id - The name of the statement to execute.

parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<< Where in the doc or the book is that described in more details?

How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now...

Thanks

Fred

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00


meindert | 2 Jul 2009 10:06

RE: queryForObject/queryForList where is the documentation for the "Object parameter"?

Hi Fred,

 

The XML parameter object is quite interesting, it doesn’t look like ibatis can handle a ‘XML object’ the same way as it can return a XML string object;

http://www.mail-archive.com/user-java <at> ibatis.apache.org/msg13636

 

Just a note, the XML returned from ibatis is quite limited, I personally use XStream to serialize java beans  to XML (or JSON) and back to java beans

 

meindert

From: Fred Janon [mailto:fjanon <at> gmail.com]
Sent: 02 July 2009 09:53 AM
To: user-java <at> ibatis.apache.org
Subject: Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

 

Thanks. It seems though that there are more facets to it, like XML which is particularly interesting for RESTful services.

Fred

On Thu, Jul 2, 2009 at 14:49, meindert <meindert <at> eduflex.com> wrote:

You can only have one input Object. For simple parameters I use a Map object;

As larry said, the GRD (Get R' Done) approach to do this:

Map<String, Object> param = new HashMap<String, Object>();

param.put("id", yourInt);

param.put("description", yourString);

 

In you sqlmap you can revere to these parameters like #id# and #description#, or $id$ and $description$ if you want to do a literary replacement.

 

 

From: Fred Janon [mailto:fjanon <at> gmail.com]
Sent: 02 July 2009 05:59 AM
To: user-java <at> ibatis.apache.org
Subject: queryForObject/queryForList where is the documentation for the "Object parameter"?

 

Sorry for the basic question: how to write a query with mutiple parameters? I am reading the iBatis in Action book, browsing the distribution, the wiki, the Javadoc and I can't find documentation or examples for the different forms of the parameter for queryForObject or queryForList

java.util.List queryForList(java.lang.String id,

                            java.lang.Object parameterObject,

                            int skip,

                            int max)

                            throws java.sql.SQLException

Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Parameters:

id - The name of the statement to execute.

parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<< Where in the doc or the book is that described in more details?

How do I pass several parameters to queryForList like for example name, beginsearchdate, beginlastdate?

I see details for the resultMap, nothing but only exmaples with one input parameter. I started looking in the code, but it's taking too much time now...

Thanks

Fred

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09 11:37:00

 

Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09 18:07:00

Sankar Reddy | 2 Jul 2009 10:42
Picon
Favicon

How to Set Fetch Size For ResultSet In IBatis for performance increase for large data retrieving (more than 6000 records)


Hi everyone,

     I am facing some performance issue with IBatis procedure for retrieving
large data (having more than 6000 records)from database. i am unable to Set
Fetch Size For ResultSet with Ibatis, <br>

 I tested with simple JDBC and datasource with Set Fetch Size For ResultSet
it improved performance very good (<2Sec), this same with ibatis taken
>60Sec.<br>

IBatis code:

<parameterMap id="getBillingAccountsMap" class="map">
			<parameter property="p_cust_grp_id" jdbcType="VARCHAR"
javaType="java.lang.String" mode="IN"/>
			<parameter property="p_status" jdbcType="VARCHAR"
javaType="java.lang.String" mode="OUT"/>
			<parameter property="p_error_code" jdbcType="VARCHAR"
javaType="java.lang.String" mode="OUT"/>
			<parameter property="p_error_message" jdbcType="VARCHAR"
javaType="java.lang.String" mode="OUT"/>
			<parameter property="p_out_bac" jdbcType="ORACLECURSOR"
javaType="java.sql.ResultSet" mode="OUT" resultMap="getBACsResultMap"/>
			<parameter property="p_out_customer" jdbcType="ORACLECURSOR"
javaType="java.sql.ResultSet" mode="OUT" resultMap="getCustomerResultMap"/>
		</parameterMap>
		
		
<procedure id="getBillingAccounts" parameterMap="getBillingAccountsMap"
fetchSize="100">
				{call get_billing_accnts_by_customer(?,?,?,?,?,?)}
</procedure> 

Plain JDBC code to improve performance (very good performance)

	String proc3StoredProcedure = "{ call
get_billing_accnts_by_customer(?,?,?,?,?,?) }";
			CallableStatement cs = conn.prepareCall(proc3StoredProcedure);
			//cs.setFetchSize(500);
			cs.setString(1, "CUG5300006939");
			cs.registerOutParameter(2, java.sql.Types.VARCHAR);
			cs.registerOutParameter(3, java.sql.Types.VARCHAR);
			cs.registerOutParameter(4, java.sql.Types.VARCHAR);
			cs.registerOutParameter(5, OracleTypes.CURSOR);
			cs.registerOutParameter(6, OracleTypes.CURSOR);
			cs.execute(); 
			getBACsResultMap = (ResultSet)cs.getObject(5);
			getBACsResultMap.setFetchSize(100);
			 Date startTime = new Date();
				while (getBACsResultMap.next ())   {
					
					bacs = new BACsDTO();
					bacs.setBillingAccountNumber(getBACsResultMap.getString(1));
					bacs.setType(getBACsResultMap.getString(2));
					bacs.setTaxInclusive(getBACsResultMap.getString(3));
					bacs.setBillingAccountStatus(getBACsResultMap.getString(4));
					bacs.setBillingAccountSubStatus(getBACsResultMap.getString(5));
					bacs.setBillingAccountSystem(getBACsResultMap.getString(6));
					bacs.setBillingAccountInstance(getBACsResultMap.getString(7));
					bacsList.add(bacs);
}

getBACsResultMap.setFetchSize(100); this line given very good performance
improvement (getBACsResultMap is ResultSet Type)

Please let me know how to set this ResultSet Fetch Size in IBatis.

it will really  help full to me

Thanks in advance

Regards,
Sankar Reddy

--

-- 
View this message in context: http://www.nabble.com/How-to-Set-Fetch-Size-For-ResultSet-In-IBatis-for-performance-increase-for-large-data-retrieving-%28more-than-6000-records%29-tp24303277p24303277.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Sankar Reddy | 2 Jul 2009 14:09
Picon
Favicon

How to set Prefetch size on the resultSet level in IBATIS


Hi,

We are having issues with the "prefetchSize" property that is available at
the "procedure" element (of ibatis sqlmap). Even though we set the prefetch
size to a value, say 100, ibatis ignores this and always defaults to 10
(jdbc driver default). Also our application is a weblogic based J2EE app
running in the same JVM as the weblogic server. Hence the prefetchSize set
on the callableStatement will not work.
But prefetchSize set on the resultSet level will work perfectly(after
getting the resultSet from the callableStatementt).

Hence, in IBatis we need to set the prefetchSize at the resultSet level
while executing a storedproc.
We dont seem to find a way to do this in ibatis at the moment.

Is this a limitation/bug or is there a way around this?

Any help here will be much appreciated.

thanks,
Sankar
--

-- 
View this message in context: http://www.nabble.com/How-to-set-Prefetch-size-on-the-resultSet-level-in-IBATIS-tp24305631p24305631.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Larry Meadors | 2 Jul 2009 15:34
Picon
Gravatar

Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

FYI: XML parameters and results are on the way out with ibatis 3.

Larry

On Thu, Jul 2, 2009 at 2:06 AM, meindert<meindert <at> eduflex.com> wrote:
> Hi Fred,
>
>
>
> The XML parameter object is quite interesting, it doesn’t look like ibatis
> can handle a ‘XML object’ the same way as it can return a XML string object;
>
> http://www.mail-archive.com/user-java <at> ibatis.apache.org/msg13636
>
>
>
> Just a note, the XML returned from ibatis is quite limited, I personally use
> XStream to serialize java beans  to XML (or JSON) and back to java beans
>
>
>
> meindert
>
> From: Fred Janon [mailto:fjanon <at> gmail.com]
> Sent: 02 July 2009 09:53 AM
> To: user-java <at> ibatis.apache.org
> Subject: Re: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Thanks. It seems though that there are more facets to it, like XML which is
> particularly interesting for RESTful services.
>
> Fred
>
> On Thu, Jul 2, 2009 at 14:49, meindert <meindert <at> eduflex.com> wrote:
>
> You can only have one input Object. For simple parameters I use a Map
> object;
>
> As larry said, the GRD (Get R' Done) approach to do this:
>
> Map<String, Object> param = new HashMap<String, Object>();
>
> param.put("id", yourInt);
>
> param.put("description", yourString);
>
>
>
> In you sqlmap you can revere to these parameters like #id# and
> #description#, or $id$ and $description$ if you want to do a literary
> replacement.
>
>
>
>
>
> From: Fred Janon [mailto:fjanon <at> gmail.com]
> Sent: 02 July 2009 05:59 AM
> To: user-java <at> ibatis.apache.org
> Subject: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Sorry for the basic question: how to write a query with mutiple parameters?
> I am reading the iBatis in Action book, browsing the distribution, the wiki,
> the Javadoc and I can't find documentation or examples for the different
> forms of the parameter for queryForObject or queryForList
>
> java.util.List queryForList(java.lang.String id,
>
>                             java.lang.Object parameterObject,
>
>                             int skip,
>
>                             int max)
>
>                             throws java.sql.SQLException
>
> Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> The parameter object is generally used to supply the input data for the
> WHERE clause parameter(s) of the SELECT statement.
>
> Parameters:
>
> id - The name of the statement to execute.
>
> parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<<
> Where in the doc or the book is that described in more details?
>
> How do I pass several parameters to queryForList like for example name,
> beginsearchdate, beginlastdate?
>
> I see details for the resultMap, nothing but only exmaples with one input
> parameter. I started looking in the code, but it's taking too much time
> now...
>
> Thanks
>
> Fred
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
> 11:37:00
>
>
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09
> 18:07:00
Matthias Paul | 2 Jul 2009 21:23
Picon
Picon

Re: ScriptRunner question

Then I'm looking forward to iBatis 3 :)

Doesnt depend on setDelimiter(), it looks as if the newline character is trimmed from input script in any
case. Patched the file and it works now.

Thank you!
Paule

-------- Original-Nachricht --------
> Datum: Sat, 27 Jun 2009 13:52:38 -0600
> Von: Clinton Begin <clinton.begin <at> gmail.com>
> An: user-java <at> ibatis.apache.org
> Betreff: Re: ScriptRunner question

> No, but in iBATIS 3 there is. :-)
> 
> It looks to me that in the example below, you possibly didn't
> setFullLineDelimiter(true);
> 
> There's a difference in parsing if the delimiter is the whole line.
> 
> Cheers,
> Clinton
> 
> On Sat, Jun 27, 2009 at 1:29 PM, Matthias Paul <slayer81 <at> gmx.de> wrote:
> 
> > Thank you for your reply, Clinton :)
> >
> > Is there another supported way to transfer scripts to database yet? Or
> isnt
> > iBatis meant to do such tasks?
> >
> >
> > Paule
> >
> >
> > -------- Original-Nachricht --------
> > > Datum: Thu, 25 Jun 2009 18:11:16 -0600
> > > Von: Clinton Begin <clinton.begin <at> gmail.com>
> > > An: user-java <at> ibatis.apache.org
> > > Betreff: Re: ScriptRunner question
> >
> > > ScriptRunner isn't really a supported feature of iBATIS.  It's meant
> for
> > > utilities and unit tests only.
> > > Its API may change significantly in the future without warning.
> > >
> > > Clinton
> > >
> > > On Thu, Jun 25, 2009 at 12:47 PM, <slayer81 <at> gmx.de> wrote:
> > >
> > > > Hello!
> > > >
> > > > Using iBatis 2.3.4.726.
> > > > Had some problems with transfering a SQL script (a Oracle package)
> to
> > > > Oracle database with iBatis' ScriptRunner.
> > > > The SQL script file looked smth like this:
> > > >
> > > >
> > > >
> > > > -- MYPACKAGE package specification
> > > > create or replace package MYPACKAGE as
> > > >
> > > >  -- commentary here
> > > >  procedure PROCEDURE1 (
> > > >        PARAMETER1 in number
> > > >  );
> > > >
> > > >  -- insert GVC rule
> > > >  procedure PROCEDURE2 (
> > > >    PARAMETER1 in number
> > > >  );
> > > >
> > > >
> > > > end MYPACKAGE;
> > > > /
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I called ScriptRunner method "setDelimiter("/", true)" to set single
> > > line
> > > > delimiter to "/". The script was tranfered to database, but on a
> single
> > > line
> > > > with over 20k length, which isnt easy to read or decipher.
> > > >
> > > > Mot sure about that, but shouldnt there be a NEWLINE character
> appended
> > > > after each line read from the script by
> > > ScriptRunner.runScript(Connection
> > > > conn, Reader reader) ?
> > > >
> > > > Another thing is: The if-then-else block starting at line 147 looks
> > > weird.
> > > > I dont understand why some comments are left out (or: written to log
> > > writer)
> > > > while others are not. Are "//" and "--" comment types database
> > > > system-dependent?  And isnt the LineNumberReader supposed to return
> the
> > > > current line number on errors?
> > > >
> > > >
> > > > Thank you for your time!
> > > > Paule
> > > > --
> > > > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > > > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-java-unsubscribe <at> ibatis.apache.org
> > > > For additional commands, e-mail: user-java-help <at> ibatis.apache.org
> > > >
> > > >
> >
> > --
> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-java-unsubscribe <at> ibatis.apache.org
> > For additional commands, e-mail: user-java-help <at> ibatis.apache.org
> >
> >

--

-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
Fred Janon | 3 Jul 2009 05:55
Picon

Re: queryForObject/queryForList where is the documentation for the "Object parameter"?

That's too bad. One more thing to do in the code. I thought that JSON and XML support would be really good to implement RESTful web services. Is there a specific reason for taking it out?

Fred

On Thu, Jul 2, 2009 at 21:34, Larry Meadors <larry.meadors <at> gmail.com> wrote:
FYI: XML parameters and results are on the way out with ibatis 3.

Larry


On Thu, Jul 2, 2009 at 2:06 AM, meindert<meindert <at> eduflex.com> wrote:
> Hi Fred,
>
>
>
> The XML parameter object is quite interesting, it doesn’t look like ibatis
> can handle a ‘XML object’ the same way as it can return a XML string object;
>
> http://www.mail-archive.com/user-java <at> ibatis.apache.org/msg13636
>
>
>
> Just a note, the XML returned from ibatis is quite limited, I personally use
> XStream to serialize java beans  to XML (or JSON) and back to java beans
>
>
>
> meindert
>
> From: Fred Janon [mailto:fjanon <at> gmail.com]
> Sent: 02 July 2009 09:53 AM
> To: user-java <at> ibatis.apache.org
> Subject: Re: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Thanks. It seems though that there are more facets to it, like XML which is
> particularly interesting for RESTful services.
>
> Fred
>
> On Thu, Jul 2, 2009 at 14:49, meindert <meindert <at> eduflex.com> wrote:
>
> You can only have one input Object. For simple parameters I use a Map
> object;
>
> As larry said, the GRD (Get R' Done) approach to do this:
>
> Map<String, Object> param = new HashMap<String, Object>();
>
> param.put("id", yourInt);
>
> param.put("description", yourString);
>
>
>
> In you sqlmap you can revere to these parameters like #id# and
> #description#, or $id$ and $description$ if you want to do a literary
> replacement.
>
>
>
>
>
> From: Fred Janon [mailto:fjanon <at> gmail.com]
> Sent: 02 July 2009 05:59 AM
> To: user-java <at> ibatis.apache.org
> Subject: queryForObject/queryForList where is the documentation for the
> "Object parameter"?
>
>
>
> Sorry for the basic question: how to write a query with mutiple parameters?
> I am reading the iBatis in Action book, browsing the distribution, the wiki,
> the Javadoc and I can't find documentation or examples for the different
> forms of the parameter for queryForObject or queryForList
>
> java.util.List queryForList(java.lang.String id,
>
>                             java.lang.Object parameterObject,
>
>                             int skip,
>
>                             int max)
>
>                             throws java.sql.SQLException
>
> Executes a mapped SQL SELECT statement that returns data to populate a
> number of result objects within a certain range.
>
> The parameter object is generally used to supply the input data for the
> WHERE clause parameter(s) of the SELECT statement.
>
> Parameters:
>
> id - The name of the statement to execute.
>
> parameterObject - The parameter object (e.g. JavaBean, Map, XML etc.). <<<
> Where in the doc or the book is that described in more details?
>
> How do I pass several parameters to queryForList like for example name,
> beginsearchdate, beginlastdate?
>
> I see details for the resultMap, nothing but only exmaples with one input
> parameter. I started looking in the code, but it's taking too much time
> now...
>
> Thanks
>
> Fred
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 06/30/09
> 11:37:00
>
>
>
> Checked by AVG - www.avg.com
> Version: 8.5.375 / Virus Database: 270.13.1/2211 - Release Date: 07/01/09
> 18:07:00

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe <at> ibatis.apache.org
For additional commands, e-mail: user-java-help <at> ibatis.apache.org



Gmane