Re: IN (SQL), how to iterate?

2006-06-15 Thread puneet arya
hi,  SELECT name,branch,username               FROM KXAccount               WHERE id IN (#ids#)You can write in xml as      SELECT name,branch,username               FROM KXAccount               WHERE id IN ($ids$)   and in these id you have to capture as a string . if u didnt get , you just

Re: isPropertyAvailable doesn't work as expected...

2006-06-15 Thread puneet arya
hi,    Y dnt you use join statement for this.[EMAIL PROTECTED] wrote: Hello,I have two simple queries which I am trying to combine usingbut it doesn't seem to work as expected.Query 1: SELECT requestid FROM users WHERE name = 'test'Query 2: SELECT count(*) FROM users WHERE name = 'test'IN XML:===

Re: 2 Lists in query statement

2006-06-15 Thread Jeff Butler
Try something like this with different properties in your parameter object for each list:      #profileIdList[]#Jeff Butler     On 6/15/06, Debasish Dutta Roy <[EMAIL PROTECTED]> wrote: hi allI need to add 2 lists into the query. i.e. I have a select with 2 IN clause. Used an object with 2 lists.

Re: 2 Lists in query statement

2006-06-15 Thread Nathan Maves
For starters you might want to include the full stack trance. Second, I am not sure how you plan to use a resultClass of ArrayList. If you need a list of Objects then use the queryForList instead of queryForObject. Third, are you sure that you have both ppidList and profileIdList defined

Re: Hook before creating objects

2006-06-15 Thread Jeff Butler
See the following JIRA issue for details of the solution to this problem:   http://issues.apache.org/jira/browse/IBATIS-50  This new feature will be in the next release of iBATIS (please don't ask when - we're working hard on it now).  However, if you need it now you can always check out the source

2 Lists in query statement

2006-06-15 Thread Debasish Dutta Roy
hi allI need to add 2 lists into the query. i.e. I have a select with 2 IN clause. Used an object with 2 lists. Passed that to the query.            select distinct psp.profile_study_protocol_id         from profile_study_protocol psp, profile_protocol_item ppi         where             psp.profil

Hook before creating objects

2006-06-15 Thread Leandro Saad
Hi all. I'm new to iBatis (OJB background).What I need to do is replace Resources.instantiate() http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/common/resources/Resources.java by my own object factory that knows how to create/initalize pojos.Since this method is sta

Re: isPropertyAvailable doesn't work as expected...

2006-06-15 Thread Jeff Butler
You'll have to do remapResults="true" in this case - because you are changing the result set in the same query. Jeff Butler   On 6/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello,I have two simple queries which I am trying to combine using but it doesn't seem to work as expected. Query 1:

Re: isPropertyAvailable doesn't work as expected...

2006-06-15 Thread ibatis
Problem solved: use and . Aladin > > I have two simple queries which I am trying to combine using > but it doesn't seem to work as expected. > > Query 1: SELECT requestid FROM users WHERE name = 'test' > Query 2: SELECT count(*) FROM users WHERE name = 'test' > > IN XML: > === > cacheMode

isPropertyAvailable doesn't work as expected...

2006-06-15 Thread ibatis
Hello, I have two simple queries which I am trying to combine using but it doesn't seem to work as expected. Query 1: SELECT requestid FROM users WHERE name = 'test' Query 2: SELECT count(*) FROM users WHERE name = 'test' IN XML: === SELECT count(*) requestid FROM users WHERE name = 't

Re: Rollback Issues

2006-06-15 Thread Jeff Butler
Tony - this is something iBATIS is doing to try to help you (Ha Ha).  By default iBATIS will not commit after a queryForObject or queryForList - even if you explictely call the commitTransaction() method.  The solution is to add the attribute commitRequired="true" to the transactionManager element

Re: Rollback Issues

2006-06-15 Thread Debasish Dutta Roy
OK. What happens is this SP fails. So the idea is a request is created and inserted, take the request id and call the SP to generate a number. If the SP fails, the insert of the request should also rollback. Now the SP fails and REQUEST is not rolled back. Now, part of the request insert are two ca

Re: Rollback Issues

2006-06-15 Thread Tony Qian
Jeff, Since you mentioned stored procedure and transaction, I have encountered a strange situation when using MySQL stored procedure. In my stored procedure, I do some update to the records in a table then select all those rows get updated. In my Dao, I call QueryForList to retrieve the record

Re: Rollback Issues

2006-06-15 Thread Jeff Butler
I remember what was unusual...   You need to make sure that the stored procedure is not doing a commit (obvious).  What is not so obvious is that you also need to make sure that there are no DDL statements in the stored procedure.  Oracle implictly commits after every DDL statement.   Jeff Butler 

Re: Rollback Issues

2006-06-15 Thread Jeff Butler
The plot thickens...   I seem to remember that there is something unusual with Oracle stored procedures and transactions.  Sounds to me like the stored procedure call is causing a commit somehow.  You could try some other combination of statements without a SP call just to check.  I'm not an Oracle

Re: Rollback Issues

2006-06-15 Thread Debasish Dutta Roy
OK. Here are the answers1. First one is an insert & second one is a stored proc call. The first one populates the REQUEST table and the second one gets a number based on the request id.2. Dao1 and DAO2 catches SQLException and throws DAOException (my exception, not iBATIS DAOException).     This DA

RE: lazy loading

2006-06-15 Thread Poitras Christian
You are right. The List of Items is only populated (and you'll sure wait a long time!) when the 2nd call is made. For sure, if you are to populate so many objects in one List, you will have to find a better way to populate only a part of it. Also, make sur the the List implementation you are using

Re: Rollback Issues

2006-06-15 Thread Jeff Butler
I think we need a little more information.  I assume that the code you've prsented is a mocked up example - and everything looks right in your mock up.   Questions:   1. What is the method secondTask() doing?  Hopefully no transaction stuff (like another start transaction or a commit). 2. What Exce

Re: Rollback Issues

2006-06-15 Thread Debasish Dutta Roy
offcourse it will be helpful if you could share what you did correctly, and if you could find something wrong in my approach. I am using Oracle 9i.On 6/15/06, Tony Qian <[EMAIL PROTECTED]> wrote: Yes. It worked for me (MySQL). Tony Debasish Dutta Roy wrote on 6/15/2006, 11:09 AM: Hi Al

Re: lazy loading

2006-06-15 Thread Dodo
Cool, Poitras, Just some clarification. So if I retrieve a Category object that has an ArrayList of 1 million Item objects as below Category cat = dao.getCategory( new Long(1) ); this call shud return very quickly as an ArrayList of 1 million Item objects will not be populated. However, if

Re: Rollback Issues

2006-06-15 Thread Tony Qian
Yes. It worked for me (MySQL). Tony Debasish Dutta Roy wrote on 6/15/2006, 11:09 AM: Hi All Has anyone successfully tested rollback with DAOManager implementation. I am unable to get it working. I have a business delegate who does like this: DAO1 dao1 = daoManager.getDAO(DAO1.cl

Rollback Issues

2006-06-15 Thread Debasish Dutta Roy
Hi AllHas anyone successfully tested rollback with DAOManager implementation.I am unable to get it working. I have a business delegate who does like this:DAO1 dao1 = daoManager.getDAO(DAO1.class);DAO2 dao2 = daoManager.getDAO(DAO2.class);try {   daoManager.startTransaction();  dao1.firstTa

RE: lazy loading

2006-06-15 Thread Poitras Christian
My answer may not be complete. But I will give you an idea. If you enable lazy loading, the object that is loaded will be populated normaly. For all properties of this object that are loaded by another select and that points to a non-final class will be in lazy mode. The lazy object linked to the

database identity (or surrogate key) for equals()

2006-06-15 Thread Dodo
Hi,   I am thinking of using surrogate key (the one generated by database) to implement equals() of domain object for ibatis.   Now is there any pitfall I need to know???   Anyone doing things this way??   Although 'Hibernate in Action' said this is a bad idea but I only want to compare obj

Running Stored Procedure using IBatis

2006-06-15 Thread Binu Andrews
hai all,   im using Ibatis for my data access operations. i want to invoke stored functions in oracle using ibatis. but these stored functions are using user defined data types as input and output parameters. is there any way to handle this issue.     im using classes which are created using j publ

testing for lazy loading

2006-06-15 Thread Dodo
Hi,   How do I test for lazy loading to assure myself that it's working?   I did some test as below where user has complex collection as List   long start = System.currentTimeMillis();    User user = (User) dao.getUser(new Long(1));      long elapsedTimeMillis = System.currentTim

Re: IN (SQL), how to iterate?

2006-06-15 Thread RZG
 eg sql:    SELECT name,branch,username               FROM KXAccount               WHERE id IN (#ids#) you can write as this:     SELECT name,branch,username               FROM KXAccount    #ids[]# 2006/6/15, xianwinwin <[EMAIL PROTECTED]>: can anyone provide an exmple of how to u