RE: Am I doing anything wrong? iBATIS has very poor performance o n batch inserts compared to JDBC.

2005-06-09 Thread Ming Xue
Has anybody else done such test? This can be an important issue.

-Original Message-
From: Dmitry Skavish [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 09, 2005 1:50 PM
To: ibatis-user-java@incubator.apache.org; Bing Zou
Subject: Re: Am I doing anything wrong? iBATIS has very poor performance
on batch inserts compared to JDBC.


May be you have to wrap it into transaction?

On 6/9/05, Bing Zou [EMAIL PROTECTED] wrote:
 Am I doing anything wrong? Why iBATIS is so slow compared to JDBC?
 Thanks.


-
 Using iBATIS to insert 1000 records: (38375 ms)
 sqlMap.startBatch();
 Map args = CollectionUtil.createMap(2);
 for(int i=0;ip_resultList.size();i++){
 AdvancedSearchResultData resultData =
 (AdvancedSearchResultData)p_resultList.get(i);
 args.put(RESULT_DATA, resultData);
 args.put(UserIdentifier, p_userID);
 sqlMap.insert(insertIntoTempTable, args);
 }
 sqlMap.executeBatch();
 
 INSERT INTO TEMPTABLE (ORDER_NUMBER, RESOURCE_ID,
 RESOURCE_TYPE_ID,USER_ID, ATTACHMENT_ID)
 VALUES ( #RESULT_DATA.relevance#,
  #RESULT_DATA.resourceIdentifier.ID#,
  4,
  #UserIdentifier.ID#,
  #RESULT_DATA.attachmentIdentifier.ID# )
 


-
 Using JDBC to insert the same 1000 records (391 ms)
 statement = connection.prepareStatement( INSERT INTO
 TEMP_FTS(ORDER_NUMBER,  RESOURCE_ID,
 RESOURCE_TYPE_ID,USER_ID,ATTACHMENT_ID)  +
 VALUES ( ?,?, 4, ?, ?) );
 for(int i=0;ip_resultList.size();i++){
 
 AdvancedSearchResultData resultData =
 (AdvancedSearchResultData)p_resultList.get(i);
 statement.setLong( 1, i );
 statement.setLong( 2, resultData.getResourceId() );
 statement.setLong( 3, p_userID.getID() );
 statement.setLong( 4, resultData.getAttachmentId() );
 // attachment_id
 statement.addBatch();
 }
 statement.executeBatch();
 


-- 
Dmitry Skavish


Custom Tag

2005-05-12 Thread Ming Xue
Title: RE: Oracle OC4J and signon



Hi 


I am 
very much amazed by Ibatis's ability to generate dynamic sql, which 
isblank in Hibernate. There are a couple predefined tags provided by 
default, But, does the framework support Custom Tags? if so, 
how can I attched them to the FrameWork?

thanks

Ming
[Ming 
Xue]

-Original 
Message-From: Trussell David N 
[mailto:[EMAIL PROTECTED]Sent: Thursday, May 12, 2005 2:35 
PMTo: 'ibatis-user-java@incubator.apache.org'Subject: RE: 
Oracle OC4J and signon

  Bingo! I commented out the security-constraint tag and 
  it all works nicely. 
  I made the assumption that most developers would know what 
  OC4J in the subject meant: Oracle Container for Java. It's based on Orion. My 
  apologies.
  Thank you for all your patience and help, Brice! Now, where 
  did I put that hammer 
  -Original Message- From: Brice 
  Ruth [mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, May 12, 2005 11:59 AM To: ibatis-user-java@incubator.apache.org Subject: Re: Oracle OC4J and signon 
  can you find web.xml? there should be a 
  security-constraint tag in there ... that ties particular pages to a 
  security restriction.
  I wasn't aware that this was running in Oracle's App server as 
  well. If you mentioned that earlier, I apologize. 
  I've never used Oracle's App server ... so my help may be 
  limited in this area. 
  On 5/12/05, Trussell David N [EMAIL PROTECTED] 
  wrote:   
   I can't find a context.xml. As far as I can see, 
  a realm would be  configured in jazn-data.xml and 
  there are no entries in that file.  
   I get one of these entries in my 
  global-applications.log for each time  the pop-up 
  window is presented (meaning when I click "Sign-in" or  "Enter the Store"). I'm not well-versed enough in Java to know 
  what  this means:  
   05/05/12 10:18:04 jpetstore: Servlet error 
   java.lang.SecurityException  at 
  com.evermind[Oracle Application Server Containers for J2EE 10g 
   
  (10.1.2.0.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2676) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpApplication.getLocalDispatcher(HttpApplication.java:4734) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpSite.getRequestDispatcher(HttpSite.java:341) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:1368) 
at 
   
  org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062) 
   
  at  
  org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455) 
   
  at  
  org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) 
   
  at  
  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) 
   
  at  
  org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) 
   
  at  
  javax.servlet.http.HttpServlet.service(HttpServlet.java:740)  at 
   
  javax.servlet.http.HttpServlet.service(HttpServlet.java:853)  at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) 
at 
  com.evermind[Oracle Application Server Containers for J2EE  10g  
  (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) 
at 
  java.lang.Thread.run(Thread.java:534)  
   -Original Message-  From: Brice Ruth [mailto:[EMAIL PROTECTED]]  Sent: Thursday, May 12, 2005 9:30 AM  
  To: ibatis-user-java@incubator.apache.org  
  Subject: Re: Oracle OC4J and signon  

Hmmm ... well, take 
  a look at where the realm is configured. It would  
  have to be in context.xml as well as be referenced in web.xml ... 
On 5/12/05, Trussell David 
  N [EMAIL PROTECTED] wrote:  
   
  Yeah, j2ee/j2ee and ACID/ACID. But it doesn't accept either of those 
two.   
-Original Message-   From: Brice Ruth [mailto:[EMAIL PROTECTED]]   Sent: Thursday, May 12, 2005 9:09 AM   To: ibatis-user-java@incubator.apache.org   Subject: Re: Oracle OC4J and signon   Aha! This is basic rea

RE: Custom Tag

2005-05-12 Thread Ming Xue



For 
example, for Oracle in list limitation while using 


select 
* from abc
where 
a in ('a', 'b', 'c', ...)

We 
need to use a Custom tag for this.

Thanks


  -Original Message-From: Larry Meadors 
  [mailto:[EMAIL PROTECTED]Sent: Thursday, May 12, 2005 5:21 
  PMTo: ibatis-user-java@incubator.apache.orgSubject: Re: 
  Custom TagA couple?Check again.That is an 
  interesting idea though.LarryPS: Please do not reply to other 
  posts with new topics.
  On 5/12/05, Ming 
  Xue [EMAIL PROTECTED] 
  wrote: 
  
Hi 

I am very much amazed by 
Ibatis's ability to generate dynamic sql, which isblank in 
Hibernate. There are a couple predefined tags provided by 
default, But, does the framework support Custom Tags? if 
so, how can I attched them to the FrameWork?



RE: Custom Tag

2005-05-12 Thread Ming Xue

The Oralce in list limition is 250,  otherwise the sql can not be parsed,
For example:

select * from abc 
where a in ('a', 'b', 'c', ...) 

if there are more than 250 values in the in list, the sql needs to be
rewritten as:

select * from abc
where a in ('a', 'b', 'c'...)
or a in ('x', 'y', 'z'...)
or ...

In this way every inlist is less than 250

The Iterate tag is designed for generating the in-list, for it is not aware
of the Oracle limitation, so is there anyway I can modify the existing
iterate tag or creating a new one?

Thanks



-Original Message-
From: Brandon Goodin [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 12, 2005 5:40 PM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Custom Tag


That is not a clear example. I'm not sure what the problem is that you
are presenting. What tag would you write to accomplish a solution to
the problem you are presenting?

If you are referring to the population of an IN statement then you
could use iterate.

Brandon

On 5/12/05, Ming Xue [EMAIL PROTECTED] wrote:
  
 For example,   for Oracle in list limitation while using 
   
 select * from abc 
 where a in ('a', 'b', 'c', ...) 
   
 We need to use a Custom tag for this. 
   
 Thanks 
   
  
 -Original Message-
 From: Larry Meadors [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 12, 2005 5:21 PM
 To: ibatis-user-java@incubator.apache.org
 Subject: Re: Custom Tag
 
 A couple?
 
 Check again.
 
 That is an interesting idea though.
 
 Larry
 
 PS: Please do not reply to other posts with new topics.
 
  
 On 5/12/05, Ming Xue [EMAIL PROTECTED] wrote: 
  
  Hi 

  I am very much amazed by Ibatis's ability to generate dynamic sql, which
 is blank in Hibernate.  There are a couple predefined tags provided by
 default,  But,  does the framework support  Custom Tags? if so, how can I
 attched them to the FrameWork? 
  
  
 



Re: Possible Connection Leak

2005-05-09 Thread Ming Xue



Hi

I am 
using the SpringDAO framework, basically the SqlMapDAOSupport and 
SqlMapTemplate, the Transaction is acturally controlled by Spring, 
in this case, how should I config the transaction of SqlMap, should I use 
External Type ?

 
transactionManager type="EXTERNAL"
 dataSource 
type="JNDI" property name="DataSource" 
value="java:/PlateauDS"/ /dataSource 
/transactionManager

Here 
is my DAO

public 
class MyDAO extends SqlMapDAOSupport implements MyDAOService

{
 public void myMethod () {

 
getSqlMapClientTemplate().insert("insertAccount", account);

 }

}

The transaction is 
started in the EJB level, which calls the DAO, and a EJB may call any number of 
DAO to do the job, in this case, 
do I need to put in the SQLMap.startTransaction 
in the DAO code ?

Thanks
Ming



[Ming Xue]


-Original 
Message-From: Clinton Begin 
[mailto:[EMAIL PROTECTED]Sent: Monday, May 09, 2005 1:04 
PMTo: ibatis-user-java@incubator.apache.orgSubject: Re: 
Possible Connection Leak
Yes, the approach I suggested should be used regardless of your 
  transaction type.Cheers,Clinton
  On 5/9/05, Rafiq, 
  Adnan [EMAIL PROTECTED] 
  wrote:
  
Thanks 
Clinton.

We are using session beans 
to manage transactions in our application. Moreover, since we have multiple 
databases involved we are using XA- drivers.

Will the approach you 
mentioned still work in this scenario?


  -Original 
  Message-From: Clinton Begin [mailto:[EMAIL PROTECTED]]Sent: Saturday, May 
  07, 2005 9:30 PMTo: ibatis-user-java@incubator.apache.orgSubject: 
  Re: Possible Connection LeakDo ALL of your SqlMap calls follow this 
  pattern:try { sqlMap.startTransaction(); 
  //...do work sqlMap.commitTransaction();} finally 
  { sqlMap.endTransaction();}Clinton
  On 5/6/05, Rafiq, 
  Adnan [EMAIL PROTECTED] wrote: 
  I 
am using a transaction manager type = JTA in my sql-map-config.xml 
file.After running the application for a while, I am getting the 
followingmessage in my Weblogic 8.1 console:May 6, 2005 
5:09:08 PM CDT Warning Common BEA-000620 
Forcibly releasinginactive resource 
"[EMAIL PROTECTED]" backinto the 
pool "TP_BOFA_SYS".According to BEA, there is a connection 
leak somewhere. Is it possible that iBatis is not properly closing a 
connection after obtaining it?Has anyone else come across a 
similar 
  issue?


RE: Possible Connection Leak

2005-05-09 Thread Ming Xue

Do you mean I do not need Transaction in SqlMap at all (removing the
TransactionManager tag) ?

Thanks for any clarification.

-Original Message-
From: Henry Lu [mailto:[EMAIL PROTECTED]
Sent: Monday, May 09, 2005 2:23 PM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Possible Connection Leak


No. You config JNDI in the spring.xml instead.

-Henry

Ming Xue wrote:

 Hi
  
 I am using the SpringDAO framework,  basically the SqlMapDAOSupport 
 and SqlMapTemplate,  the Transaction is acturally controlled by 
 Spring,  in this case, how should I config the transaction of SqlMap,  
 should I use External Type ?
  
   transactionManager type=EXTERNAL
 dataSource type=JNDI
   property name=DataSource value=java:/PlateauDS/
 /dataSource
   /transactionManager
  
 Here is my DAO
  
 public class MyDAO extends SqlMapDAOSupport implements MyDAOService
  
 {
 public void myMethod () {
  
 getSqlMapClientTemplate().insert(insertAccount, account);
  
 }
  
 }
  
 The transaction is started in the EJB level, which calls the DAO, and 
 a EJB may call any number of DAO to do the job, in this case,
 do I need to put in the SQLMap.startTransaction  in the DAO code ?
  
 Thanks
 Ming
  
  
  

 [Ming Xue] 
  
  
  -Original Message-
 *From:* Clinton Begin [mailto:[EMAIL PROTECTED]
 *Sent:* Monday, May 09, 2005 1:04 PM
 *To:* ibatis-user-java@incubator.apache.org
 *Subject:* Re: Possible Connection Leak

 Yes, the approach I suggested should be used regardless of your
 transaction type.

 Cheers,
 Clinton

 On 5/9/05, *Rafiq, Adnan* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 Thanks Clinton.
  
 We are using session beans to manage transactions in our
 application. Moreover, since we have multiple databases
 involved we are using XA- drivers.
  
 Will the approach you mentioned still work in this scenario?

 -Original Message-
 *From:* Clinton Begin [mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]]
 *Sent:* Saturday, May 07, 2005 9:30 PM
 *To:* ibatis-user-java@incubator.apache.org
 mailto:ibatis-user-java@incubator.apache.org
 *Subject:* Re: Possible Connection Leak


 Do ALL of your SqlMap calls follow this pattern:

 try {
   sqlMap.startTransaction();
   //...do work
   sqlMap.commitTransaction();
 } finally {
   sqlMap.endTransaction();
 }

 Clinton


 On 5/6/05, *Rafiq, Adnan* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 I am using a transaction manager type = JTA in my
 sql-map-config.xml file.
 After running the application for a while, I am
 getting the following
 message in my Weblogic 8.1 console:

 May 6, 2005 5:09:08 PM CDT Warning Common
 BEA-000620 Forcibly
 releasing
 inactive resource
 [EMAIL PROTECTED] back
 into the pool TP_BOFA_SYS.

 According to BEA, there is a connection leak
 somewhere. Is it possible that
 iBatis is not properly closing a connection after
 obtaining it?

 Has anyone else come across a similar issue?





BLOB type handler

2005-05-04 Thread Ming Xue
I am doing some testing on Custom Type Handler, in my project,  BLOB is
mapped to a String type  java bean property, it seems the Framework can
not set the value properly. Does the java bean property has to be byte[]?

thanks


RE: BLOB type handler

2005-05-04 Thread Ming Xue
DB is oracle 9i, I already have the code to read/write BLOB, the question is
how to plug in these code into the Framework?

In the app, BLOB is used in multiple places :

JDBC type Java Type
BLOBString
BLOBXML
BLOBJava Object

How should I use the Custom Type handler to handle these cases ? or there
are other ways?

thanks



-Original Message-
From: Brandon Goodin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 04, 2005 12:48 PM
To: ibatis-user-java@incubator.apache.org
Subject: Re: BLOB type handler


Depends on what database you are using and how their driver supports
it. Please provide more information.

Brandon

On 5/4/05, Ming Xue [EMAIL PROTECTED] wrote:
 I am doing some testing on Custom Type Handler, in my project,  BLOB is
 mapped to a String type  java bean property, it seems the Framework can
 not set the value properly. Does the java bean property has to be byte[]?
 
 thanks