Re: Flexible ResultMaps (Again)

2005-02-06 Thread Larry Meadors
On Sun, 06 Feb 2005 09:31:21 +1100, Huy [EMAIL PROTECTED] wrote:
 Yeah, I hate all that casting stuff you have to do in java when getting
 things out of collections. Generics thing in java 1.5 might help out
 with this.

Not really. :-(

It will help for things where every element of the collection are the
same type. I did a simple JDK5 iBATIS app, and used strongly typed
lists - VERY cool! Using ListCustomer is much nicer than
(Customer)List.get(i) for everything.

But, for a Map, since all the properties in your domain objects
are not the same type, the Map cannot be typed.

Larry


Re: Flexible ResultMaps (Again)

2005-02-06 Thread Larry Meadors
Yick.

I am with Clinton on this one, too. I have never used a Map for
anything complex and finished it thinking Dang! That worked great! I
always felt cheap and dirty...like I needed a shower. ;-)

It is so much nicer IMO to let the compiler do what it was meant to do
for me: Verify that the names and types all match up. :-D

Larry

On Sat, 05 Feb 2005 16:35:18 -0600, friendVU admin
[EMAIL PROTECTED] wrote:
 person.put(name,person.get(name1));
 
 I have a lot of that in my code.


Prevent Ibatis from lookup doctype dtd on internet

2005-02-06 Thread Joris Vleminckx
Hello,

I have used version 1.2.9 of Ibatis in combination with Struts for the last
year and am now porting my application to version 2.0 of Ibatis. I have
rewritten succesfully my code, but when I launch a Struts action that
invocates Ibatis, I receive the following error:

Caused by: java.lang.RuntimeException: Could not initialize DaoConfig.
Cause: com.ibatis.dao.client.DaoException: Error while configuring
DaoManager. Cause: java.lang.RuntimeException: Error occurred. Cause:
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:
java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
Caused by: java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error
parsing XML. Cause: java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
Caused by: java.lang.RuntimeException: Error occurred. Cause:
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:
java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
Caused by: java.lang.RuntimeException: Error parsing XPath
'/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error
parsing XML. Cause: java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
at it.urmet.nfd.daoInterfaces.DaoConfig.clinit(DaoConfig.java:24)

It looks like the XML parser tries to look up the doctype dtd
!DOCTYPE sqlMapConfig PUBLIC -//iBATIS.com//DTD SQL Map Config 1.0//EN
http://www.ibatis.com/dtd/sql-map-config-2.dtd;
of sqlMapConfig, and since I am not directly connected to internet, this
fails and makes my app. crash. Any ideas how to overcome this issue? Thanks
a lot!

Joris

--
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot



com.ibatis.common.util.Throttle not decrementing Session counter causes application to hang

2005-02-06 Thread Mark Nabours




Hello,

I have a rather serious problem to which we need a quick resolution.

In brief, the increment method on the Throttle class is being called for
sessions after executing SqlMapClient.setUserConnection()  but the
corresponding decrement method is never being called.  After we reach the
session limit configured in sql-map-config.xml the application hangs hard!

Here are some of the specifics, we are using iBATIS to map data from a
database to our own set of data objects.  However, we are not using iBATIS
to acquire the database connections; we are externally providing them to
the iBATIS SqlMapClient through the setUserConnection method, and we clear
the transaction out by calling setUserConnection and passing null for the
connection.  We have our own connection acquisition code that we use and
therefore we do not even have a transactionManager element configured
within sql-map-config.xml -- we would prefer not to have to configure it
since it requires a data source to be configured and our connection
acquisition code if highly flexible to use different types of connection
ion various environments.  It's my understanding that it is perfectly
acceptable to use iBATIS by providing external connections as long as you
handle all of  your transactional requirements (which we do).

I have attached the following test case  that illustrates the problem.  We
have configured the maximum session count to 75.  Don't read too much into
our test case code as it acquires a single connection and immediately
closes it so that we don't leave the connection open when the test case
freezes.  We loop 80 times and we hang after 75 iterations.

/*
 * Created on Feb 3, 2005.
 */
package com.alliancesys.common.ibatis.testing;

import java.io.Reader;
import java.sql.Connection;
import java.sql.SQLException;

import com.alliancesys.common.jdbc.DatabaseConnectionService;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import junit.framework.TestCase;

/**
 * code[EMAIL PROTECTED] SqlMapClientSessionTest}/code
 *
 */
public class SqlMapClientSessionTest extends TestCase {

  private int threadCounter = 0;

  public SqlMapClientSessionTest(String arg0) {
super(arg0);
  }

  public static void main(String[] args) {
junit.textui.TestRunner.run(SqlMapClientSessionTest.class);
  }

  private synchronized void writeCount(){
threadCounter++;
System.out.println(Thread  + threadCounter +  completed.);
  }

  public void testThrottleSessionLock() throws Exception {

final Connection connection  =
DatabaseConnectionService.getNewConnection();
connection.close();
Reader reader =
  Resources.getResourceAsReader(
getClass().getClassLoader(),
sql-map-config.xml);
final SqlMapClient sqlMapClient =
SqlMapClientBuilder.buildSqlMapClient(reader);
for (int i = 0; i  80; i++) {

  Runnable runnable = new Runnable() {
public void run() {
  try {
SqlMapClient client = sqlMapClient;
Connection cn = connection;
client.setUserConnection(cn);
client.setUserConnection(null);
writeCount();
  } catch (SQLException e) {

e.printStackTrace();
  }
}
  };

  Thread t = new Thread(runnable);
  t.start();

}


  }

}

If you run it, you will notice that if you have max sessions configured to
75 it hangs after completion of the 75 thread.

Our sql-map-config.xml file is as follows:

?xml version=1.0 encoding=UTF-8 standalone=no?
!DOCTYPE sqlMapConfig PUBLIC -//iBATIS.com//DTD SQL Map Config 2.0//EN
http://www.ibatis.com/dtd/sql-map-config-2.dtd;

sqlMapConfig

  properties
resource=ibatis.properties /

  settings
cacheModelsEnabled=true
enhancementEnabled=true
maxSessions=75
maxTransactions=20
maxRequests=140 /

  sqlMap resource=Contact.xml /

/sqlMapConfig

We are hoping that it is a configuration problem, but we suspect that the
decrement method on Throttle needs to be called.  Please provide us with a
solution that would prevent this from happening.

Let me thank you in advance for you help.  iBATIS is an great product, but
this is currently preventing us from moving through QA into production.

Thanks,
Mark Nabours

(See attached file: sql-map-config.xml)(See attached file:
SqlMapClientSessionTest.java)


-
E-mail 

Slow stored procedure performance?

2005-02-06 Thread Kevin Schraith
We're running into some very strange behavior in our implementation using
SQL Maps withing the DAO Framework against SQL Server 2000.  When we call a
particular stored procedure from a query tool, or through plain old JDBC
(using jTDS 0.9.1 as our driver), it takes about 4 seconds to run and
iterate over the results.  When we put the same thing within a SQL Map, it
takes 22 seconds.  Same parameters, same load on DB, everything.  Very
reproducable.  Does anyone have any tips on what might be happening?

The stored procedure in question does a good deal of server side processing,
but only returns 50 rows, with a dozen or so columns.  Not much data to
iterate.  When looking at the DB profiler tool, it shows the procedure call
taking up all of the time, though that time probably includes the time to
iterate over the rows of the result set.  All I can guess is that something
about the results being mapped to to the result class (a simple bean class)
is either wildly inefficient or blocking somehow...

We have been using iBATIS for a while now (though not much with stored
procedures), and have never seen any noticable performance overhead.  This
is a pretty critical blocker for us - any help would be immensely
appreciated.

Thanks in advance,
 Kevin



Here's the map:

sqlMap namespace=SafetyUtilizationReport

  typeAlias alias=safetyUtilizationReportCriteria
type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportCriteria
DO/
  typeAlias alias=safetyUtilizationReportListRow
type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportListRowD
O/

  sql id=whereClause
isNotEmpty prepend=AND property=contactIDList
  SafetyInspection.inspectedByID IN
  iterate open=( property=contactIDList conjunction=, close=)
$contactIDList[]$
  /iterate
/isNotEmpty
isNotEmpty prepend=AND property=companyIDList
  Contact.zoneID IN (SELECT id FROM Zone WHERE companyID IN
iterate open=( property=companyIDList conjunction=,
close=)
  $companyIDList[]$
/iterate
  )
/isNotEmpty
isEqual prepend=AND property=zoneID compareValue=10003
  !-- Within zone 10003 - potentially see all zones, but discard bogus
ones --
  Contact.zoneID NOT IN (SELECT id FROM Zone WHERE
includeInBenchmarkFlag != 1)
/isEqual
isNotEqual prepend=AND property=zoneID compareValue=10003
  !-- Outside of zone 10003 - show only current zone --

  !-- NOTE: because this might get pulled into a dynamic SQL statement
in the SP,
we cheat a little and don't replace as a param (and no quotes!)
--
  Contact.zoneID = $zoneID$
/isNotEqual
  /sql
  
  procedure id=SafetyUtilizationReport.getResults 
 parameterClass=safetyUtilizationReportCriteria 
 resultClass=safetyUtilizationReportListRow
!-- NOTE: because the included chunks may have single quotes, we
surround them 
in double quotes --
{ call dbo2sp_SafetyUtilizationReport_runReport (
  #showDelta#,
  #topCountSQL#,
  'include refid=whereClause/',
  'include refid=whereClause/ 
   isNotEmpty prepend=AND property=computedBeginDate
 SafetyInspection.inspectionDate gt;=
''$computedBeginDate$''
   /isNotEmpty
   isNotEmpty prepend=AND property=computedEndDate
 SafetyInspection.inspectionDate lt;= ''$computedEndDate$''
   /isNotEmpty',
   '$orderByClauseSQL$' ) }
  /procedure

/sqlMap  




Re: Flexible ResultMaps (Again)

2005-02-06 Thread Clinton Begin
 Looosly typed!

That's not loose typing.  It's NO typing.

The type that's missing isn't what you think it is.  The type that's
missing is your domain class definition.  You don't have types at all.
 You just have collections of implicitly related information.

In any case, I appreciate your heavy, thorough testing of our Map
support (seriously actually).  ;-)

Cheers,
Clinton

On Sun, 06 Feb 2005 09:09:09 -0600, friendVU admin
[EMAIL PROTECTED] wrote:
 Looosly typed!
  It's the next thing w/ all the scripting langs, the buzz it turns out,
 is for a good reason. You can do some of it in Java. Just like OO, it
 took people a while to get used too.
 I had to go trought the same process ... of showers.
 Fact is.. you do not get a class cast exception much.
 
 Here is something to do in Struts action:
 Map parms = new HasmMap();
 parms.put(id,new Long(1));
 ArrayList res = GenericDaoHelper.retrive(findClinets,parms);
 req.setAttribute(resutls,res);
 // then have DisplayTag display the table in JSP
 
 GenericDaoHelper() {
 public ArrayList ) _sqlMap.retrieve(stringRetnName, parmMap) {
 return (ArrayList) _sqlMap.queryForList(stringRetName, parmMap);
 ...
 
 All I do now is use JTable Model instead of DisplayTag.
 That... plus I have a string dispacher to SQLMaps.
 You'll realy need a bath for this in Groovy, voted best JCP:
 var Client = Acme
 
 .V
 
 Larry Meadors wrote:
 
 I
 always felt cheap and dirty...like I needed a shower. ;-)
 
 It is so much nicer IMO to let the compiler do what it was meant to do
 for me: Verify that the names and types all match up. :-D
 
 
 
 



Re: Problem in running JpetStore

2005-02-06 Thread Clinton Begin
You're missing the Oracle driver on your classpath.


On Thu, 3 Feb 2005 03:29:03 -0800 (PST), ravindranath Linganna
[EMAIL PROTECTED] wrote:
 Hi,
  When I run the PetStore application
 Following error I am getting following Error.
 
 javax.servlet.ServletException: Exception creating
 bean of class
 com.ibatis.jpetstore.presentation.CatalogBean: {1}
 
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
 
 I tried to write test case   as follows
 
 /.
 *8
 DaoManager daomanager = null ;
 Account account = new Account();
 protected void setUp() throws Exception {
 //super.setUp();
 
 daomanager = DaoConfig.getDaomanager();
 
 }
 
 public  void testGetList()
 {
 List list = new ArrayList();
 AccountSqlMapDao acmap = new
 AccountSqlMapDao(daomanager);
  list = acmap.getUsernameList();
 assertNotNull(list);
 }
 
 public static void main(String[] args) {
 junit.textui.TestRunner.run(AccountDAOTest.class);
 
 ./
 ***
 When I run the test case class the following is error.
 
 java.lang.ExceptionInInitializerError
 at
 iBatisTesting.AccountDAOTest.setUp(AccountDAOTest.java:34)
 at
 junit.framework.TestCase.runBare(TestCase.java:125)
 at
 junit.framework.TestResult$1.protect(TestResult.java:106)
 at
 junit.framework.TestResult.runProtected(TestResult.java:124)
 at
 junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:118)
 at
 junit.framework.TestSuite.runTest(TestSuite.java:208)
 at junit.framework.TestSuite.run(TestSuite.java:203)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:410)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:294)
 at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:182)
 Caused by: java.lang.RuntimeException: Could not
 initialize DaoConfig.  Cause:
 com.ibatis.sqlmap.client.SqlMapException: There was an
 error while building the SqlMap instance.
 --- The error occurred in
 properties/database.properties.
 --- The error occurred while configuring the data
 source.
 --- Check the data source properties or configuration.
 
 --- Cause: com.ibatis.sqlmap.client.SqlMapException:
 Error initializing DataSource.  Could not instantiate
 DataSourceFactory.  Cause:
 com.ibatis.common.exception.NestedRuntimeException:
 SimpleDataSource: Error while loading properties.
 Cause: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by:
 com.ibatis.common.exception.NestedRuntimeException:
 SimpleDataSource: Error while loading properties.
 Cause: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by: com.ibatis.sqlmap.client.SqlMapException:
 Error initializing DataSource.  Could not instantiate
 DataSourceFactory.  Cause:
 com.ibatis.common.exception.NestedRuntimeException:
 SimpleDataSource: Error while loading properties.
 Cause: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by:
 com.ibatis.common.exception.NestedRuntimeException:
 SimpleDataSource: Error while loading properties.
 Cause: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 Caused by: java.lang.ClassNotFoundException:
 oracle.jdbc.driver.OracleDriver
 at
 com.ibatis.jpetstore.persistence.DaoConfig.clinit(DaoConfig.java:33)
 ... 11 more
 **
 
 I have one doubt As  we read dao.xml in DaoConfig.java
 where we read sql-map-config.xml file?
 Rgds
 
 
 __
 Do you Yahoo!?
 Yahoo! Mail - Easier than ever with enhanced search. Learn more.
 http://info.mail.yahoo.com/mail_250



Re: Prevent Ibatis from lookup doctype dtd on internet

2005-02-06 Thread Clinton Begin
Eek!  I think when I changed the parser over in 2.0.9, I forgot to
implement the JarEntityResolver.  iBATIS has always used a JAR file
until this last change.

Could you put in a JIRA request so we can track this bug?

http://www.ibatis.com/support.html

Cheers,
Clinton


On Thu, 3 Feb 2005 14:55:26 +0100, Joris Vleminckx
[EMAIL PROTECTED] wrote:
 Hello,
 
 I have used version 1.2.9 of Ibatis in combination with Struts for the last
 year and am now porting my application to version 2.0 of Ibatis. I have
 rewritten succesfully my code, but when I launch a Struts action that
 invocates Ibatis, I receive the following error:
 
 Caused by: java.lang.RuntimeException: Could not initialize DaoConfig.
 Cause: com.ibatis.dao.client.DaoException: Error while configuring
 DaoManager. Cause: java.lang.RuntimeException: Error occurred. Cause:
 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:
 java.net.ConnectException: Connection refused: connect
 Caused by: java.net.ConnectException: Connection refused: connect
 Caused by: java.lang.RuntimeException: Error parsing XPath
 '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error
 parsing XML. Cause: java.net.ConnectException: Connection refused: connect
 Caused by: java.net.ConnectException: Connection refused: connect
 Caused by: java.lang.RuntimeException: Error occurred. Cause:
 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:
 java.net.ConnectException: Connection refused: connect
 Caused by: java.net.ConnectException: Connection refused: connect
 Caused by: java.lang.RuntimeException: Error parsing XPath
 '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error
 parsing XML. Cause: java.net.ConnectException: Connection refused: connect
 Caused by: java.net.ConnectException: Connection refused: connect
 at it.urmet.nfd.daoInterfaces.DaoConfig.clinit(DaoConfig.java:24)
 
 It looks like the XML parser tries to look up the doctype dtd
 !DOCTYPE sqlMapConfig PUBLIC -//iBATIS.com//DTD SQL Map Config 1.0//EN
 http://www.ibatis.com/dtd/sql-map-config-2.dtd;
 of sqlMapConfig, and since I am not directly connected to internet, this
 fails and makes my app. crash. Any ideas how to overcome this issue? Thanks
 a lot!
 
 Joris
 
 --
 The greatest pleasure in life is doing what people say you cannot do.
 - Walter Bagehot
 



Re: Slow stored procedure performance?

2005-02-06 Thread Clinton Begin
Are you only testing a single execution?  If so, please test many...

Cheers,
Clinton


On Fri, 4 Feb 2005 10:46:12 -0800, Kevin Schraith [EMAIL PROTECTED] wrote:
 We're running into some very strange behavior in our implementation using
 SQL Maps withing the DAO Framework against SQL Server 2000.  When we call a
 particular stored procedure from a query tool, or through plain old JDBC
 (using jTDS 0.9.1 as our driver), it takes about 4 seconds to run and
 iterate over the results.  When we put the same thing within a SQL Map, it
 takes 22 seconds.  Same parameters, same load on DB, everything.  Very
 reproducable.  Does anyone have any tips on what might be happening?
 
 The stored procedure in question does a good deal of server side processing,
 but only returns 50 rows, with a dozen or so columns.  Not much data to
 iterate.  When looking at the DB profiler tool, it shows the procedure call
 taking up all of the time, though that time probably includes the time to
 iterate over the rows of the result set.  All I can guess is that something
 about the results being mapped to to the result class (a simple bean class)
 is either wildly inefficient or blocking somehow...
 
 We have been using iBATIS for a while now (though not much with stored
 procedures), and have never seen any noticable performance overhead.  This
 is a pretty critical blocker for us - any help would be immensely
 appreciated.
 
 Thanks in advance,
  Kevin
 
 
 
 Here's the map:
 
 sqlMap namespace=SafetyUtilizationReport
 
   typeAlias alias=safetyUtilizationReportCriteria
 type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportCriteria
 DO/
   typeAlias alias=safetyUtilizationReportListRow
 type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportListRowD
 O/
 
   sql id=whereClause
 isNotEmpty prepend=AND property=contactIDList
   SafetyInspection.inspectedByID IN
   iterate open=( property=contactIDList conjunction=, close=)
 $contactIDList[]$
   /iterate
 /isNotEmpty
 isNotEmpty prepend=AND property=companyIDList
   Contact.zoneID IN (SELECT id FROM Zone WHERE companyID IN
 iterate open=( property=companyIDList conjunction=,
 close=)
   $companyIDList[]$
 /iterate
   )
 /isNotEmpty
 isEqual prepend=AND property=zoneID compareValue=10003
   !-- Within zone 10003 - potentially see all zones, but discard bogus
 ones --
   Contact.zoneID NOT IN (SELECT id FROM Zone WHERE
 includeInBenchmarkFlag != 1)
 /isEqual
 isNotEqual prepend=AND property=zoneID compareValue=10003
   !-- Outside of zone 10003 - show only current zone --
 
   !-- NOTE: because this might get pulled into a dynamic SQL statement
 in the SP,
 we cheat a little and don't replace as a param (and no quotes!)
 --
   Contact.zoneID = $zoneID$
 /isNotEqual
   /sql
 
   procedure id=SafetyUtilizationReport.getResults
  parameterClass=safetyUtilizationReportCriteria
  resultClass=safetyUtilizationReportListRow
 !-- NOTE: because the included chunks may have single quotes, we
 surround them
 in double quotes --
 { call dbo2sp_SafetyUtilizationReport_runReport (
   #showDelta#,
   #topCountSQL#,
   'include refid=whereClause/',
   'include refid=whereClause/
isNotEmpty prepend=AND property=computedBeginDate
  SafetyInspection.inspectionDate gt;=
 ''$computedBeginDate$''
/isNotEmpty
isNotEmpty prepend=AND property=computedEndDate
  SafetyInspection.inspectionDate lt;= ''$computedEndDate$''
/isNotEmpty',
'$orderByClauseSQL$' ) }
   /procedure
 
 /sqlMap
 



Re: Slow stored procedure performance?

2005-02-06 Thread Clinton Begin
Having looked at this again, I actually wonder if iBATIS is doing much
in the way of making this any cleaner.  That is a seriously insane
stored proc.  Although I can't believe there would be an 18 second
difference between the two (it uses all the same code as normal
statements), I will say that if it turns out to be the case -- just
use JDBC here..

I'm personally impressed that you were actually able to map something
so crazy!   :-)

Cheers,
Clinton  


On Fri, 4 Feb 2005 10:46:12 -0800, Kevin Schraith [EMAIL PROTECTED] wrote:
 We're running into some very strange behavior in our implementation using
 SQL Maps withing the DAO Framework against SQL Server 2000.  When we call a
 particular stored procedure from a query tool, or through plain old JDBC
 (using jTDS 0.9.1 as our driver), it takes about 4 seconds to run and
 iterate over the results.  When we put the same thing within a SQL Map, it
 takes 22 seconds.  Same parameters, same load on DB, everything.  Very
 reproducable.  Does anyone have any tips on what might be happening?
 
 The stored procedure in question does a good deal of server side processing,
 but only returns 50 rows, with a dozen or so columns.  Not much data to
 iterate.  When looking at the DB profiler tool, it shows the procedure call
 taking up all of the time, though that time probably includes the time to
 iterate over the rows of the result set.  All I can guess is that something
 about the results being mapped to to the result class (a simple bean class)
 is either wildly inefficient or blocking somehow...
 
 We have been using iBATIS for a while now (though not much with stored
 procedures), and have never seen any noticable performance overhead.  This
 is a pretty critical blocker for us - any help would be immensely
 appreciated.
 
 Thanks in advance,
  Kevin
 
 
 
 Here's the map:
 
 sqlMap namespace=SafetyUtilizationReport
 
   typeAlias alias=safetyUtilizationReportCriteria
 type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportCriteria
 DO/
   typeAlias alias=safetyUtilizationReportListRow
 type=com.dbo2.pipeline.model.safety.reports.SafetyUtilizationReportListRowD
 O/
 
   sql id=whereClause
 isNotEmpty prepend=AND property=contactIDList
   SafetyInspection.inspectedByID IN
   iterate open=( property=contactIDList conjunction=, close=)
 $contactIDList[]$
   /iterate
 /isNotEmpty
 isNotEmpty prepend=AND property=companyIDList
   Contact.zoneID IN (SELECT id FROM Zone WHERE companyID IN
 iterate open=( property=companyIDList conjunction=,
 close=)
   $companyIDList[]$
 /iterate
   )
 /isNotEmpty
 isEqual prepend=AND property=zoneID compareValue=10003
   !-- Within zone 10003 - potentially see all zones, but discard bogus
 ones --
   Contact.zoneID NOT IN (SELECT id FROM Zone WHERE
 includeInBenchmarkFlag != 1)
 /isEqual
 isNotEqual prepend=AND property=zoneID compareValue=10003
   !-- Outside of zone 10003 - show only current zone --
 
   !-- NOTE: because this might get pulled into a dynamic SQL statement
 in the SP,
 we cheat a little and don't replace as a param (and no quotes!)
 --
   Contact.zoneID = $zoneID$
 /isNotEqual
   /sql
 
   procedure id=SafetyUtilizationReport.getResults
  parameterClass=safetyUtilizationReportCriteria
  resultClass=safetyUtilizationReportListRow
 !-- NOTE: because the included chunks may have single quotes, we
 surround them
 in double quotes --
 { call dbo2sp_SafetyUtilizationReport_runReport (
   #showDelta#,
   #topCountSQL#,
   'include refid=whereClause/',
   'include refid=whereClause/
isNotEmpty prepend=AND property=computedBeginDate
  SafetyInspection.inspectionDate gt;=
 ''$computedBeginDate$''
/isNotEmpty
isNotEmpty prepend=AND property=computedEndDate
  SafetyInspection.inspectionDate lt;= ''$computedEndDate$''
/isNotEmpty',
'$orderByClauseSQL$' ) }
   /procedure
 
 /sqlMap
 



Re: Slow stored procedure performance?

2005-02-06 Thread Vic Cekvenich
Clinton Begin wrote:
Same parameters, same load on DB, everything.  Very
reproducable.  Does anyone have any tips on what might be happening?
   

Can you do even more in the sored procedure itself... and let SQL map 
deal with the mapping of results only?
Also... sometimes with recompile in sql will help pick a good 
execution path.

All guesses
.V
(ps: one time I wrote a 94 page stored procedure and it was sub 
second. I did not use iBatis at the time)

--
Forums, Boards, Blogs and News in RiA http://www.boardVU.com


Re: Slow stored procedure performance?

2005-02-06 Thread Clinton Begin
 (ps: one time I wrote a 94 page stored procedure and it was sub
 second. I did not use iBatis at the time)

Man, you're like a self-deprecating comic.  First you admit to using
Maps for your domain model, now you're claiming responsibility for a
94 page stored proc!!!

;-)

On Sun, 06 Feb 2005 11:40:40 -0600, Vic Cekvenich [EMAIL PROTECTED] wrote:
 Clinton Begin wrote:
 
  Same parameters, same load on DB, everything.  Very
 reproducable.  Does anyone have any tips on what might be happening?
 
 
 Can you do even more in the sored procedure itself... and let SQL map
 deal with the mapping of results only?
 Also... sometimes with recompile in sql will help pick a good
 execution path.
 
 All guesses
 
 .V
 (ps: one time I wrote a 94 page stored procedure and it was sub
 second. I did not use iBatis at the time)
 
 --
 Forums, Boards, Blogs and News in RiA http://www.boardVU.com



OT: Re: Slow stored procedure performance?

2005-02-06 Thread friendVU admin
Did you heard the one about a cast?
TabbSkelCont cont=(TabbSkelCont) JndiHelper.lookup(board_cont);
Groovy man,. :-P
.V
Clinton Begin wrote:
Man, you're like a self-deprecating comic.  First you admit to using
Maps for your domain model, ..
;-)
 




Re: Flexible ResultMaps (Again)

2005-02-06 Thread Huy
Clinton Begin wrote:
Looosly typed!

That's not loose typing.  It's NO typing.
The type that's missing isn't what you think it is.  The type that's
missing is your domain class definition.  You don't have types at all.
 You just have collections of implicitly related information.
In any case, I appreciate your heavy, thorough testing of our Map
support (seriously actually).  ;-)
Cheers,
Clinton
Now that you guys have concluded that map usage is not desirable ( I 
totally agree), is there any chance of answering my original question 
about the flexible resultmaps ?

Thanks.
Huy


Re: Flexible ResultMaps (Again)

2005-02-06 Thread Larry Meadors
Heheh, while we drift further and further off topic here, I promise
this will be my last post on this, but I do have to point out two of
the resons I do not like using maps:

On Sun, 06 Feb 2005 09:09:09 -0600, friendVU admin
[EMAIL PROTECTED] wrote:
 ArrayList res = GenericDaoHelper.retrive(findClinets,parms);
 req.setAttribute(resutls,res);

What are clinets, and what are resutls?

My guess is that they are clients and results, but no compiler in
the world will *ever* show me that problem.

Regardless of the fact that both of these are not in domain objects,
it points out my biggest beef with Map use in this context: if I
create a results property ina bean with getResults and setResults,
my compile will fail big and ugly with an attempt to call
getResutls, and my IDE will type the code for me (being a fairly
lazy coder who does not like to track down silent failures, I like
BOTH of those things).

This IMO is a Good Thing (tm), and no amount of loose coupling talk
will *ever* convince me otherwise. Period.

 // then have DisplayTag display the table in JSP
 
 GenericDaoHelper() {
 public ArrayList ) _sqlMap.retrieve(stringRetnName, parmMap) {
 return (ArrayList) _sqlMap.queryForList(stringRetName, parmMap);

VIC! Are you seriously putting ArrayList in your interfaces? How can
you talk about loose coupling and put this chunk of code in the same
message? :-D

Larry


Re: New article about iBatis

2005-02-06 Thread Larry Meadors
Dang, they are coming out of the woodwork now. :-)

I added a page to the WIKI for iBATIS writings.

http://wiki.apache.org/ibatis/Articles_20and_20other_20coverage_20of_20iBATIS

If there are more that I missed, feel free to add them.

Larry


On Sun, 6 Feb 2005 13:33:40 -0300 (ART), Douglas
[EMAIL PROTECTED] wrote:
 See :
 http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0502cline/
 
 
 ___
 Yahoo! Acesso Grátis - Instale o discador do Yahoo! agora. 
 http://br.acesso.yahoo.com/ - Internet rápida e grátis



Re: Flexible ResultMaps (Again)

2005-02-06 Thread Clinton Begin
I believe we already answered your question...this is the second
thread you've posted on the subject, no?

Clinton


On Mon, 07 Feb 2005 09:13:31 +1100, Huy [EMAIL PROTECTED] wrote:
 Clinton Begin wrote:
 Looosly typed!
 
 
  That's not loose typing.  It's NO typing.
 
  The type that's missing isn't what you think it is.  The type that's
  missing is your domain class definition.  You don't have types at all.
   You just have collections of implicitly related information.
 
  In any case, I appreciate your heavy, thorough testing of our Map
  support (seriously actually).  ;-)
 
  Cheers,
  Clinton
 
 
 Now that you guys have concluded that map usage is not desirable ( I
 totally agree), is there any chance of answering my original question
 about the flexible resultmaps ?
 
 Thanks.
 
 Huy



Re: Flexible ResultMaps (Again)

2005-02-06 Thread Clinton Begin
Okay, I just reviewed my previous answers and perhaps we need to
answer more clearly your questions exactly:

We favour explicit behaviour over implicit.  We do so in line with
strongly typed languages that we support such as Java and C#.  We
detest implicit behaviour because it is difficult to maintain and
debug.  Trust me, your suggestion will not make things easier, it will
only make tradeoffs that are equal at best and probably less
desirable.  We are considering other options for ease of maintenance
such as supporting the generate tag (like the C# version) and
possibly considering inline result maps (which are explicit, but also
easy to maintain).  We're also looking into a number of tooling
options to help with the maintenance of SQL maps.

This is my initial answer.  My suggestion to you is to add a Wish or
New Feature entry into JIRA so that we don't lose track of this. 
You're the second person to request this.  With some more support, we
will prioritize it accordingly and you may yet see it in a future
release.

Cheers,
Clinton

 



On Sun, 6 Feb 2005 22:02:15 -0700, Clinton Begin
[EMAIL PROTECTED] wrote:
 I believe we already answered your question...this is the second
 thread you've posted on the subject, no?
 
 Clinton
 
 
 On Mon, 07 Feb 2005 09:13:31 +1100, Huy [EMAIL PROTECTED] wrote:
  Clinton Begin wrote:
  Looosly typed!
  
  
   That's not loose typing.  It's NO typing.
  
   The type that's missing isn't what you think it is.  The type that's
   missing is your domain class definition.  You don't have types at all.
You just have collections of implicitly related information.
  
   In any case, I appreciate your heavy, thorough testing of our Map
   support (seriously actually).  ;-)
  
   Cheers,
   Clinton
  
 
  Now that you guys have concluded that map usage is not desirable ( I
  totally agree), is there any chance of answering my original question
  about the flexible resultmaps ?
 
  Thanks.
 
  Huy
 



Re: Flexible ResultMaps (Again)

2005-02-06 Thread huymail
 Okay, I just reviewed my previous answers and perhaps we need to
 answer more clearly your questions exactly:

 We favour explicit behaviour over implicit.  We do so in line with
 strongly typed languages that we support such as Java and C#.  We
 detest implicit behaviour because it is difficult to maintain and
 debug.

There was another recent thread about parameter maps which asked for the
same thing which you thought was a good idea. I'm not sure what the
difference is there (in terms of implicit behaviour). (Not sure how to
provide link to this other thread)

 Trust me, your suggestion will not make things easier, it will
 only make tradeoffs that are equal at best and probably less
 desirable.

I'm sorry to sound distrustful, but if you can give me an example of where
it would not be desirable I would accept it. Sorry for soundind like a
nagging free wheeling programmer but I reallly believe sqlmap will benefit
from this from simplifying the resultmaps.

 We are considering other options for ease of maintenance
 such as supporting the generate tag (like the C# version) and
 possibly considering inline result maps (which are explicit, but also
 easy to maintain).

I really don't like inline result maps because you'd have alot of
duplicateinline mappings all over your sqlmap which not only looks
messy but would result in quite a maintenance problem IMO. I hope you
never get rid of resultmaps (even without what I'm asking for).

 We're also looking into a number of tooling
 options to help with the maintenance of SQL maps.

I guess this would be a way around complex sqlmaps but I love getting my
hands dirty and would rather have the maps easy to maintain by hand.

 This is my initial answer.  My suggestion to you is to add a Wish or
 New Feature entry into JIRA so that we don't lose track of this.
 You're the second person to request this.  With some more support, we
 will prioritize it accordingly and you may yet see it in a future
 release.

Thanks for the response, I'll do this.

 Cheers,
 Clinton





 On Sun, 6 Feb 2005 22:02:15 -0700, Clinton Begin
 [EMAIL PROTECTED] wrote:
 I believe we already answered your question...this is the second
 thread you've posted on the subject, no?

 Clinton


 On Mon, 07 Feb 2005 09:13:31 +1100, Huy [EMAIL PROTECTED] wrote:
  Clinton Begin wrote:
  Looosly typed!
  
  
   That's not loose typing.  It's NO typing.
  
   The type that's missing isn't what you think it is.  The type that's
   missing is your domain class definition.  You don't have types at
 all.
You just have collections of implicitly related information.
  
   In any case, I appreciate your heavy, thorough testing of our Map
   support (seriously actually).  ;-)
  
   Cheers,
   Clinton
  
 
  Now that you guys have concluded that map usage is not desirable ( I
  totally agree), is there any chance of answering my original question
  about the flexible resultmaps ?
 
  Thanks.
 
  Huy
 





Re: iBatis and EJB

2005-02-06 Thread Abdullah Kauchali


Great stuff Clinton.Somehow, I'm surprised.  :)
{Shoot!}  That should have been:  Somehow, I'm *NOT* surprised!.
:(
Abdullah
ps.  that's what happens when you work with .NET