RE: gracefuly exit from row handler

2009-04-30 Thread Ben Shory
sotred proc is not an option. actually i'm porting a db2 stored proc
batch app to java - spring batch - ibatis.
ok, let's say i'm processing milions of rows and counting errors.. if i
reach 1k errors i want to quit.
i can use paging instead of row handler but a. it has a performance
impact and b. i need to change the sql statements and also make them
vendor specific.
 



From: Sundar Sankar [mailto:fatboys...@gmail.com] 
Sent: Thursday, April 30, 2009 7:11 PM
To: user-java@ibatis.apache.org
Subject: Re: gracefuly exit from row handler


I would have used a stored proc or something to do that in the DB
itself. Personally I dont wanna transfer a million records over the
network and then do some logic to fetch one out of it. 

I dont know what your situation is, may be if you explain more, there
might be a more elegant way, some of the users might have for u!

-Sundar


On Thu, Apr 30, 2009 at 8:57 AM, Ben Shory  wrote:


not really.. i need to choose one row out of milions using logic
involving other data sources.



From: Clinton Begin [mailto:clinton.be...@gmail.com] 
Sent: Thursday, April 30, 2009 3:58 PM
To: user-java@ibatis.apache.org
Subject: Re: gracefuly exit from row handler


Not really... but why are you asking for data you don't need?
Is there any way to just select out exactly what you need?


On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory 
wrote:


Hi,
any way of breaking from row handler if I don't need to
traverse the results anymore?
if I throw runtime exception will it handle the
resources correctly?
 

  --ben





Re: gracefuly exit from row handler

2009-04-30 Thread Sundar Sankar
I would have used a stored proc or something to do that in the DB itself.
Personally I dont wanna transfer a million records over the network and then
do some logic to fetch one out of it.

I dont know what your situation is, may be if you explain more, there might
be a more elegant way, some of the users might have for u!

-Sundar

On Thu, Apr 30, 2009 at 8:57 AM, Ben Shory  wrote:

>  not really.. i need to choose one row out of milions using logic
> involving other data sources.
>
>  --
> *From:* Clinton Begin [mailto:clinton.be...@gmail.com]
> *Sent:* Thursday, April 30, 2009 3:58 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: gracefuly exit from row handler
>
> Not really... but why are you asking for data you don't need?  Is there any
> way to just select out exactly what you need?
>
> On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory  wrote:
>
>>  Hi,
>> any way of breaking from row handler if I don't need to traverse the
>> results anymore?
>> if I throw runtime exception will it handle the resources correctly?
>>
>>   --ben
>>
>
>


RE: gracefuly exit from row handler

2009-04-30 Thread Ben Shory
not really.. i need to choose one row out of milions using logic
involving other data sources.



From: Clinton Begin [mailto:clinton.be...@gmail.com] 
Sent: Thursday, April 30, 2009 3:58 PM
To: user-java@ibatis.apache.org
Subject: Re: gracefuly exit from row handler


Not really... but why are you asking for data you don't need?  Is there
any way to just select out exactly what you need?


On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory  wrote:


Hi,
any way of breaking from row handler if I don't need to traverse
the results anymore?
if I throw runtime exception will it handle the resources
correctly?
 

  --ben




Loading Properties File into SqlMapConfig

2009-04-30 Thread Srinivas Doddi
Hi

We have been using iBatis for the past one year and now we are trying to
re-organize our project structure.  Previously we have our project
structure as below and we were using .   Now we have to
externalize our properties file and I am using , but I am
getting a File Not Found Exception.  Am I doing anything wrong here?  I
am using Tomcat 6/JDK 1.6 and RHEL as my OS.

Old Structure:

ROOT
|
|
|--META-INF
|  |--database.properties
|
|
|-WEB-INF
| |
| |-classes
   |
sqlConfiguration.xml




Current Structure:


 Opt
|---folder 1
|   |
|   |---folder 1.1
| |--database.properties
|
|   
|---folder 1.2  
|
ROOT
|
|
|--META-INF
|  
|
|
|-WEB-INF
| |
| |-classes
   |

sqlConfiguration.xml



Thanks for your help.

SRINI



Re: newbie trouble grokking error message

2009-04-30 Thread Sean Mitchell
On Wed, Apr 29, 2009 at 9:46 AM, Nathan Maves  wrote:

> This really does look like a mapping issue.  Please include the source code
> of the bean and the  map that you are using.

No go on posting any code... I was referred to in house 'experts' who
knew even less than I.

It turns out that it was indeed a mapping issue, but not in the
reported file. The error log said the problem was in the source
mapping file, but in fact it was in the target mapping file. Case
sensitivity issue and user error :)

Sean


Re: gracefuly exit from row handler

2009-04-30 Thread Clinton Begin
Not really... but why are you asking for data you don't need?  Is there any
way to just select out exactly what you need?

On Thu, Apr 30, 2009 at 2:20 AM, Ben Shory  wrote:

>  Hi,
> any way of breaking from row handler if I don't need to traverse the
> results anymore?
> if I throw runtime exception will it handle the resources correctly?
>
>   --ben
>


RE: Custom vendor specific Queries

2009-04-30 Thread Ben Shory
i had to accomplish the same thing.
 
please see post on the issue:
 

On Mon, Jan 12, 2009 at 10:41 AM, Ben Shory  wrote:

> Since I'm trying to make it transparent as possible for the DBAs I 

> decided to create a plugin Which modifies all the DAO generated 

> methods to be like this for

> example:

>

> Integer count = (Integer)

> getSqlMapClientTemplate().queryForObject(getStmtId("table.ibatorgenera

> te

> d_countByExample"), example);

>

> ^^^

> This plugin also sets a custom super class which implments getStmtId -


> something like this:

>

> protected String getStmtId(String stmtId) {

> initStmtsIfNeeded();

> if(stmts.containsKey("specific-"+stmtId)) {

> return "specific-"+stmtId;

> }

> return stmtId;

> }

>

> Now my DBAs / clients may just drop-in their custom SQL with the 

> naming convention of specific-{table} for the sqlmap namespace

>

> To determine if the statement exsits I had to downcast to 

> SqlMapClientImpl, hope it's not too much of bad practice..

>

> Thanks.

>

>

> -Original Message-

> From: Jeff Butler [mailto:jeffgbut...@gmail.com
 ]

> Sent: Monday, January 12, 2009 6:27 PM

> To: user-java@ibatis.apache.org

> Subject: Re: SQL selector

>

> iBATIS does not have a simple API for determining if a statement 

> exists

> - so there's some difficulty with this idea.

>

> This reminds me of the design principle "prefer polymorphism over 

> instanceof". It seems to me that you could extend a generic DAO 

> implementation with a vendor specific implementation and override just


> the methods that have vendor specific SQL. You would also have to 

> configure Spring so that you could pull out the vendor specific 

> implementation that you need. This seems easier to me - but I may not 

> understand the entirety of what you're trying to accomplish.

>

> Jeff Butler

>

> On Mon, Jan 12, 2009 at 3:19 AM, Ben Shory  wrote:

>> It might be better to write a plugin that manipulates the generated 

>> method?

>>

>> -Original Message-

>> From: Ben Shory [mailto:be...@sapiens.com 
]

>> Sent: Monday, January 12, 2009 11:13 AM

>> To: user-java@ibatis.apache.org

>> Subject: SQL selector

>>

>> Hi,

>> Before any statement execution, I would like to first check if it has


>> a vendor specific implementation and execute it if so or the default 

>> one if not.

>> My DAOs are generated as spring dao with ibator.

>> I thought of doing something like -

>>

>> String stmtId = "table"+spec_postfix+".countByExample";

>> if(!statementExists(stmtId)) {

>> stmtId = "table.countByExample";

>> }

>> Integer count = (Integer)

>> getSqlMapClientTemplate().queryForObject(stmtId,

>> example);

>> return count;

>>

>> Is this a good approach?

>> Would I have to override SpringDAOTemplae?

>>

>>

>

 




From: Nathan Maves [mailto:nathan.ma...@gmail.com] 
Sent: Wednesday, April 29, 2009 6:36 AM
To: user-java@ibatis.apache.org
Subject: Re: Custom vendor specific Queries


There is nothing in ibatis that will do this.  this people can usually
be solved at build time by including the sqlmaps that you need to bundle
with your app.


On Sun, Apr 19, 2009 at 2:41 PM, Saloucious 
wrote:



Hello,

i would like to know if it is possible to create custom
workaround queries
for specific vendors.

Something like  :




where sql/sqlserver/Person.xml override queries defined in
sql/Person.xml

Thanks
--
View this message in context:
http://www.nabble.com/Custom-vendor-specific-Queries-tp23127179p23127179
.html
Sent from the iBATIS - User - Java mailing list archive at
Nabble.com.






gracefuly exit from row handler

2009-04-30 Thread Ben Shory
Hi,
any way of breaking from row handler if I don't need to traverse the
results anymore?
if I throw runtime exception will it handle the resources correctly?
 
  --ben