Re: Another custom type handler issue

2005-05-17 Thread Brice Ruth
Do you have to use arrays? How about lists instead? iBATIS (to my
knowledge) doesn't support returning arrays. My guess is if you were
to have ListAddress addresses and ListCommunication communications
(type specification not necessary, just highlighting what its doing) -
then iBATIS would do the right thing.

Brice

On 5/16/05, Ken Katsma [EMAIL PROTECTED] wrote:
 Now that I have the custom type handler executing correctly for the nested
 cursor, I have another question :)
  
  I'm trying to use the custom type handler to populate an array of objects
 in my class.  For instance, I have a Client, which contains Address[] arrays
 and Communication[] arrays.  I'd like to populate it with a custom type
 handler.  While I can get the type handler to execute for a single Address
 or communication object, I can't seem to find a way to get iBatis to
 understand that it needs to fire a type handler for an array of those
 objects.
  
  An even better way to handle this would be if there were some way I could
 nest the result maps so that I point the nested cursor to a second result
 map.
  
  Any ideas?
  
  Either way, I think I feel another hack coming on :(
  
  Thanks,
  
  Ken
  
  
  
  
  
  


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Very Confused.

2005-05-17 Thread Brice Ruth
Hi Dave,

If you're new to Java, I wouldn't suggest trying to setup jPetstore
... that can be kinda tricky even for folks who've been around Java
for a while.

I would suggest setting up your SqlMap.xml and sql-map-config.xml
files, as provided in the tutorial, and then creating a SqlConfig file
that initializes the configuration and provides a static method that
returns the SqlMapClient instance.

Then, create a very simple application that gets a SqlMapClient
instance and calls a query and verifies the results.

Let me know if that works for you - if you need more guidance (e.g.
code), I can help you with that, too.

Brice

On 5/17/05, Dave Guzda [EMAIL PROTECTED] wrote:
  
 Hello, 
   
 I'm trying to get *anything* to work with the iBatis setup and I'm having
 very little success... 
   
 I've tried to follow the tutorial and setup the PetStore example but nothing
 runs for me. I'm sure it is some sort of configuration issue... 
   
 I'm very new to Java ... so I'm sure that isn't helping. (Other applets and
 .java files do successfully access my database) 
   
 When I try to enter the store (JPetStore) I get :  
 HTTP Status 400 - Invalid path /pet/shop/index was requested 
 I also tried the example from this mailing list found here. It also won't
 run for me.
 http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01759.html
   
 Any guidance would be greatly appreciated. 
   
 Dave 
   


-- 
Brice Ruth
Software Engineer, Madison WI


Re: iBatis DAO - How to turn off data connection pool

2005-05-16 Thread Brice Ruth
Did you try 1 ?

On 5/16/05, Folashade Adeyosoye [EMAIL PROTECTED] wrote:
  
  
 
 How can I turn off the Database connection pool in the dao.xml 
 
   
 
   
 
transactionManager type=JDBC 
 
   property name=DataSource value=SIMPLE/ 
 
   property name=JDBC.Driver value=${driver}/ 
 
   property name=JDBC.ConnectionURL value=${url}/ 
 
   property name=JDBC.Username value=${username}/ 
 
   property name=JDBC.Password value=${password}/ 
 
   property name=JDBC.DefaultAutoCommit value=true/ 
 
   property name=Pool.MaximumActiveConnections value=10/ 
 
   property name=Pool.MaximumIdleConnections value=5/ 
 
   property name=Pool.MaximumCheckoutTime value=12/ 
 
 /transactionManager 
 
   
 
   
 
   
 
 I tried changing the   property name=Pool.MaximumActiveConnections
 value=0/ and   property name=Pool.MaximumIdleConnections value=0/,
 but I got an exception 
 
   
 
   
 
 exception is thrown - java.lang.IndexOutOfBoundsException:
 Index: 0, Size: 0 
 
  
 
   
 
   
 
 Thanks 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: PreparedStatementLogProxy log4j output with bind variables

2005-05-13 Thread Brice Ruth
You can use p6spy ... this will do what you want w/o needing to modify
this behaviour.

Just google for it.

Brice

On 5/11/05, Frank Thompson [EMAIL PROTECTED] wrote:
 Hello All,
 
 I was wondering if there was a way to either request a change or if there
 was a way to override the current logging output sent to log4j as shown
 below:
 
 From PreparedStatementLogProxy.java
 
 public Object invoke(Object proxy, Method method, Object[] params) throws
 Throwable {
 try {
   if (EXECUTE_METHODS.contains(method.getName())) {
 if (log.isDebugEnabled()) {
   log.debug({pstm- + id + } PreparedStatement:  +
 removeBreakingWhitespace(sql));
   log.debug({pstm- + id + } Parameters:  + getValueString());
   log.debug({pstm- + id + } Types:  + getTypeString());
 }
 
   .
   .
   .
 
 The invoke() method simply prints the prepared statement with no bind
 variable substitution so the statement is printed with the embedded '?'
 placeholders.  Is there a way to also include the statement as it would be
 sent to the database backend as the actual string with bind variables
 replaced.  If not is there a way that this Proxy could implement a SPI
 interface and adapter that could be configured as a runtime class that
 could have a custom Proxy implementation.
 
 Otherwise as it stands I would have to modify the class and rebundle a
 custom jar to change the log4j output ...
 
 thanks
 frank
 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Oracle 9.2 connection reset problem

2005-05-13 Thread Brice Ruth
One thing that may help ... when I set up a connection pool in Tomcat,
I noticed I could set up time-based connection validation, but I could
also set it up such that whenever a connection was requested by the
application, it would validate the connection BEFORE handing it over.
Regardless of the timing. This quickly took care of similar problems I
was having.

Does the data pool you're using have such an option?

Brice

On 5/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  
 Hi there! 
   
 We get a SQLException saying 'connection reset', it seems that the
 connection 
 is suddenly dead for us, and when we try again running the method ('click'
 on the 
 link that access the database again) again it's work just fine. It's happend
 in a web application 
 in production. There are about 10 people using the web application, that
 query 
 and update the database all the time of the day. 
   
 We haven't experience that we have run out of connections, just that this
 connection reset 
 problem now and then. Same behaviour working with a Toad tool like called
 DbVisualizer using 
 JDBC as the connection, if I don't use the tool for over 15-30 min I guess,
 same message 
 from Oracle as we get using SQLMap. 
   
 In test environment, we haven't experienced this problem, but that don't
 mean it's not 
 a problem there, maybe we just haven't been seen it, since we haven't done
 full scale 
 testing there. So it's only in production we have this problem it seems,
 where our Resin server 
 with the web application and Oracle db server are two different DMZ,  could
 that have 
 something to do with it ? 
  
   
 Anyway we have this kind of setup of the datasource. After we introduced the
 Pool.Ping configuration, it didn't helped that either.. 
   
 settings
 cacheModelsEnabled=true
 enhancementEnabled=true
 lazyLoadingEnabled=true
 maxRequests=256
 maxSessions=128
 maxTransactions=32
 useStatementNamespaces=false/ 
   
 transactionManager type=JDBC
 dataSource type=SIMPLE
 property name=JDBC.Driver value=${driver}/
 property name=JDBC.ConnectionURL value=${url}/
 property name=JDBC.Username value=${username}/
 property name=JDBC.Password value=${password}/
 property name=Pool.MaximumActiveConnections value=30/
 property name=Pool.MaximumIdleConnections value=1/
   Should we expand that one ???
 property name=Pool.MaximumWait value=1000/
 property name=Pool.PingQuery value=select * from dual/
 property name=Pool.PingEnabled value=true/
 property name=Pool.PingConnectionsOlderThan value=1/
 property name=Pool.PingConnectionsNotUsedFor value=1/
 property name=Pool.ValidationQuery value=select 1 from
 dual/
 property name=Pool.LogAbandoned value=true/
 property name=Pool.RemoveAbandoned value=true/
 property name=Pool.RemoveAbandonedTimeout value=5/
 /dataSource
 /transactionManager
  
 Shouldn't this Pool configuration work ?? = keeping the connections up to
 date ?? 
 We have tried to tune different values forth and back without any 100%
 result. 
   
 -- 
   
 When I run some test methods from my IDE, haven't experienced this problem, 
 and in debug mode I get these kind of feedback that's the Pool stuff seems
 to work. 
   
 DEBUG 13:39:36,186 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Checked out
 connection 32550604 from pool.
 DEBUG 13:39:36,186 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Testing
 connection 32550604...
 DEBUG 13:39:36,196 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Connection
 32550604 is GOOD!
 . 
 DEBUG 13:39:36,266 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Testing
 connection 32550604...
 DEBUG 13:39:36,266 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Connection
 32550604 is GOOD!
 DEBUG 13:39:36,266 [main]
 com.ibatis.common.jdbc.SimpleDataSource - Returned
 connection 32550604 to pool.
  
   
 Any clues anyone ? what we can do about this ? 
   
   
 Thanks for any help! 
   
   
 Best regards, 
 Erlend Bjrge 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Oracle OC4J and signon

2005-05-12 Thread Brice Ruth
Aha! This is basic realm authentication. I believe if you read the
docs for jPetstore, there's a default admin or guest user account you
can use to get in ... at least, I remember that from when I setup
jPetstore once upone a time!

Brice

On 5/12/05, Trussell David N [EMAIL PROTECTED] wrote:
  
 
 My apologies for attaching a screenshot. I understand that's frowned upon in
 a discussion list, but I don't know a better way of answer your question.
 It's the same window in Firefox and MS IE6. I assume it's an MS Windows
 window. Maybe I'll look at it as a Windows configuration problem instead of
 an OC4J trick. I'll check into the realm thing, too. Thank you very much for
 your reply. 
 
  -Original Message- 
  From: Daniel H. F. e Silva [mailto:[EMAIL PROTECTED] 
  Sent: Thursday, May 12, 2005 6:01 AM 
  To: ibatis-user-java@incubator.apache.org 
  Subject: RE: Oracle OC4J and signon 
  
  
  Hi David, 
  
   What is this window? A MS Windows window? A basic realm 
  window?  Have you checked if your webserver has any kind of 
  realm configured?  Hope that helps. 
  
  Cheers, 
   Daniel Silva. 
  
  
  
  --- Trussell David N [EMAIL PROTECTED] wrote: 
   It's the same database.properties file that's under Tomcat and that 
   works just fine. 
   
   I thought maybe the JDBC driver had to be in /WEB-INF/lib under 
   jpetstore so I tried both classes12.jar and ojdbc14.jar. 
  Nope. I also 
   put something totally bogus for the driver name in 
  database.properties 
   and it didn't even complain (at least, anywhere I can see). 
  It's just 
   pops up that window. 
   
   Ya know, this is really maddening. I've spent two days 
  trying to get 
   Appfuse running on OC4J with no success. Even Matt Raible 
  and company 
   couldn't help me. Now it's the same thing with iBATIS. 
  Heavy sigh. I 
   really wish I could just use Tomcat. 
   
-Original Message- 
From: Brice Ruth [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 11, 2005 2:38 PM 
To: ibatis-user-java@incubator.apache.org 
Subject: Re: Oracle OC4J and signon 


Is your DB connection authenticating properly to Oracle? I 
get this with DB2 if my password has expired or the account 
has been locked out. 

Brice 

On 5/11/05, Trussell David N [EMAIL PROTECTED] wrote: 
  
 
 I've just deployed JPetStore to Oracle OC4J 10.1.2 (I've also 
 tried 
 9.0.4) on Win XP and when I click Sign-in or Enter the 
  Store an 
 authentication window pops-up asking for my userid and 
  password. I 
 can't get past it. 
 
 Where can I disable this? 
 
 Thank you. 


-- 
Brice Ruth 
Software Engineer, Madison WI 

   
  
  

  __ 
  Yahoo! Mail Mobile 
  Take Yahoo! Mail with you! Check email on your mobile phone. 
  http://mobile.yahoo.com/learn/mail 
  
 
  
 
   
 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Oracle OC4J and signon

2005-05-12 Thread Brice Ruth
Glad it works ... sorry, I just figured OC4J was another Oracle DB thingie :)

On 5/12/05, Trussell David N [EMAIL PROTECTED] wrote:
  
 
 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 realm authentication. I believe if you read the 
   docs for jPetstore, there's a default admin or guest user account you 
   can use to get in ... at least, I remember that from when I setup 
   jPetstore once upone a time! 
   
   Brice 
   
   On 5/12/05, Trussell David N [EMAIL PROTECTED

Re: Oracle OC4J and signon

2005-05-11 Thread Brice Ruth
Is your DB connection authenticating properly to Oracle? I get this
with DB2 if my password has expired or the account has been locked
out.

Brice

On 5/11/05, Trussell David N [EMAIL PROTECTED] wrote:
  
 
 I've just deployed JPetStore to Oracle OC4J 10.1.2 (I've also tried 9.0.4)
 on Win XP and when I click Sign-in or Enter the Store an authentication
 window pops-up asking for my userid and password. I can't get past it. 
 
 Where can I disable this? 
 
 Thank you. 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Oracle OC4J and signon

2005-05-11 Thread Brice Ruth
Well, if you Tomcat has a DataSource w/ JNDI ... why don't you just
use that in iBATIS?

That's what I do ...

On 5/11/05, Trussell David N [EMAIL PROTECTED] wrote:
  
 
 It's the same database.properties file that's under Tomcat and that works
 just fine. 
 
 I thought maybe the JDBC driver had to be in /WEB-INF/lib under jpetstore so
 I tried both classes12.jar and ojdbc14.jar. Nope. I also put something
 totally bogus for the driver name in database.properties and it didn't even
 complain (at least, anywhere I can see). It's just pops up that window. 
 
 Ya know, this is really maddening. I've spent two days trying to get Appfuse
 running on OC4J with no success. Even Matt Raible and company couldn't help
 me. Now it's the same thing with iBATIS. Heavy sigh. I really wish I could
 just use Tomcat.
  
 
  -Original Message- 
  From: Brice Ruth [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, May 11, 2005 2:38 PM 
  To: ibatis-user-java@incubator.apache.org 
  Subject: Re: Oracle OC4J and signon 
  
  
  Is your DB connection authenticating properly to Oracle? I 
  get this with DB2 if my password has expired or the account 
  has been locked out. 
  
  Brice 
  
  On 5/11/05, Trussell David N [EMAIL PROTECTED] wrote: 

   
   I've just deployed JPetStore to Oracle OC4J 10.1.2 (I've also tried 
   9.0.4) on Win XP and when I click Sign-in or Enter the Store an 
   authentication window pops-up asking for my userid and password. I 
   can't get past it. 
   
   Where can I disable this? 
   
   Thank you. 
  
  
  -- 
  Brice Ruth 
  Software Engineer, Madison WI 
  


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Transactions/BatchStatements

2005-05-04 Thread Brice Ruth
If you're not using startBatch() - then iBATIS will have JDBC run each one individually ... the batching is something that's driver specific (but supported by JDBC), if I recall correctly. It just adds some efficiency.
Each of your inserts runs at the time they are called (without batching), the commit is just a message sent to the database. What *it* does at that time, is implementation dependent.If you look at your JDBC traffic, tho - you'll see it executing each insert when its called, and not waiting for the commit/endTransaction to be called.
On 5/4/05, Gregg D Bolinger [EMAIL PROTECTED] wrote:
I am curious as to iBatis batching also.I have a question.Fromwhat you stated below, I am inferring that when you start atransaction, all inserts/updates/deletes are batched and then sent oncommit?Here is my problem.I need to batch updates and inserts to
multiple tables.So I am doing something like this.daoManager.startTransactionfor loop {personDAO.insert}for loop{fooDAO.insert}daoManager.commitfinallydaoManager.endTransaction
So are all the inserts for personDAO and fooDAO batched at this pointautomatically?GreggOn 5/3/05, Simon Brunner [EMAIL PROTECTED] wrote:
 List, we just started a project from scratch and chose Spring/iBatis/Struts to build a mid-size J2EE web application. First I've to say that I'm very impressed on how fast you get productive by using iBatis. Everything went
 smooth until I wanted to do a batch insert. As we write JUnit testclasses for the entire app I used my iBatis DAOS without Spring's transaction demarcation (simply invoked the Dao by a test class). Under that
 environment iBatis executed my batch statements as single inserts until I read these lines in the mailing list archive:  Clinton Begin  Wed, 01 Dec 2004 12:00:53 -0800
  I'm currently using IBatis version 2.0.3. I'm not able to work upon with  Batch. I'm  doing the following :  sqlMap.startBatch();  Are you starting a the transaction too?So...
  startTransaction()  startBatch()  insert...  update...  executeBatch()  commitTransaction()  endTransaction Then I added transaction-support to my Spring Dao and it worked. Now I
 wonder why the execution of batch updates relys on the start and commit of a transaction? Thanks  best regards Simon
-- Brice RuthSoftware Engineer, Madison WI


Re: How to obtain results looking for a NULL

2005-04-29 Thread Brice Ruth
Does it work when you use straight JDBC, with the parameterClass that you're passing in being used to populate your prepared statement?On 4/29/05, 
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:







Hello;

I'm trying to get 
results from a table, but I can't search for a col = null or col = 
'value'.


This is my sqlmap 
statement.



statement id=getME parameterClass
=com.MEQuery resultClass=com.MEQuery

SELECTA,B FROM 
ME
dynamic prepend=WHERE

isNotEmpty prepend=AND property
=A A 
= #A#/isNotEmpty
isNotEmpty prepend=AND property
=BB= #B#/isNotEmpty

isNull prepend=AND property
=BB IS NULL 
/isNull 
/dynamic
/statement



Anybody can help 
me?
Thanks.


Eloy García-Borreguero 
Melero
CustomerWorks Europe S.L.



[EMAIL PROTECTED]


Tlf. 944 06 22 00 (Ext. 439)

Tlf. 944 04 17 32
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.


-- Brice RuthSoftware Engineer, Madison WI


Re: Help needed...

2005-04-21 Thread Brice Ruth
And it is important to use an editor that is writing the file in the
encoding that you
are putting at the top of the XML file. Most editors default to the
system encoding, which on Macs would be Mac Roman, and on Windows
would be Windows-1252 or maybe ISO-8859-1, depending on the editor.

Use good editors!

On 4/21/05, Philippe Laflamme [EMAIL PROTECTED] wrote:
 Daniel,
 
 To represent every character from every alphabet, Unicode requires
 multiple bytes to represent each character (I think 21 bits are
 required, but most implementations simply use 4 bytes, 32 bits).
 
 Since Unicode is cool you're probably interested in using it... On the
 other hand, you're probably not interested in encoding each of your
 characters using 4 bytes (quite an overkill for English for example).
 That's where UTF-8 (or UTF-16) comes in.
 
 UTF-8 is a way of encoding the whole Unicode character set using
 sequences of 8 bit wide characters (1 byte). In other words, it uses
 multiple (from 1 to 4) 1-byte wide characters instead of one multibyte
 (32 bits) character. UTF-16 is similar, but uses sequences of 16 bits
 wide characters.
 
 The advantage is that almost all western characters can be represented
 using one byte, just like to old days... Of course, because of special
 codes, the character set is not as large as ISO-8859-1 (for example), so
 certain latin characters we are used to require a specially crafted
 sequence of 2 (or more) bytes to represent.
 
 For example, the letter é (0xE9 for ISO-8859-1) is represented as Ã(c)
 (0xC3 0xA9 in UTF-8).
 
 The XML standard specifies that if the encoding of a file is not
 specified, it is UTF-8 by default. So, if I were to write é in an UTF-8
 file, it wouldn't be read as 0xE9, but as an invalid sequence...
 
 It's generaly good practice to set the ecoding of an XML file.
 
 Hope this helps,
 Philippe
 
 Daniel H. F. e Silva wrote:
  Hi Brice,
 
   I know that UTF-8 is supposed to cover all kind of alphabet characters 
  available in Earth. But, i
  had faced this issue sometimes ago, when a parser tried to parse a file 
  with encoding=utf-8 set
  and simply gave me an error message. After thinking about that issue, i 
  simply changed
  encoding=utf-8 to encoding=iso-8859-1 and that fixed my problem.
   So, if UTF-8 is really supposed to cover all kind of stuff, why did i get 
  that error? I'd love to
  hear your explanation.
 
  Cheers,
   Daniel Silva.
 
  --- Brice Ruth [EMAIL PROTECTED] wrote:
 
 What special characters aren't supported by UTF-8?! I have never heard
 of such a thing. My understanding is that UTF-8 represents the full
 Unicode character set as a multi-byte value. And since Unicode is
 supposed to encompass all known characters for all known languages
 (with space for new Chinese characters created daily) - what's not
 covered?!
 
 There most certainly shouldn't be anything that iso-8859-1 or latin1
 (Windows-1252) covers that is not in Unicode.
 
 Brice
 
 On 4/20/05, Daniel H. F. e Silva [EMAIL PROTECTED] wrote:
 
 You could check also your xml encoding. If you work with special charaters 
 not in utf-8, you
 
 will
 
 get in trouble.
 I had this as my native language is portuguese and we have some special 
 characters not
 
 supported
 
 by utf-8.
 So, if this is your case, try iso-8859-1 or one that fits better to your 
 needs.
 
 Cheers,
  Daniel Silva.
 
 
 --- Larry Meadors [EMAIL PROTECTED] wrote:
 
 Make sure that there is no white space and no odd chars at the top of your
 config file.
 
 Larry
 
 
 On 4/18/05, KK [EMAIL PROTECTED] wrote:
 
 I get the following error when I try to build sqlCOnfigmap..does it
 look familiar to someone?
 
 com.ibatis.sqlmap.client.SqlMapException: There was an error while
 building the SqlMap instance.
 --- The error occurred in the SQL Map Configuration file.
 --- Cause: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.
 Cause: java.io.UTFDataFormatException: Invalid byte 3 of 3-byte UTF-8
 sequence.
 Caused by: java.io.UTFDataFormatException: Invalid byte 3 of 3-byte
 UTF-8 sequence.
 Caused by: com.ibatis.sqlmap.client.SqlMapException: XML Parser Error.
 Cause: java.io.UTFDataFormatException: Invalid byte 3 of 3-byte UTF-8
 sequence.
 Caused by: java.io.UTFDataFormatException: Invalid byte 3 of 3-byte
 UTF-8 sequence.
 at 
 com.ibatis.sqlmap.engine.builder.xml.XmlSqlMapClientBuilder.buildSqlMap
 (XmlSqlMapClientBuilder.java:203)
 at com.ibatis.sqlmap.client.
 SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:49)
 
 Your help is greatly appreciated.
 
 Thanks,
 KK
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 
 
 
 --
 Brice Ruth
 Software Engineer, Madison WI
 
 
 
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com
 
 
 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: Access to the underlying connection

2005-04-19 Thread Brice Ruth
I'm not familiar at all with what you're trying to do, however - why
are you using 'SimpleDataSource' and expecting back a
'SimplePooledConnection'?!

Not sure if that might be causing problems for you ... 

On 4/19/05, Richard Osbaldeston [EMAIL PROTECTED] wrote:
 I've tried doing:
 
 Connection conn =
 com.ibatis.common.jdbc.SimpleDataSource.unwrapConnection(connection);
 oracle.sql.ArrayDescriptor desc =
 oracle.sql.ArrayDescriptor.createDescriptor(getSchemaPrefix(schema) +
 TY_STR_VARRAY, conn);
 oracle.sql.ARRAY array = new oracle.sql.ARRAY(desc, conn,
 relationshipTypes);
 
 But it still throws ClassCastExceptions as the connection object is a
 dynamic proxy and not an instance of  SimplePooledConnection. Should I
 just abandon IBatis altogether now? and go with raw jdbc.
 
 - Richard
 
 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: canceling statement?

2005-04-18 Thread Brice Ruth
iBATIS is thread-local. The cancel()methodrequires that a separate thread cancel a statement in an executing thread. I don't believe this would be supported in this type of framework.

Reference: http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#cancel()

BR
On 4/18/05, Michael Zurke [EMAIL PROTECTED] wrote:
is it somehow possible to cancel an executed query via SQLMaps?as far as i know PreparedStatement has a cancel() method for that puropse.
-- Brice RuthSoftware Engineer, Madison WI

Re: canceling statement?

2005-04-18 Thread Brice Ruth
I could see this being done in a DAO layer, perhaps ... I'm not sure that the SqlMap layer is necessarily the right place for it. What do you think?
On 4/18/05, Michael Zurke [EMAIL PROTECTED] wrote:
i think it would make sense if ibatis would support something likemultiple query processing (e.g. a query executed in parallel on
different database clusters. then the abstraction layer should combinethe results. in that case it would be handy to specify a timeout to getresults back from the most responsive clusters only (- cancel). but
this is theoretical since ibatis doesn't support such functionality(right?). but still - if there would be something like SQLMap.cancel()one could implement the parallel querying quite easy, i guess.mish
Brandon Goodin wrote: It is not a funciton that is available. But, i'm not sure why it wouldn't be available. iBatis uses straight JDBC underneath. It could provide some functionlaity to cancel. But, i'm not sure how we would
 provide the criteria for a cancel. Please expound on why you would cancel. Brandon On 4/18/05, Brice Ruth [EMAIL PROTECTED]
 wrote:iBATIS is thread-local. The cancel() method requires that a separate threadcancel a statement in an executing thread. I don't believe this would besupported in this type of framework.
Reference:http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#cancel()
BROn 4/18/05, Michael Zurke [EMAIL PROTECTED] wrote:is it somehow possible to cancel an executed query via SQLMaps?
as far as i know PreparedStatement has a cancel() method for that puropse.--Brice RuthSoftware Engineer, Madison WI
-- Brice RuthSoftware Engineer, Madison WI

Re: querying multiple databases simultaneously

2005-04-18 Thread Brice Ruth
I think he means more along the lines of querying multiple systems with the same query, and having iBATIS merge the results or return results from the faster system and discard and/or cancel the query for the other system(s).

On 4/18/05, Larry Meadors [EMAIL PROTECTED] wrote:
Do you mean like this:select * from someSqlServerTablejoin someDb2Table on blah = blah
Larry 

On 4/18/05, Michael Zurke [EMAIL PROTECTED]
 wrote: 
hi,i wonder if ibatis supports something like querying multiple databasessimultanously (i don't mean global transactions but global selects,
i.e.). i checked the documentation and couldn't find anything so i guess i have to write some threaded query functionality by myself. i justwanted to crosscheck with you guys. or maybe someone knows if there is
some lib i can use together with ibatis which does the job.thanx, mish-- Brice RuthSoftware Engineer, Madison WI

Re: canceling statement?

2005-04-18 Thread Brice Ruth
The cancel() method in JDBC depends on driver support. So, I imagine that every RDBMS has its own way of internally cancelling a running statement, if its even an option.
On 4/18/05, Sasha Borodin [EMAIL PROTECTED] wrote:
Is there an sql command you can issue to cancel an already running sqlstatement?Is there an abstract way to identify a statement running in a db
system, which could be gotten through iBatis?-Sasha From: Michael Zurke [EMAIL PROTECTED] Reply-To: 
ibatis-user-java@incubator.apache.org Date: Mon, 18 Apr 2005 15:57:39 +0100 To: ibatis-user-java@incubator.apache.org Subject: Re: canceling statement?
 yes - i think your're right when it comes to the multiple query/combine result issue - using DAO in this case would definitely make more sense. but in case DAO doesn't fit my model i still want to be able to built my
 own 'multilpe query executor' so i would be nice if i could cancel statments on the SQLMap layer. but maybe the problem is too specific to support it on a generic framework level. anyway ;)
 Brice Ruth wrote: I could see this being done in a DAO layer, perhaps ... I'm not sure that the SqlMap layer is necessarily the right place for it. What do you think?
 On 4/18/05, *Michael Zurke* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: i think it would make sense if ibatis would support something like
 multiple query processing (e.g. a query executed in parallel on different database clusters. then the abstraction layer should combine the results. in that case it would be handy to specify a timeout to get
 results back from the most responsive clusters only (- cancel). but this is theoretical since ibatis doesn't support such functionality (right?). but still - if there would be something like 
SQLMap.cancel() one could implement the parallel querying quite easy, i guess. mish Brandon Goodin wrote: It is not a funciton that is available. But, i'm not sure why it
 wouldn't be available. iBatis uses straight JDBC underneath. It could provide some functionlaity to cancel. But, i'm not sure how we would provide the criteria for a cancel. Please expound on why you would
 cancel. Brandon On 4/18/05, Brice Ruth [EMAIL PROTECTED] mailto:
[EMAIL PROTECTED] wrote: iBATIS is thread-local. The cancel() method requires that a separate thread cancel a statement in an executing thread. I don't believe this
 would be supported in this type of framework. Reference: 
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#cancel() BR On 4/18/05, Michael Zurke 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: is it somehow possible to cancel an executed query via SQLMaps?
 as far as i know PreparedStatement has a cancel() method for that puropse. --
 Brice Ruth Software Engineer, Madison WI -- Brice Ruth Software Engineer, Madison WI
-- Brice RuthSoftware Engineer, Madison WI

Re: reuse resultMap from different sqlmaps

2005-04-18 Thread Brice Ruth
I believe this should work, not sure on the exact syntax, but it sounds like you have it right. Maybe open a JIRA report?

BR
On 4/18/05, Nathan Maves [EMAIL PROTECTED] wrote:
is this possible?We are trying to access them viaNamespace.resultMapName but this does not seem to work.
Nathan-- Brice RuthSoftware Engineer, Madison WI

Re: iBatis configurations for performance

2005-04-15 Thread Brice Ruth
Besides what Larry suggested, are you running into a 1:M M:N type of situation that the groupBy could help with? Doing one larger join v. many different cascaded statements?

Just a thought ... 

BR
On 4/15/05, Ross, Hugh [EMAIL PROTECTED] wrote:
Hi,I am running a performance test on an application using iBatis. I am testing with 300 users.Some of our business object methods may hit database up to 50 times in one transaction. Performance is currently very poor. Any ideas what I should have my SQLMap settings to for optimum performance?
My current settings are:settings cacheModelsEnabled=true enhancementEnabled=true maxSessions=250 maxTransactions=25
 maxRequests=512 useStatementNamespaces=true/Many thanks,Hugh*Department of Agriculture and Food ***
The information contained in this email and in anyattachments is confidential and is designated solelyfor the attention and use of the intended recipient(s).This information may be subject to legal and professional
privilege.If you are not an intended recipient ofthis email, you must not use, disclose, copy,distribute or retain this message or any part of it.If you have received this email in error, pleasenotify the sender immediately and delete all copies of
this email from your computer system(s).**-- Brice RuthSoftware Engineer, Madison WI

Re: Is there a way to remove the quotation marks that ibatis inserts when using #[]# on the iterate tag?

2005-04-15 Thread Brice Ruth
use $ in place of the #, that way it won't be quoted.

On 4/15/05, Abeyratne, Sam [EMAIL PROTECTED] wrote:
  
  
 
 I want to use the iterate tag to create an sql statement. 
 
   
 
 If I have something like [EMAIL PROTECTED] and the first value in the list for
 example is database1, it really translates to table_name@'database1'. This
 fails because of the single quotes. Is there a way to remove these single
 quotes? Meaning, translate [EMAIL PROTECTED] to [EMAIL PROTECTED] 
 
   
 
 Any assiatnce would be much appreciated! 
 
 Thanks! 
 
 Sam 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: R: Please Help in arguing for iBatis SqlMaps

2005-04-08 Thread Brice Ruth
Remember, you're looking for best-of-breed and best-practice for right
here, right now. Nobody has a crystal ball, nobody knows what tomorrow
holds. However, if you roll-your-own, every knowledgeable Java
developer and architect out there will tell you that its a waste in
almost every scenario. Code re-use and component architectures allow
for fast time-to-delivery. Roll your own, and you have that much more
QA to do.

BR

On Apr 8, 2005 9:27 AM, Fabrizio Gianneschi
[EMAIL PROTECTED] wrote:
 Kaushik Ashodiya wrote:
 
 Please give me more reasons so that I can convince them.
 
 Their argument:
 1. For small project SqlMap is adding unnecessary complexity.
 
 I evaluated iBATIS expecially on small-medium projects.
 It reduces the ordinary-JDBC Java code by ~62%
 http://www.jugsardegna.org/vqwiki/jsp/Wiki?IBatisCaseStudy
 Most of the DAO methods are now 1 line long. (I wasn't able to reduce them
 more, sorry :))
 
 Can your homemade framework do the same?
 
 2. Why learn one more tool when you have a simple base data access
 object that gives you connection, prepared statement
 and a result and does cleanup? (only when extended class calls cleanup()
 !!!)
 
 I don't want to think about cleanup or opened connections left.
 I don't want to repeat the
 try-getConnection-prepare-set-execute-while-new-set-add-finally-close-close
 -close prayer anymore.
 
 3. Generally open source projects dies shortly and does not have support.
 
 Even if iBATIS would die tomorrow, its actual codebase is better than every
 other framework I could develop within months (or years).
 
 4. Adding many jars of those open source projects make out project more
 complex and un-maintainable.
 
 That's why Ant, Maven and other build systems exists. Ya-ha-wn.
 
 Every (few) jar included in iBATIS is far more maintanable than an homemade
 framework, on which you've to spend your valuable time.
 
 5. What if SqlMaps goes out of market? It is fairly new and not hardened.
 
 Try it. I don't reply to your peers arguments... other people responded very
 well here.
 
 Fabrizio
 
 


-- 
Brice Ruth
Software Engineer, Madison WI


Re: How do I use the dollar sign notation (i.e. $xyz$) to send a string to the database that has a pound sign on either side of it?

2005-04-07 Thread Brice Ruth
Note - the $xyz$ notation does not create a '?' for a prepared statement ... it's value (as indicated by Brandon) is placed into the SQL string before the prepared statement is generated.
On Apr 6, 2005 4:25 PM, Ron Grabowski [EMAIL PROTECTED] wrote:
How do I use the dollar sign notation (i.e. $xyz$) to send a string tothe database that has a pound sign on either side of it?According to this post:http://tinyurl.com/44je6http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01358.htmlI should use a double pound to send the literal pound. Given this sqlstatement:select parameterClass=map resultClass=stringSELECT Name FROM Band WHERE Name = '12##34$BandName$56##78'/selectWhich of the two choices below should I see in my log files?A) SELECT Name FROM Band WHERE Name = '12?78'B) SELECT Name FROM Band WHERE Name = '12#34?56#78'Thanks,Ron-- Brice RuthSoftware Engineer, Madison WI

Re: ibatis technology need company references.

2005-04-07 Thread Brice Ruth
Vic, can you use an email client that actually puts Vic as your name?! Would you like a Gmail account?!

Love your contributions, but always frustrated that I can't tell who's posting until I see .V ... :)
On Apr 6, 2005 9:26 PM, NetSQL [EMAIL PROTECTED] wrote:
1up.com is using iBatis 2 and has 10 million members and 10,000concurent users.My new project is larger..VVictor Stepanov wrote: Brandon Goodin wrote: I can vouch that we use iBatis internally at Plum Creek Timber Company, Inc. But, i can't give you links or anything. Brandon On Apr 6, 2005 9:55 AM, Victor Stepanov [EMAIL PROTECTED] wrote: Hi All. I need to provide references about ibatis and sqlmaps that this product is stable can anybody give some references or where I can found it. Thanks. I can describe sitution we write one tender where describe that we use IBatis but we've got claim that IBatis in Apche Incubator and not stable for goverment sector development . For me will be good get some links or may be some documents -- Brice RuthSoftware Engineer, Madison WI

Re: building a hierarchy

2005-04-06 Thread Brice Ruth
Check the Wiki for the 1:N and M:N N+1 selects stuff ... I think that's what you're looking for.
On Apr 6, 2005 11:16 AM, Steven Pannell [EMAIL PROTECTED] wrote:
Hi,Does anyone know how I could (if possible) build a hierarchy of objectsusing a single SQL statement.Is this possible?For example I have a SQL table of BOXES.A BOX can contain other BOXES andso on, like:class BOX { public void id(); public void parentBoxId(); public BOX getChild();}my sql would be something like:select * from boxes b1, boxes b2where b1.id = b2.parentBoxId;result is a big list of boxes but I want the parent / child hierarchy.anyway to do this?know what I mean?thx.Steve.-- Brice RuthSoftware Engineer, Madison WI

Re: ibatis technology need company references.

2005-04-06 Thread Brice Ruth
Check the Wiki, if you need more than that, let me know ... we use iBATIS exclusively in our projects (we are, however, not a government body).

Brandon's point was simply that being in Apache's incubator does not mean anything about the projects status as a whole, it is simply an Apache thing (internal politics and processes, really).
Brice Ruth
On Apr 6, 2005 11:28 AM, Victor Stepanov [EMAIL PROTECTED] wrote:
Yes I know that IBatis is stable and so one but in this friday we will have big meeting and must provide some references about this .We also use ibatis but for goverment sector we must provide some document becouse we have official claim.And for me will be good to have some documents. 
Brice Ruth wrote: 
I absolutely concur with Brandon. We have been using iBATIS from the sourceforge.net days, and it is absolutely rock-solid stable.
On Apr 6, 2005 11:14 AM, Brandon Goodin [EMAIL PROTECTED] wrote: 
Incubator has nothing to do with stability! We have been runningibatis from sourceforge for over 2 years now. Incubator is simply anacceptance process into the apache group. We are slated to graduatefrom the incubator process. We would already have been, but, themeeting that makes that decision was rescheduled. Please don't confuseincubator with beta. iBatis is plenty stable. It is not in beta orpre-release mode. It is a stable version.you can visit http://www.ibatis.com and see that we are a mature project.BrandonOn Apr 6, 2005 10:13 AM, Victor Stepanov [EMAIL PROTECTED] wrote: Brandon Goodin wrote: I can vouch that we use iBatis internally at Plum Creek Timber Company, Inc. But, i can't give you links or anything.  Brandon  On Apr 6, 2005 9:55 AM, Victor Stepanov [EMAIL PROTECTED] wrote:   Hi All. I need to provide references about ibatis and sqlmaps that this product is stable can anybody give some references or where I can found it. Thanks.I can describe sitution we write one tender where describe that we use IBatis but we've got claim that IBatis in Apche Incubator and not stable for goverment sector development . For me will be good get some links or may be some documents -- Brice RuthSoftware Engineer, Madison WI -- Brice RuthSoftware Engineer, Madison WI

Re: OT: Tomcat debugging with Eclipse (Was Re: JDBCRealm using iBATIS?)

2005-04-05 Thread Brice Ruth
Yeah, one nice thing I've found come in handy w/ MyEclipse is the ability to set breakpoints directly in JSP files ... and then have the IDE map that into the compiled JSP files, behind-the-scenes.

MyEclipse isn't everything and the kitchen sink, but it gets the job done well ... at a price that's reasonable ($29.95/yr).
On Apr 4, 2005 10:48 PM, Brandon Goodin [EMAIL PROTECTED] wrote:
My Eclipse rocks!!! But, if you have Intellij I can't imagine thatthey wouldn't have that ability.BrandonOn Apr 4, 2005 9:47 PM, Brice Ruth [EMAIL PROTECTED] wrote: Ah, I guess my Lomboz experience is lacking. I assumed it would be much like MyEclipse, which launches Tomcat (or any other app server) into debug mode automatically. On Apr 4, 2005 10:26 AM, Philippe Laflamme [EMAIL PROTECTED] wrote:   Brice Ruth wrote:   Use Eclipse ... then you can use the Lomboz plug-in or the MyEclipse   plug-in (nominal fee) and you should be golden.   Use Eclipse yes, but Lomboz plug-in, no.   The last time I used it, it was such a pain to install, setup and  maintain, that I simply gave up. Besides, it doesn't do anything that  can't be done with a plain Eclipse setup (for debugging purposes)...   What you need to do is start your Tomcat VM with JPDA enabled (Java  Platform Debugger Architecture). This is already available in the  Catalina startup scripts: jpda start instead of start. I've created a  modified version of the startup.bat script that I call debug.bat. It  sets the port and type of JPDA to enable and calls catalia.bat with  debugging enabled. I've attached a patch so you can see what I've  modified...   In your Eclipse project, you setup a Remote Java Application debug  target. Make it point to your Tomcat server and the JPDA port (8000 in  my case). This is a major advantage over Lomboz: it allows you to debug  a Tomcat instance that isn't running on localhost.   To start a debug session, start Tomcat with the proper script, start  your debugging target in Eclipse, set a few breakpoints (in Tomcat  source, iBatis source, your code, etc.) and voilà, you're ready to try  to login... If you need to debug Tomcat's startup procedure, you can  always suspend the VM before Tomcat's main method is called: look at the  catalina script for the suspend=n flag and set it to suspend=y.   If you're not familiar with Eclipse, you'll to read on how to attach  source code to runtime jars in a debugging target... Otherwise, you  won't be able to debug as efficiently as you'll want.   Hope this helps,  PhilippeOn Apr 2, 2005 10:53 AM, *Sasha Borodin* [EMAIL PROTECTED]   mailto:[EMAIL PROTECTED] wrote: I'm trying to get iBatis classes to initialize in a modified   JDBCRealm... Right now I'm having issues.There's a   ClassCastException thrown on Tomcat startup (when the realm classes   are initialized).I've placed all 3 iBatis jars, and various   combinations of supporting jars in server/lib, so far with no luck.  Brandon mentioned debugging the tomcat startup in an IDE; I'm   trying to figure out how to do that right now. I'll post and let you know my results.In the mean time, try it ;-)  I am trying to use a data source of type DBCP in my   sql-map-config.xml; it's the instantiation of this class that throws   errors right now.Maybe try using another data source and let us   know how it works. Thanks, -Sasha Borodin      *From: *Larry Meadors [EMAIL PROTECTED]   mailto:[EMAIL PROTECTED]   *Reply-To: *ibatis-user-java@incubator.apache.org   mailto:ibatis-user-java@incubator.apache.org   *Date: *Sat, 2 Apr 2005 06:35:53 -0700   *To: *ibatis-user-java@incubator.apache.org   mailto:ibatis-user-java@incubator.apache.org, Tim Christopher   [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]   *Subject: *Re: JDBCRealm using iBATIS? Sasha Borodin(maybe?) mentioned working on an iBATIS realm for   tomcat on the tomcat-users list. You may want to check that out. Larry On Mar 17, 2005 8:37 AM, *Tim Christopher*   [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, Can anyone let me know if it is possible to use iBATIS for   implementing JDBCRealm, or do I have to access the database   directly? I've looked on Google and in the Developer Notes for iBATIS and have   found nothing on this topic. Any help would be much appreciated. Tim Christopher --   Brice Ruth   Software Engineer, Madison WI--- startup.bat 2004-10-05 13:27:48.0 -0400  +++ debug.bat 2004-12-08 13:46:03.606902000 -0500  @@ -39,6 +39,9 @@  goto setArgs  :doneSetArgs   -call %EXECUTABLE% start %CMD_LINE_ARGS%  +set JPDA_ADDRESS=8000  +set JPDA_TRANSPORT=dt_socket  +  +call %EXECUTABLE% jpda start %CMD_LINE_ARGS%   :end-- Brice Ruth Software Engineer, Madison WI-- Brice RuthSoftware Engineer, Madison WI

Re: OT: Tomcat debugging with Eclipse (Was Re: JDBCRealm using iBATIS?)

2005-04-04 Thread Brice Ruth
Ah, I guess my Lomboz experience is lacking. I assumed it would be much like MyEclipse, which launches Tomcat (or any other app server) into debug mode automatically.
On Apr 4, 2005 10:26 AM, Philippe Laflamme [EMAIL PROTECTED] wrote:
Brice Ruth wrote: Use Eclipse ... then you can use the Lomboz plug-in or the MyEclipse plug-in (nominal fee) and you should be golden.Use Eclipse yes, but Lomboz plug-in, no.The last time I used it, it was such a pain to install, setup andmaintain, that I simply gave up. Besides, it doesn't do anything thatcan't be done with a plain Eclipse setup (for debugging purposes)...What you need to do is start your Tomcat VM with JPDA enabled (JavaPlatform Debugger Architecture). This is already available in theCatalina startup scripts: jpda start instead of start. I've created amodified version of the startup.bat script that I call debug.bat. Itsets the port and type of JPDA to enable and calls catalia.bat withdebugging enabled. I've attached a patch so you can see what I'vemodified...In your Eclipse project, you setup a Remote Java Application debugtarget. Make it point to your Tomcat server and the JPDA port (8000 inmy case). This is a major advantage over Lomboz: it allows you to debuga Tomcat instance that isn't running on localhost.To start a debug session, start Tomcat with the proper script, startyour debugging target in Eclipse, set a few breakpoints (in Tomcatsource, iBatis source, your code, etc.) and voilà, you're ready to tryto login... If you need to debug Tomcat's startup procedure, you canalways suspend the VM before Tomcat's main method is called: look at thecatalina script for the suspend=n flag and set it to suspend=y.If you're not familiar with Eclipse, you'll to read on how to attachsource code to runtime jars in a debugging target... Otherwise, youwon't be able to debug as efficiently as you'll want.Hope this helps,Philippe On Apr 2, 2005 10:53 AM, *Sasha Borodin* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: I'm trying to get iBatis classes to initialize in a modified JDBCRealm... Right now I'm having issues.There's a ClassCastException thrown on Tomcat startup (when the realm classes are initialized).I've placed all 3 iBatis jars, and various combinations of supporting jars in server/lib, so far with no luck.Brandon mentioned debugging the tomcat startup in an IDE; I'm trying to figure out how to do that right now. I'll post and let you know my results.In the mean time, try it ;-)I am trying to use a data source of type DBCP in my sql-map-config.xml; it's the instantiation of this class that throws errors right now.Maybe try using another data source and let us know how it works. Thanks, -Sasha Borodin  *From: *Larry Meadors [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Reply-To: *ibatis-user-java@incubator.apache.org mailto:ibatis-user-java@incubator.apache.org *Date: *Sat, 2 Apr 2005 06:35:53 -0700 *To: *ibatis-user-java@incubator.apache.org mailto:ibatis-user-java@incubator.apache.org, Tim Christopher [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] *Subject: *Re: JDBCRealm using iBATIS? Sasha Borodin(maybe?) mentioned working on an iBATIS realm for tomcat on the tomcat-users list. You may want to check that out. Larry On Mar 17, 2005 8:37 AM, *Tim Christopher* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi, Can anyone let me know if it is possible to use iBATIS for implementing JDBCRealm, or do I have to access the database directly? I've looked on Google and in the Developer Notes for iBATIS and have found nothing on this topic. Any help would be much appreciated. Tim Christopher -- Brice Ruth Software Engineer, Madison WI--- startup.bat 2004-10-05 13:27:48.0 -0400+++ debug.bat 2004-12-08 13:46:03.606902000 -0500@@ -39,6 +39,9 @@goto setArgs:doneSetArgs-call %EXECUTABLE% start %CMD_LINE_ARGS%+set JPDA_ADDRESS=8000+set JPDA_TRANSPORT=dt_socket++call %EXECUTABLE% jpda start %CMD_LINE_ARGS%:end-- Brice RuthSoftware Engineer, Madison WI

Re: JDBCRealm using iBATIS?

2005-04-03 Thread Brice Ruth
Use Eclipse ... then you can use the Lomboz plug-in or the MyEclipse plug-in (nominal fee) and you should be golden.On Apr 2, 2005 10:53 AM, Sasha Borodin [EMAIL PROTECTED] wrote:




I'm
trying to get iBatis classes to initialize in a modified JDBCRealm...
Right now I'm having issues. There's a ClassCastException thrown
on Tomcat startup (when the realm classes are initialized). I've
placed all 3 iBatis jars, and various combinations of supporting jars
in server/lib, so far with no luck. Brandon mentioned debugging
the tomcat startup in an IDE; I'm trying to figure out how to do that
right now.

I'll post and let you know my results. In the mean time, try it
;-) I am trying to use a data source of type "DBCP" in my
sql-map-config.xml; it's the instantiation of this class that throws
errors right now. Maybe try using another data source and let us
know how it works.

Thanks,

-Sasha Borodin


From: Larry Meadors [EMAIL PROTECTED]
Reply-To: ibatis-user-java@incubator.apache.org
Date: Sat, 2 Apr 2005 06:35:53 -0700
To: ibatis-user-java@incubator.apache.org, Tim Christopher [EMAIL PROTECTED]
Subject: Re: JDBCRealm using iBATIS?

Sasha Borodin(maybe?) mentioned working on an iBATIS realm for tomcat on the tomcat-users list. You may want to check that out.

Larry

On Mar 17, 2005 8:37 AM, Tim Christopher [EMAIL PROTECTED] wrote:
Hi,

Can anyone let me know if it is possible to use iBATIS for
implementing JDBCRealm, or do I have to access the database directly?

I've looked on Google and in the Developer Notes for iBATIS and have
found nothing on this topic.

Any help would be much appreciated.

Tim Christopher







-- Brice RuthSoftware Engineer, Madison WI

Re: Dynamic statements

2005-03-22 Thread Brice Ruth
Well, in theory, you could handle the parameters in your DAO (or in
your biz logic, if you're not using a DAO). Pull out the SQL from the
database using iBATIS, then do your own replacement logic, then pass
that back to iBATIS. Its ugly, but what you're asking for isn't
exactly pretty, either :)

Brice


On Mon, 21 Mar 2005 16:45:33 -0800, Eric Williams [EMAIL PROTECTED] wrote:
 Ah, I see. Yes, I was hoping I could get the parameters parsed as well. I'll
 just tell them it'll have to be static, or we'll have to write some JDBC
 code.
 
 Thanks for your help!
 
 -Eric
 
 -Original Message-
 From: Brice Ruth [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 21, 2005 12:43 PM
 To: ibatis-user-java@incubator.apache.org
 Subject: Re: Dynamic statements
 
 Lemme qualify that ... does your SQL from the database, by your
 power-users, have parameters and such specified? I don't think that
 will work, if so ... if its static, tho - that should work.
 
 On Mon, 21 Mar 2005 14:41:46 -0600, Brice Ruth [EMAIL PROTECTED] wrote:
  I would think so ... if you have a query that returns a String ... or
  you assemble your SQL somehow ... then use $paramName$ in your dynamic
  query, and have remapResults=true ... you should be golden.
 
  I can't think of any reason you wouldn't be.
 
 
  On Mon, 21 Mar 2005 11:11:38 -0800, Eric Williams [EMAIL PROTECTED]
 wrote:
   This might be a bonehead question, but with all the cool new features in
   iBATIS, particularly those involving dynamic SQL, is it possible to make
 the
   *entire* statement body dynamic? My paramaterClass and resultClass will
   always be the same, but I'd like to pull the actual SQL, which has been
   written by my power users, from the database (via another statement, of
   course). Can this be done?
  
   Regards,
   Eric
  
 



Re: execute SQL statement that are not in a map

2005-03-22 Thread Brice Ruth
Oh, and you'll probably need to specify a resultClass (or resultMap,
if you have one setup). Specifying remapResults=true won't hurt,
either (especially with a resultMap specification).


On Tue, 22 Mar 2005 11:29:39 -0600, Brice Ruth [EMAIL PROTECTED] wrote:
 you'll probably need to reference the string as $value$, unless you're
 using a syntax I'm not familiar with.
 
 
 On Tue, 22 Mar 2005 16:00:05 -, James, Steven
 [EMAIL PROTECTED] wrote:
  create a generic statement in a sqlmap
  statement id=Execute parameterClass=string
   #string
  /statement
 
 
  -Original Message-
  From: Steven Pannell [mailto:[EMAIL PROTECTED]
  Sent: Tue 3/22/2005 3:16 PM
  To: 'ibatis-user-java@incubator.apache.org'
  Subject: execute SQL statement that are not in a map
 
  Hi,
 
  I build some SQL statements in java and want to execute them on the DB.  As
  I don't have a iBatis-map for these (they are build dynamically) what is the
  best way to execute the statements on the db. the SqlMapClient does not have
  any kind of execute method. The only thing I came up with at the moment was:
 
  client.getDataSource().getConnection().prepareStatement(mysql).executeQuery(
  )
 
  Bit nasty...
 
  Any ideas?
 
  Thanks,
  Steve.
 
  This e-mail and any attachment is for authorised use by the intended 
  recipient(s) only. It may contain proprietary material, confidential 
  information and/or be subject to legal privilege. It should not be copied, 
  disclosed to, retained or used by, any other party. If you are not an 
  intended recipient then please promptly delete this e-mail and any 
  attachment and all copies and inform the sender. Thank you.
 



Re: PaginatedList 'google like' results

2005-03-18 Thread Brice Ruth
The product catalogs on www.powersentry.com, www.newpoint.com,
www.zincklysbro.dk, and www.wilkinsonswordgarden.com all use
PaginatedList to provide the Page [1] 2 3 4 ... functionality.

I have a simple Action that looks like this:

public ActionForward gotoPage(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) 
{
DynaActionForm myForm = (DynaActionForm) form;
// Get PRODUCT_INFO_KEY object from session
PaginatedList products = (PaginatedList)
request.getSession().getAttribute(Constants.PRODUCT_LIST_KEY);

if (products != null) {
try {
String page = (String) myForm.get(page);
if (page.equalsIgnoreCase(next)) {
products.nextPage();
} else if (page.equalsIgnoreCase(previous)) {
products.previousPage();
} else {
int pageNum = new 
Integer(page).intValue();

products.gotoPage(pageNum);
}


request.setAttribute(Constants.PRODUCT_LIST_CURRENT_PAGE,new
Integer(products.getPageIndex()));

return 
mapping.findForward(success.showCategory);

} catch (NumberFormatException e) {
return mapping.findForward(browse);
} catch (RuntimeException e) {
return mapping.findForward(browse);
}
} else {
return mapping.findForward(browse);
}
}

To make this work, when I do the initial query to populate the
PaginatedList, I do as you indicated - one query for the objects, one
query for the count. To hide this double-step, you could put that in
your DAO, if you're using one (I am not).

Brice


On Fri, 18 Mar 2005 12:12:31 +0100, Guido García Bernardo [EMAIL PROTECTED] 
wrote:
 Hi,
 
 I am using ibatis PaginatedList functionality for paging through search 
 results,
 and I would like to add the ability for a user to go to the last page of the 
 results
 (something like Google results) instead of having to page through big result 
 sets as
 it is done in JPetStore4:
 
   logic:notEqual name=orderBean property=orderList.firstPage 
 value=true 
 a href=switchOrderPage.shtml?pageDirection=previousPREV/a
   /logic:notEqual
   logic:notEqual name=orderBean property=orderList.lastPage value=true 
 
 a href=switchOrderPage.shtml?pageDirection=nextNEXT/a
   /logic:notEqual
 
 Is this possible or should I do two queries (my actual select fields from...
 and a new select count(*) from...) to achieve it?
 
 Thank you very much,
 Guido.
 
 --
 Guido García Bernardo - [EMAIL PROTECTED]
 Tfn. +34 983 54 89 08
 ITDEUSTO - Valladolid
 



Re: RES: PaginatedList 'google like' results

2005-03-18 Thread Brice Ruth
Absolutely true ... of course, as I mentioned, I could put this in a
DAO and get around that problem. I just opted not to use a DAO this
time, mostly for expediency's sake (as usual).

Brice


On Fri, 18 Mar 2005 11:32:58 -0300, Leonardo Holanda
[EMAIL PROTECTED] wrote:
 That's nice. The problem in my case is that the Architects in my company
 does not allow us to put database layer especific code into the web
 layer code. But, if it's not a problem, thats nice. But remember, if one
 day you decide to chance iBatis for another framework, you will have to
 touch the web code (the action in your example).
 
 -Mensagem original-
 De: Brice Ruth [mailto:[EMAIL PROTECTED]
 Enviada em: sexta-feira, 18 de março de 2005 11:25
 Para: ibatis-user-java@incubator.apache.org
 Assunto: Re: PaginatedList  'google like' results
 
 The product catalogs on www.powersentry.com, www.newpoint.com,
 www.zincklysbro.dk, and www.wilkinsonswordgarden.com all use
 PaginatedList to provide the Page [1] 2 3 4 ... functionality.
 
 I have a simple Action that looks like this:
 
 public ActionForward gotoPage(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response)
 {
 DynaActionForm myForm = (DynaActionForm) form;
 // Get PRODUCT_INFO_KEY object from session
 PaginatedList products = (PaginatedList)
 request.getSession().getAttribute(Constants.PRODUCT_LIST_KEY);
 
 if (products != null) {
 try {
 String page = (String)
 myForm.get(page);
 if (page.equalsIgnoreCase(next)) {
 products.nextPage();
 } else if
 (page.equalsIgnoreCase(previous)) {
 products.previousPage();
 } else {
 int pageNum = new
 Integer(page).intValue();
 
 products.gotoPage(pageNum);
 }
 
 request.setAttribute(Constants.PRODUCT_LIST_CURRENT_PAGE,new
 Integer(products.getPageIndex()));
 
 return
 mapping.findForward(success.showCategory);
 
 } catch (NumberFormatException e) {
 return mapping.findForward(browse);
 } catch (RuntimeException e) {
 return mapping.findForward(browse);
 }
 } else {
 return mapping.findForward(browse);
 }
 }
 
 To make this work, when I do the initial query to populate the
 PaginatedList, I do as you indicated - one query for the objects, one
 query for the count. To hide this double-step, you could put that in
 your DAO, if you're using one (I am not).
 
 Brice
 
 On Fri, 18 Mar 2005 12:12:31 +0100, Guido García Bernardo
 [EMAIL PROTECTED] wrote:
  Hi,
 
  I am using ibatis PaginatedList functionality for paging through
  search results, and I would like to add the ability for a user to go
  to the last page of the results (something like Google results)
  instead of having to page through big result sets as it is done in
  JPetStore4:
 
logic:notEqual name=orderBean property=orderList.firstPage
 value=true 
  a href=switchOrderPage.shtml?pageDirection=previousPREV/a
/logic:notEqual
logic:notEqual name=orderBean property=orderList.lastPage
 value=true 
  a href=switchOrderPage.shtml?pageDirection=nextNEXT/a
/logic:notEqual
 
  Is this possible or should I do two queries (my actual select fields
  from... and a new select count(*) from...) to achieve it?
 
  Thank you very much,
  Guido.
 
  --
  Guido García Bernardo - [EMAIL PROTECTED]
  Tfn. +34 983 54 89 08
  ITDEUSTO - Valladolid
 
 
 



Re: Corrupt zip file?

2005-03-18 Thread Brice Ruth
It appears so, however, you can be absolutely certain - try using
Winzip to open the file, or better yet, use the 'jar' command like so
...

jar -tf jar file

If that reports an error, you have a bum JAR file. Try a different
SF.net mirror. I've had issues w/ them recently.

Best,
Brice Ruth


On Fri, 18 Mar 2005 09:16:18 -0600, Engel, Gregory A
[EMAIL PROTECTED] wrote:
  
 I just downloaded the latest release from source forge. (Had been using
 earlier release) 
 and I am getting this message when trying to compile against the latest jar
 files.. 
   
 SqlMapPersonDaoFactory.java: Error #: 302 : cannot access class
 SqlMapClient; java.io.IOException: zip file is corrupted at line 25, column
 18
 SqlMapPersonDaoFactory.java: Error #: 307 : class
 com.ibatis.sqlmap.client.SqlMapClient is not public in package
 com.ibatis.sqlmap.client; cannot be accessed from outside package at line
 29, column 10 
   
 I've downloaded from 2 different mirrors just to be sure and I keep getting
 this message... 
 
 Cheers 
 Greg 
 



Re: JDBCRealm using iBATIS?

2005-03-17 Thread Brice Ruth
Just a thought, use JNDI ... you setup your DataSource once, use it in
your Realm and in iBATIS. That's what we do ...

BR


On Thu, 17 Mar 2005 15:37:03 +, Tim Christopher
[EMAIL PROTECTED] wrote:
 Hi,
 
 Can anyone let me know if it is possible to use iBATIS for
 implementing JDBCRealm, or do I have to access the database directly?
 
 I've looked on Google and in the Developer Notes for iBATIS and have
 found nothing on this topic.
 
 Any help would be much appreciated.
 
 Tim Christopher



Re: UI for iBatis

2005-03-16 Thread Brice Ruth
Well, this is probably obvious, but we use Eclipse heavily here ...
and if the Eclipse plug-in was backwards-compatible with WSAD, I think
you'd immediately enjoy a decent sized userbase.


On Fri, 11 Mar 2005 12:48:53 -0500, J Aaron Farr [EMAIL PROTECTED] wrote:
 Brandon Goodin wrote:
  we have had some discussion about a visual mapping tool for ibatis. As
  of yet, noone on the team has taken it on. There is a tool written for
  the jasmine ide. I haven't used it, so, i don't know the depth of
  capability.
 
  http://wiki.apache.org/ibatis/3rd_20Party_20Contributions
 
 Would an Eclipse Plugin help?
 
 I'm starting to do more Eclipse development at work and I'm hoping to do
 some plugins for some of the ASF groups.  I was thinking about doing one
 for Excalibur first but an iBatis plugin would probably be easier for me
 to start with.  Minimally we could create a specialized editor for
 sqlmap files.  After that we could look at a binding or code generation
 tool.
 
 I've got other commitments with Excalibur first, but I hope to start on
 these plugins in May or so.
 
 Do many iBatis users/developers use Eclipse?
 
 jaaron



Re: Oracle + iBATIS - performance slows to a crawl over time

2005-03-16 Thread Brice Ruth
If its the same application, with the only difference being your JDBC
driver, I would be highly suspicious of that driver, first. Assuming
that your DataSource configuration is identical between the two
applications (other than pointing to different databases  using
different drivers).

I've heard mention of the Oracle 10g driver being quite a bit better
than previous versions ... I don't have any particular experience with
it, but you might want to give that a shot ... whatever the most
recent JDBC driver for Oracle is.

Other than that, you may want to look at some profiling tools. If I
recall correctly, P6Spy can help you there.


On Tue, 15 Mar 2005 16:18:10 -0700, Brian Barnett
[EMAIL PROTECTED] wrote:
 (Sorry if this double posts. Having problems with other email account.)
 Hello,
 Hoping someone can give us some suggestions on how to fix a problem we are
 facing. We have a Struts web app that runs against both MS SQL Server and
 Oracle.  MS SQL Server runs fine. When we run it against Oracle, the
 performance slowly degrades until the web app basically stops functioning.
 When we restart Tomcat, everything works fine again for awhile.
 
 We are not sure if there are any specific steps to duplicate, as our beta
 testers just use the app and then begin to see the problem.
 
 Does anyone have any suggestions on how we can troubleshoot this?
 
 Tomcat 5.0.28
 iBATIS 2.0 build 274
 Oracle 9.2.0.x
 Oracle Thin driver (ojdbc14.jar)
 
 TIA,
 Brian Barnett



Re: UI for iBatis

2005-03-11 Thread Brice Ruth
 True.  I guess it depends on the developer and how inuitive the gui is.  The
 one argument made for the gui is that you don't need to worry about
 violating the DTD with cut and paste errors, which I am prone to make.  To
 each his own on this one. 

I think a decent IDE with robust XML syntax support will help you out
here ... I used to constantly run into run-time errors, but with
Eclipse (and, I guess more specifically, the MyEclipse plug-in,
$29.95/yr) - the XML editor let's me know of any errors before it gets
that far. Saves me time and frustration. Decent code
hint/autocompletion for XML, too.

BR

On Fri, 11 Mar 2005 09:09:36 -0800 (PST), Michael Klaene
[EMAIL PROTECTED] wrote:
  
 
 I tend to shy away from UI config file
 generators becuase I find myself spending more time going through their
 menus checking and unchecking things and reading help as to what each
 checkbox does than if I would just copy and paste my changes.
  
 True.  I guess it depends on the developer and how inuitive the gui is.  The
 one argument made for the gui is that you don't need to worry about
 violating the DTD with cut and paste errors, which I am prone to make.  To
 each his own on this one. 
   
 Are you wanting a UI
 for the config files or something that will auto-generate a Java class
 to interact with the config files? 
 I can see this as being useful for getting started.  I know there's a Perl
 script that's been mentioned by Clinton that will do some this.  I would
 think it will still require quite a bit of manual editing after generation
 though (maybe not so much work for domain objects but for DAOs). 
   
 I personally think the most useful feature would be to test the SQL inside
 your SQL maps to see if it returned the desired object. 
   
 Mike 
   
 
 Ron Grabowski [EMAIL PROTECTED] wrote: 
 I'm curious as to what features you had in mind. Are you wanting a UI
 for the config files or something that will auto-generate a Java class
 to interact with the config files? I think the config files are fairly
 straight forward to configure as is. I just take an existing file and
 modify it for a new project. I tend to shy away from UI config file
 generators becuase I find myself spending more time going through their
 menus checking and unchecking things and reading help as to what each
 checkbox does than if I would just copy and paste my changes.
 
 - Ron
 
 --- shilpa wrote:
  Hi,
  Is there any UI available for iBatis 2.0.9. Can we expect iBatis
  with UI in 
  future?
  Thanks,
  Shilpa
  
  
 
 
  
 Do you Yahoo!?
  Yahoo! Small Business - Try our new resources site! 
 



Re: Duplicate Key in Db

2005-02-23 Thread Brice Ruth
I think you need to catch a DaoException, and check its cause. If its
cause is a NestedSqlException, you'll need to interrogate that to
determine what the real cause was. In your case, it appears a
generic exception is thrown by the JDBC driver
(com.borland.datastore.driver.SqlState), with a Runtime Error -
you'll probably need to parse for Duplicate key to determine if
that's what's being thrown.

I've had to do something similar ... it certainly isn't elegant, at
least not the way I did it! Maybe someone else has a better
suggestion.


On Wed, 23 Feb 2005 20:23:23 +, Tim Christopher
[EMAIL PROTECTED] wrote:
  You can do that now.  Maybe I'm missing something?
  The Ibatis insert() statement throws a SQLException.. ..
 
 Below is the first part of stack dump that is triggers by the failed
 insertion, so should I be catching a DaoException or
 NestedSQLException?...  Or is there anything else I can do?
 
 
 StandardWrapperValve[action]: Servlet.service() for servlet action
 threw exception
 com.ibatis.dao.client.DaoException: Failed to update - id
 [insertModule] - parameterObject [EMAIL PROTECTED]  Cause:
 com.ibatis.common.jdbc.exception.NestedSQLException:
 --- The error occurred in com/socs/persistence/sqlmapdao/sql/Module.xml.
 --- The error occurred while applying a parameter map.
 --- Check the insertModule-InlineParameterMap.
 --- Check the statement (update failed).
 --- Cause: com.borland.datastore.driver.SqlState: Runtime Error: [line
 1, col 6] Duplicate key value for $UNIQUE$1 sort order in MODULE.
 Caused by: com.borland.datastore.driver.SqlState: Runtime Error: [line
 1, col 6] Duplicate key value for $UNIQUE$1 sort order in MODULE.
 
 
 Tim Christopher



Re: SOAP attachement (pdf) stored into a db field

2005-02-17 Thread Brice Ruth
My understanding is that streaming data to a BLOB-type field (which
you would likely need to do with a 20MB+ dataset, is still a coming
soon feature - and I believe it requires the latest version of JDBC
(3.0), which may or may not be supported by the SQL Server driver
you're using (are you using jTDS?).

So, I guess what you're likely need to do is use JDBC for this
particular thing ... I'm not certain that even a CustomTypeHandler
will do the trick here for you - though it might, its worth a try.


On Wed, 16 Feb 2005 08:09:51 -0500, Horgen, Scott [EMAIL PROTECTED] wrote:
  
 
 I have a SOAP service that I would like to receive and store both XML based
 messages and their corresponding MIME attachments, in particular large, 20+
 MB file sizes directly into a database image type field in MS-SQL.  I can
 easily direct the attachement to a file: 
 
 private void persistToFile(AttachmentPart ap,int partNum, String
 persistToDirectory) { 
 java.io.InputStream content = null; 
 FileOutputStream fileOutputStream = null; 
 File attachFile = null; 
 byte[] buffer = new byte[1]; 
 int len ; 
 
 try {   
 attachFile = new File(persistToDirectory +
 \\NIHReply_ + partNum + _ + (new Date().getTime()) + .pdf); 
 
 fileOutputStream = new FileOutputStream(attachFile);
 content = (java.io.InputStream)ap.getContent(); 
 streamCopy(content, fileOutputStream); 
 partNum++; 
 fileOutputStream.close(); 
 } catch(Exception ex) { 
 ex.printStackTrace();   
 } 
 } 
 
 Where ap is an AttachmentPart object of type javax.xml.soap.AttachmentPart. 
 
 But, it is unclear how to proceed with this large stream in iBattis, which I
 am using just fine in the rest of my webservice. 
 
 Thanks, 
 
 Scott 
 
 _ 
 Scott Horgen 
 Java Architect 
 
 InfoEd International, Inc. 
 1873 Western Avenue, Suite 201 
 Albany, NY 12203 
 Tel:   518-464-0691 
 800-727-6427 
 Fax: 518-464-0695 



Re: BLOB Field

2005-02-17 Thread Brice Ruth
Version 2.0.9 of iBATIS supports BLOB field to byte[], as long as the
JDBC driver you're using does the right thing.

So, just define a byte[] field in your javabean and have a go, post
back if it doesn't work!


On Wed, 16 Feb 2005 16:56:59 +0100, BOUSSEBHA Djamel
[EMAIL PROTECTED] wrote:
  
 Hi; 
   
 I use into my j2ee application, the Ibatis tool for database access. Another
 external application stores into this database of the documents (pdf) in
 using of the fields BLOB. My web application must load and get these
 documents to publish them on line. 
 questions : 
 - How get these documents from BLOB field to copy them into a directory
 server. 
 - which is the best implementation to write a insert request with Ibatis
   
 Best regards;


Re: Help needed with Postgres Varchar [] - String [] - Repost

2005-02-14 Thread Brice Ruth
So, in Postgres, its an array of Varchar?! That seems awfully odd, but
I'm not that familiar with Postgres. If this is not in fact the case,
and you're create a Varchar(10) (length of 10) - then that should be
mapped to a simple String object, not an Array of String (String[]).

Brice


On Mon, 14 Feb 2005 12:34:27 -0500, William Harding
[EMAIL PROTECTED] wrote:
 *Note* - This is a second submission. I apologize if this is a repeat. I
 have been having so many problems with my ISP lately I don't know if
 this was ever sent through the first time. **
 
 Greetings all,
 
 I have spent the last 2 days researching how to handle the Postgres data
 type: VARCHAR[] and how to map it to a String[] with little to no luck.
 I am fairly new to iBATIS and I could have easily missed something very
 simple.
 
 Here is what I have.
 
 My Current mapping is as follows:
 
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE sqlMap PUBLIC -//iBATIS.com//DTD SQL Map 2.0//EN
 http://www.ibatis.com/dtd/sql-map-2.dtd;
 
 sqlMap namespace=CandidateInfo
 typeAlias alias=candidateinfo type=candidateinput.CandidateInfo/
 
 insert id=insertCandidateInfo parameterClass=candidateinfo
 INSERT INTO candidate_info (
 c_candidate_id,
 c_f_name, c_m_initial, c_l_name, c_address_line_one,
 c_address_line_two, c_city, c_state, c_zipcode,
 c_country, c_email, c_areacode, c_primary_phone,
 c_cell_areacode, c_cellphone,  c_biz_areacode,
 c_biz_phone, c_biz_phone_ext, c_lang_spoken,
 c_will_work_part_contract,  c_resume_fliename, c_db_entry_date )
 values (
 (select MAX(c_candidate_id) from candidate_info) + 1,
 #FName#, #MI#, #LName#, #addyOne#, #addyTwo#, #city#, #state#,
 #zipcode#,
 #country#, #emailAddy#, #homeArea#, #homePhone#, #cellArea#,
 #cellPhone#, #workArea#,
 #workPhone#, #workExt#, #languagesSpoken#, #willWorkPartCont#,
 #resumeFilename#, current_date )
 /insert
 
 /sqlMap
 
 The languagesSpoken parameter is a String[10] in the CandidateInfo
 object and is a VARCHAR[10] in the Postgresql database. I have tried
 various ways of setting the data type and nothing has worked.
 
 Each time I execute this mapping I get the following error:
 
 There was a sql Exception:
 com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
 occurred in CandidateInfo.xml. --- The error occurred while applying a
 parameter map. --- Check the insertCandidateInfo-InlineParameterMap. ---
 Check the parameter mapping for the 'languagesSpoken' property. ---
 Cause: java.lang.NullPointerException Caused by:
 java.lang.NullPointerException
 
 I have done several tests ranging from not setting any of the array
 items to filling them all in order to make sure that they are not null.
 My only question is how to I go about handling this issue? I have tried
 using an iterator tag to build the array by hand.
 
 Is this a mapping issue or quite possibly a data issue? How do I even go
 about debugging this?
 
 Any help would be greatly appreciated.
 
 Thanks.
 



Re: Help needed with Postgres Varchar [] - String [] - Repost

2005-02-14 Thread Brice Ruth
Since this is not a standard JDBC type (that I know of), you'll
probably need to write a custom type handler.

Others can correct me if I'm wrong ... but looking through the iBATIS
manual, I don't see any support for that.


On Mon, 14 Feb 2005 14:29:23 -0500, William Harding
[EMAIL PROTECTED] wrote:
 It is in fact an array of Varchar. Postgres is an object orieanted db so
 it does allow for that. For example (in the code listed below) we want
 to store the candidates languages with them in that row. So a Varchar[]
 array is the best way to deal with it. Otherwise it means setting up a
 foreign keyd table and doing joins, etc.
 
 
 Brice Ruth wrote:
 
 So, in Postgres, its an array of Varchar?! That seems awfully odd, but
 I'm not that familiar with Postgres. If this is not in fact the case,
 and you're create a Varchar(10) (length of 10) - then that should be
 mapped to a simple String object, not an Array of String (String[]).
 
 Brice
 
 
 On Mon, 14 Feb 2005 12:34:27 -0500, William Harding
 [EMAIL PROTECTED] wrote:
 
 
 *Note* - This is a second submission. I apologize if this is a repeat. I
 have been having so many problems with my ISP lately I don't know if
 this was ever sent through the first time. **
 
 Greetings all,
 
 I have spent the last 2 days researching how to handle the Postgres data
 type: VARCHAR[] and how to map it to a String[] with little to no luck.
 I am fairly new to iBATIS and I could have easily missed something very
 simple.
 
 Here is what I have.
 
 My Current mapping is as follows:
 
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE sqlMap PUBLIC -//iBATIS.com//DTD SQL Map 2.0//EN
 http://www.ibatis.com/dtd/sql-map-2.dtd;
 
 sqlMap namespace=CandidateInfo
 typeAlias alias=candidateinfo type=candidateinput.CandidateInfo/
 
 insert id=insertCandidateInfo parameterClass=candidateinfo
 INSERT INTO candidate_info (
 c_candidate_id,
 c_f_name, c_m_initial, c_l_name, c_address_line_one,
 c_address_line_two, c_city, c_state, c_zipcode,
 c_country, c_email, c_areacode, c_primary_phone,
 c_cell_areacode, c_cellphone,  c_biz_areacode,
 c_biz_phone, c_biz_phone_ext, c_lang_spoken,
 c_will_work_part_contract,  c_resume_fliename, c_db_entry_date )
 values (
 (select MAX(c_candidate_id) from candidate_info) + 1,
 #FName#, #MI#, #LName#, #addyOne#, #addyTwo#, #city#, #state#,
 #zipcode#,
 #country#, #emailAddy#, #homeArea#, #homePhone#, #cellArea#,
 #cellPhone#, #workArea#,
 #workPhone#, #workExt#, #languagesSpoken#, #willWorkPartCont#,
 #resumeFilename#, current_date )
 /insert
 
 /sqlMap
 
 The languagesSpoken parameter is a String[10] in the CandidateInfo
 object and is a VARCHAR[10] in the Postgresql database. I have tried
 various ways of setting the data type and nothing has worked.
 
 Each time I execute this mapping I get the following error:
 
 There was a sql Exception:
 com.ibatis.common.jdbc.exception.NestedSQLException: --- The error
 occurred in CandidateInfo.xml. --- The error occurred while applying a
 parameter map. --- Check the insertCandidateInfo-InlineParameterMap. ---
 Check the parameter mapping for the 'languagesSpoken' property. ---
 Cause: java.lang.NullPointerException Caused by:
 java.lang.NullPointerException
 
 I have done several tests ranging from not setting any of the array
 items to filling them all in order to make sure that they are not null.
 My only question is how to I go about handling this issue? I have tried
 using an iterator tag to build the array by hand.
 
 Is this a mapping issue or quite possibly a data issue? How do I even go
 about debugging this?
 
 Any help would be greatly appreciated.
 
 Thanks.
 
 
 
 
 
 
 
 
 



Re: StaleConnectionException

2005-02-14 Thread Brice Ruth
Does Websphere have a mechanism for validating connections, much like
Tomcat's DataSource? We simply supply a validation query that either
gets executed *every* time a DataSource is provided to a client -OR-
after a certain timeout (idle time).

This helped us when our iSeries was bounced regularly Sunday mornings.

Brice


On Mon, 14 Feb 2005 14:16:16 -0600, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 
 
 Hello,
 I am using websphere 5.1.2, oracle 9i and ibatis 2.0.8. I was using the
 following
 example from the jpetstore demo as a template for setting up my ibatis
 transactions
 but crazy things happen when the database has gone down and come back up.
 
 public Order getOrder(int orderId) {
   Order order = null;
   try {
 daoManager.startTransaction();
 order = orderDao.getOrder(orderId);
 for (int i = 0; i  order.getLineItems().size(); i++) {
   LineItem lineItem = (LineItem) order.getLineItems().get(i);
   lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
 }
 daoManager.commitTransaction();
   } finally {
 daoManager.endTransaction();
   }
   return order;
 }
 
 Websphere likes to throw a StaleConnectionException when a connection in
 the pool has gone
 bad. At the websphere site ibm shows how to use a construct something
 similar
 to the code below that retries if the StaleConnectionException is thrown.
 
 // Set retryCount to the number of times you would like to retry after a
 StaleConnectionException
 int retryCount = 5;
 // If the Database code processes successfully, we will set error = false
 boolean error = true;
 do {
   try {
 conn = ds.getConnection();
 stmt = conn.createStatement();
 String query = Select FirstNme, MidInit, LastName from Employee ORDER
 BY LastName;
 rs = stmt.executeQuery(query);
 while (rs.next()) { employeeList.addElement(rs.getString(3) + ,  +
 rs.getString(1) +   + rs.getString(2)); }
 //Set error to false to indicate successful completion of the database
 work
 error=false;
   } catch (com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException cw) {
 // This exception is thrown if a connection can not be obtained from
 the
 // pool within a configurable amount of time.  Frequent occurrences of
 // this exception indicate an incorrectly tuned connection pool
 System.out.println(Connection Wait Timeout Exception during get
 connection or process SQL:  + c.getMessage());
 //In general, we do not want to retry after this exception, so set
 retry count to 0
 retryCount = 0;
   } catch (com.ibm.websphere.ce.cm.StaleConnectionException sc) {
 // This exception indicates that the connection to the database is no
 longer valid.
 // Retry several times to attempt to obtain a valid
 //connection, display an error message if the connection still can not
 be obtained.
 System.out.println(Stale Connection Exception during get connection or
 process SQL:  + sc.getMessage());
 if (--retryCount == 0) {
   System.out.println(Five stale connection exceptions, displaying
 error page.);
 }
   }
 } while ( error==true  retryCount  0 );
 
 And now my question, is there a way to have ibatis automatically retry when
 it gets a StaleConnectionException?
 Or should each method implement something like below?
 
 public Order getOrder(int orderId) {
   Order order = null;
   int retryCount = 5;
   boolean error = true;
   do {
 try {
   daoManager.startTransaction();
   order = orderDao.getOrder(orderId);
   for (int i = 0; i  order.getLineItems().size(); i++) {
 LineItem lineItem = (LineItem) order.getLineItems().get(i);
 lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
   }
   daoManager.commitTransaction();
   error = false;
 } catch (com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException cw) {
   System.out.println(Connection Wait Timeout Exception during get
 connection or process SQL:  + c.getMessage());
   retryCount = 0;
 } catch (com.ibm.websphere.ce.cm.StaleConnectionException sc) {
   System.out.println(Stale Connection Exception during get connection
 or process SQL:  + sc.getMessage());
   if (--retryCount == 0) {
 System.out.println(Five stale connection exceptions, displaying
 error page.);
   }
 } finally {
   daoManager.endTransaction();
 }
   } while ( error==true  retryCount  0);
   return order;
 }
 
 I am new to websphere and haven't seen a topic like this covered on the
 list yet.
 
 thanks
 
 Cory Bestgen
 Computer Information Technologist II
 Information Technology Division
 Office of State Courts Administrator
 (573) 522 - 5455
 [EMAIL PROTECTED]
 



Re: StaleConnectionException

2005-02-14 Thread Brice Ruth
I think Cory is sitting back in his chair with smoke comin' off the
top of his hair. Whew .. that was scorchin'! :)

And absolutely deserved (by WebSphere).

As I indicated - this (very common) problem is something that the
DataSource implementation provided by Tomcat (gratis) handles very
elegantly. If I setup my DataSource correctly, I can rest assured that
as long as the database is up and authentication is successful, my app
will get a valid connection - it (nor iBATIS) needs to know about
anything else, which is how it ought to be!

Brice


On Mon, 14 Feb 2005 13:29:38 -0700, Clinton Begin
[EMAIL PROTECTED] wrote:
 This is not a criticism of you, but of WebSphere and that example
 
 That is the single most ridiculous thing I have ever seend.  That code
 and approach is absolutely stupid.  The entire point behind the
 DataSource interface is to hide code like that and deal with
 infrastructure issues in a single location, so you don't have to
 everywhere.
 
 That DataSource is flawed.  I suggest you call IBM and tell them this
 exactly.  Tell them to fix their crappy datasource and their crappy
 app server.
 
 If they refuse (which they probably will if you've already paid them
 their annual fees), then you could always wrap the datasource with
 your own implementation that will deal with this.
 
 phew.  Glad to get that off my chest.  ;-)
 
 Cheers,
 Clinton
 
 
 On Mon, 14 Feb 2005 14:16:16 -0600, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
 
 
  Hello,
  I am using websphere 5.1.2, oracle 9i and ibatis 2.0.8. I was using the
  following
  example from the jpetstore demo as a template for setting up my ibatis
  transactions
  but crazy things happen when the database has gone down and come back up.
 
  public Order getOrder(int orderId) {
Order order = null;
try {
  daoManager.startTransaction();
  order = orderDao.getOrder(orderId);
  for (int i = 0; i  order.getLineItems().size(); i++) {
LineItem lineItem = (LineItem) order.getLineItems().get(i);
lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
  }
  daoManager.commitTransaction();
} finally {
  daoManager.endTransaction();
}
return order;
  }
 
  Websphere likes to throw a StaleConnectionException when a connection in
  the pool has gone
  bad. At the websphere site ibm shows how to use a construct something
  similar
  to the code below that retries if the StaleConnectionException is thrown.
 
  // Set retryCount to the number of times you would like to retry after a
  StaleConnectionException
  int retryCount = 5;
  // If the Database code processes successfully, we will set error = false
  boolean error = true;
  do {
try {
  conn = ds.getConnection();
  stmt = conn.createStatement();
  String query = Select FirstNme, MidInit, LastName from Employee ORDER
  BY LastName;
  rs = stmt.executeQuery(query);
  while (rs.next()) { employeeList.addElement(rs.getString(3) + ,  +
  rs.getString(1) +   + rs.getString(2)); }
  //Set error to false to indicate successful completion of the database
  work
  error=false;
} catch (com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException cw) {
  // This exception is thrown if a connection can not be obtained from
  the
  // pool within a configurable amount of time.  Frequent occurrences of
  // this exception indicate an incorrectly tuned connection pool
  System.out.println(Connection Wait Timeout Exception during get
  connection or process SQL:  + c.getMessage());
  //In general, we do not want to retry after this exception, so set
  retry count to 0
  retryCount = 0;
} catch (com.ibm.websphere.ce.cm.StaleConnectionException sc) {
  // This exception indicates that the connection to the database is no
  longer valid.
  // Retry several times to attempt to obtain a valid
  //connection, display an error message if the connection still can not
  be obtained.
  System.out.println(Stale Connection Exception during get connection or
  process SQL:  + sc.getMessage());
  if (--retryCount == 0) {
System.out.println(Five stale connection exceptions, displaying
  error page.);
  }
}
  } while ( error==true  retryCount  0 );
 
  And now my question, is there a way to have ibatis automatically retry when
  it gets a StaleConnectionException?
  Or should each method implement something like below?
 
  public Order getOrder(int orderId) {
Order order = null;
int retryCount = 5;
boolean error = true;
do {
  try {
daoManager.startTransaction();
order = orderDao.getOrder(orderId);
for (int i = 0; i  order.getLineItems().size(); i++) {
  LineItem lineItem = (LineItem) order.getLineItems().get(i);
  lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
}
daoManager.commitTransaction();
error = false;
  } catch (com.ibm.ejs.cm.pool.ConnectionWaitTimeoutException cw) {
 

Re: What is N+1

2005-02-09 Thread Brice Ruth
Vic, probably isn't an issue for you since you only use HashMaps ;)


On Wed, 09 Feb 2005 08:12:32 -0600, Vic Cekvenich [EMAIL PROTECTED] wrote:
 Which I could do with a join on SQL side. I can't see how this is
 something I'd use or how it' scale, but I guess somone uses it.
 THANKS for the education.
 .V
 
 Kris Jenkins wrote:
 
 
 
  The N+1 selects problem is when you query for n parents, and you need
  one extra query for the children.  Internally, this happens:
 
 List parents = sqlMap.queryForList( getParents, parameter );
 for ( Iterator i = parents.iterator(); i.hasNext(); ) {
Parent p = (Parent) i.next();
List children = sqlMap.queryForList( getChild, p.getId() );
p.setChildren( children );
 }
 
  So you end up with 1 query for the parent list, plus one extra for
  each parent to get the children = n + 1.  Rather inefficient.
  This is the problem that 2.0.9 fixes.
 
  Sorry for the confusion.
  Kris
 
 
 --
 Forums, Boards, Blogs and News in RiA http://www.boardVU.com



Re: selectKey for MySql

2005-02-02 Thread Brice Ruth
Should your resultClass be java.lang.Long instead of just long ?


On Wed, 2 Feb 2005 14:17:02 +0800, Gustavo Kuerten [EMAIL PROTECTED] wrote:
 The solution offered by Larry
 http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg00673.html
 does not work in my case. Anyone can offer any other insights on the
 problem ? In my case, my id is mapped to a BIGINT in the mysql
 database and is represented as a Long in the Java object. Is this
 mapping correct ?
 
   insert id=insertCurrency parameterClass=currency
 insert into CURRENCY (VERSION, CURRENCY_CODE, COUNTRY)
 values(NOW(), #currencyCode#, #country#)
   selectKey resultClass=long keyProperty=id
 SELECT LAST_INSERT_ID()
   /selectKey
   /insert
 
 Thanks
 
 R



Re: jpetstore: port to UNIX?

2005-01-31 Thread Brice Ruth
Typically, on UNIX systems, MySQL is only case-sensitive w/r/t table
names, not column names. This is because MySQL maps a table name to a
file on the file system, which is typically case-sensitive on UNIX
systems.

Brice


On Fri, 28 Jan 2005 19:08:27 -0600 (CST), Ken Simpson [EMAIL PROTECTED] wrote:
 Hi - has anyone ported JPetStore 4 to MySQL 4.1.x and Tomcat 5.5.4 under UNIX
 - from whence it came?
 
 It appears to be a question of using the case on the SQL commands 
 consistently.
 
 For instance, the MySQL schema creates a database 'JPETSTORE' with upper case,
 and the 'account' table and columns with lower case
 
 create table account (
 userid varchar(80) not null,
 email varchar(80) not null,
 firstname varchar(80) not null,
 lastname varchar(80) not null,
 status varchar(2)  null,
 addr1 varchar(80) not null,
 addr2 varchar(40) null,
 city varchar(80) not  null,
 state varchar(80) not null,
 zip varchar(20) not null,
 country varchar(20) not null,
 phone varchar(80) not null,
 constraint pk_account primary key (userid)
 );
 
 but the sqlmapdao generates a mapping for upper case column names
 
 sqlMap namespace=Account
 typeAlias alias=account 
 type=com.ibatis.jpetstore.domain.Account/
 resultMap id=accountResult class=account
 result property=username column=USERID/
 result property=email column=EMAIL/
 result property=firstName column=FIRSTNAME/
 result property=lastName column=LASTNAME/
 result property=status column=STATUS/
 result property=address1 column=ADDR1/
 result property=address2 column=ADDR2/
 result property=city column=CITY/
 result property=state column=STATE/
 result property=zip column=ZIP/
 result property=country column=COUNTRY/
 result property=phone column=PHONE/
 result property=languagePreference column=LANGPREF/
 result property=favouriteCategoryId column=FAVCATEGORY /
 result property=listOption column=MYLISTOPT /
 result property=bannerOption column=BANNEROPT /
 result property=bannerName column=BANNERNAME /
 /resultMap
 
 [snip]
 
 -- Ken
 



Re: java.util.HashMap as resultClass

2005-01-24 Thread Brice Ruth
The Struts LabelValue bean is quite nice (and simple), though to use
it with iBATIS, I needed to created my own implementation that extends
the standard LabelValue bean, since what ships w/ Struts doesn't have
a default constructor (and hence is not useable with reflection). I
just extend the LabelValue bean and create a no arg constructor that
calls the (string,string) constructor with empty strings - then iBATIS
does the rest.

Using Struts html:optionsCollection is dead-simple then, just provide
it the property that contains the List populated from the iBATIS
queryForList(...) call.

By the way, I've recently really started using the common-beanutils
from Apache, they really are invaluable when working with an MVC
pattern, particularly Struts where you often have ActionForms,
DynaActionForms (map backed), etc. that you need to pull properties
out of and re-populate other beans to pass on to iBATIS or other
layers. Works great :)

Cheers!
Brice


On Mon, 24 Jan 2005 12:44:27 -0800 (PST), Prashanth Sukumaran
[EMAIL PROTECTED] wrote:
 Hi Pascal,
 
 I think i understand what Brandon is trying to say. He is talking about using 
 the right pattern
 for the kind of job you are trying to achieve.
 
 If my guess is right. Looks like you trying to do this for your dropdowns.  I 
 do it this way and i
 feel it is much cleaner this way.
 
 public interface ValueObject{
 
 /**
  * Gets the iD attribute of the KeyValueObject object
  *
  * @return   The iD value
  */
 String getID();
 
 /**
  * Gets the value attribute of the KeyValueObject object
  *
  * @return   The value value
  */
 String getValue();
 
   /**
* This method returns sort field
*
*
* @return value of sort field
  */
 public Object getSortFieldValue();
 }
 
 All Objects that you are using for Dropdowns will extend the ValueObject, and 
 they will implement
 the three methods.  In your case getID() will return SKU, getValue will 
 return Description.  and
 for the getSortFieldValue() have an empty implementation.  This way the bean 
 can be used for other
 things and also used for dropdowns.
 
 For the dropdowns have a common method that handles them or even struts has 
 the LabelValue bean.
 
 Rgds
 Prashanth.
 
 
 --- Pascal DeMilly [EMAIL PROTECTED] wrote:
 
  Well. It seems logical to me. Why would iBatis go into great length at
  trying to map result in the SqlMap file then if it was not to limit the
  knowledge of your database to that XML file. The dependency have to stop
  somewhere and it seems to me the SqlMap file is the place where it
  should stop. The DAO implementation classes should only know about the
  iBatis map id and its expected POJO results not how your database
  columns are named or it seems to me.
 
  Anyway, in my case while this solve one of my problem, queryForMap is
  still not as efficient as it could be since it relies on queryForList.
  So basically it is building two list. One with each element being a Map
  of column name/value, then another map of only values. Would it be more
  efficient to rewrite queryForMap to use a RowHandler?
 
 
 
  On Mon, 2005-01-24 at 10:15, Brandon Goodin wrote:
   Why is it a problem to have a code dependency in an implementation
   class? It is suppossed to be aware of IBatis SQLMap semantics. You
   interface over your DAO class should hide the specifics of your
   implementation code within your Dao.
  
   Brandon
  
  
  
  
   On Mon, 24 Jan 2005 09:22:49 -0800, Pascal DeMilly
   [EMAIL PROTECTED] wrote:
Thanks Larry,
   
I tried it and it works. However this still leave some dependencies in
my DAO code as I have to specify the column names there as in:
   
return getSqlMapClientTemplate().queryForMap(getItemNameMap, null, 
SKU, Description);
   
How will you do about moving that code into the SqlMap. Should I create
a custom resultMap with key/value as properties and refer to it in my
DAO code?
   
I am going to give it a try and see what happened.
   
Thanks for you help.
   
Pascal
   
On Mon, 2005-01-24 at 08:44, Larry Meadors wrote:
 Try executeQueryForMap() instead.


 On Mon, 24 Jan 2005 08:42:25 -0800, Pascal DeMilly
 [EMAIL PROTECTED] wrote:
  Hi,
 
  I would like to retrieve a Map with whose key is the 1st column of 
  my
  query and the value is the 2nd column. For example right now I do:
 
  select id=getItemNameMap resultClass=java.util.HashMap
  select SKU, Description from Items
  /select
 
  However this returns a list of maps with the key being the column 
  name
  and the value the column value which seems wasteful in term of 
  space (I
  am using remoting to retrieve that info).
 
  I currently solve it by using a custom rowHandler in my DAO as 
  follow:
 
  public Map getItemNames () throws DataAccessException {
  final 

Re: java.util.HashMap as resultClass

2005-01-24 Thread Brice Ruth
For the record, this recommendation is far better than using a
LabelValueBean in iBATIS SqlMaps ... I still do it, because its easy,
but Clinton's suggestion is far superior :)


On Mon, 24 Jan 2005 14:04:42 -0700, Clinton Begin
[EMAIL PROTECTED] wrote:
 Pascal,
 
 Another approach is to use a wrapper class at your presentation layer.
  After all, this is a presentation layer problem, that is probably
 best solved in the presentation layer -- not in the persistence layer.
 
 By aliasing your columns to ID and Value, you've made a change to your
 persistence for the sake of a presentation requirement.
 
 Here's my recommendation:
 
 1) Use a real domain model.  Avoid Maps.  Create a real class that
 represents your domain.  In this case it looks like a Product class or
 something (with properties such as  SKU, Description etc.)
 
 2) Map that class with iBATIS properly, using a real parameter class
 and result class, with columns mapped to the JavaBean properties.
 
 3) Use that domain object throughout your application.  When a
 requirement such as a droplist manifests itself, use a wrapper class
 to manage special behavior.  For example, given a Product class, you
 could have a ProductDropListItem that knows how to provide the
 appropriate identifier and value to the drop list.
 
 Don't worry about having to make a matching DropListItem for each
 class.  It's very easy to make a generic one that will work with any
 domain class (passed into the constructor).  E.g. new DropListItem
 (aProduct).
 
 This keeps presentation layer problems out of the persistence layer.
 It's also pretty easy to implement.
 
 Cheers,
 Clinton
 
 On Mon, 24 Jan 2005 12:44:27 -0800 (PST), Prashanth Sukumaran
 [EMAIL PROTECTED] wrote:
  Hi Pascal,
 
  I think i understand what Brandon is trying to say. He is talking about 
  using the right pattern
  for the kind of job you are trying to achieve.
 
  If my guess is right. Looks like you trying to do this for your dropdowns.  
  I do it this way and i
  feel it is much cleaner this way.
 
  public interface ValueObject{
 
  /**
   * Gets the iD attribute of the KeyValueObject object
   *
   * @return   The iD value
   */
  String getID();
 
  /**
   * Gets the value attribute of the KeyValueObject object
   *
   * @return   The value value
   */
  String getValue();
 
/**
 * This method returns sort field
 *
 *
 * @return value of sort field
   */
  public Object getSortFieldValue();
  }
 
  All Objects that you are using for Dropdowns will extend the ValueObject, 
  and they will implement
  the three methods.  In your case getID() will return SKU, getValue will 
  return Description.  and
  for the getSortFieldValue() have an empty implementation.  This way the 
  bean can be used for other
  things and also used for dropdowns.
 
  For the dropdowns have a common method that handles them or even struts has 
  the LabelValue bean.
 
  Rgds
  Prashanth.
 
 
  --- Pascal DeMilly [EMAIL PROTECTED] wrote:
 
   Well. It seems logical to me. Why would iBatis go into great length at
   trying to map result in the SqlMap file then if it was not to limit the
   knowledge of your database to that XML file. The dependency have to stop
   somewhere and it seems to me the SqlMap file is the place where it
   should stop. The DAO implementation classes should only know about the
   iBatis map id and its expected POJO results not how your database
   columns are named or it seems to me.
  
   Anyway, in my case while this solve one of my problem, queryForMap is
   still not as efficient as it could be since it relies on queryForList.
   So basically it is building two list. One with each element being a Map
   of column name/value, then another map of only values. Would it be more
   efficient to rewrite queryForMap to use a RowHandler?
  
  
  
   On Mon, 2005-01-24 at 10:15, Brandon Goodin wrote:
Why is it a problem to have a code dependency in an implementation
class? It is suppossed to be aware of IBatis SQLMap semantics. You
interface over your DAO class should hide the specifics of your
implementation code within your Dao.
   
Brandon
   
   
   
   
On Mon, 24 Jan 2005 09:22:49 -0800, Pascal DeMilly
[EMAIL PROTECTED] wrote:
 Thanks Larry,

 I tried it and it works. However this still leave some dependencies in
 my DAO code as I have to specify the column names there as in:

 return getSqlMapClientTemplate().queryForMap(getItemNameMap, null, 
 SKU, Description);

 How will you do about moving that code into the SqlMap. Should I 
 create
 a custom resultMap with key/value as properties and refer to it in my
 DAO code?

 I am going to give it a try and see what happened.

 Thanks for you help.

 Pascal

 On Mon, 2005-01-24 at 08:44, Larry Meadors wrote:
  Try executeQueryForMap() instead.
 
 
  

Re: connection parameters

2005-01-19 Thread Brice Ruth
When you say

... in the page there are replaced with question marks '?' ...

I assume you mean a JSP that you're displaying your results in? I
would suggest that you set the character-encoding on the JSP to UTF-8
(change any HTML META tags appropriately as well). From what I can
tell, you're using MySQL - and if memory serves, the parameters you're
using are telling MySQL that the data is stored as ISO-8859-1 and to
pull the data out as Unicode.

Once iBATIS passes the Unicode data on to your presentation layer
(through Struts or otherwise), then it needs to be presented to the
browser appropriately, which in most cases is UTF-8.

That's what we do here, anyway ... 

Brice


On Wed, 19 Jan 2005 15:48:55 +0100, Kris Barnhoorn [EMAIL PROTECTED] wrote:
 :)
 
 With code works I meant iBatis doesn't give errors.
 
 In the database there are special characters like è é ë etc..
 and in the page there are replaced with question marks '?'.
 
 All my pages have character encoding iso-8859-1 and the database too.
 
 I had similar problems in the past if I didn't specify the extra
 connection parameters.(useUnicode, characterEncoding)
 
 In my pre-ibatis code I set it in a initServlet like:
 
 BasicDataSource ds = new BasicDataSource();
 ds.setDriverClassName(getInitParameter(driverClass));
 ds.setUrl(getInitParameter(jdbcURL));
 ds.setUsername(getInitParameter(user));
 ds.setPassword(getInitParameter(pwd));
 ds.setMaxActive(Integer.parseInt(getInitParameter(maxActive)));
 ds.setMaxWait(Integer.parseInt(getInitParameter(maxWait)));
 
 ds.addConnectionProperty(autoReconnect,getInitParameter(autoReconnect
 ));
 ds.addConnectionProperty(useUnicode,getInitParameter(useUnicode));
 ds.addConnectionProperty(characterEncoding,getInitParameter(character
 Encoding));
 
 ds.setDefaultReadOnly(false);
 ds.setDefaultAutoCommit(false);
 ds.setValidationQuery(getInitParameter(validationQuery));
 
 greets
 kris.
 
 -Oorspronkelijk bericht-
 Van: Larry Meadors [mailto:[EMAIL PROTECTED]
 Verzonden: woensdag 19 januari 2005 14:19
 Aan: ibatis-user-java@incubator.apache.org
 Onderwerp: Re: connection parameters
 
 Heheh, well, if it works, then yes.
 
 I am not sure I understand the question here.
 
 Can you clarify it?
 
 Larry
 
 On Wed, 19 Jan 2005 14:17:35 +0100, Kris Barnhoorn [EMAIL PROTECTED]
 wrote:
  Hi,
 
  I was wondering if this is the correct way to add extra parameters to
  the connection?
 
  transactionManager type=JDBC
  dataSource type=DBCP
  property name=JDBC.Driver value=${driver}
  /
  property name=JDBC.ConnectionURL
 
 value=${url}?characterEncoding=iso-8859-1;autoReconnect=true;useUnicode
  =true /
  property name=JDBC.Username
  value=${username} /
  property name=JDBC.Password
  value=${password} /
  property name=JDBC.DefaultAutoCommit
  value=false /
  !-- The following are optional --
  property name=Pool.MaximumActiveConnections
  value=10 /
  property name=Pool.MaximumIdleConnections
  value=5 /
  property name=Pool.MaximumWait
 value=6
  /
  !-- Use of the validation query can be
  problematic. If you have difficulty, try without it. --
  property name=Pool.ValidationQuery
  value=select 1 from users /
  property name=Pool.LogAbandoned
 value=false
  /
  property name=Pool.RemoveAbandoned
  value=false /
  property name=Pool.RemoveAbandonedTimeout
  value=5 /
  /dataSource
  /transactionManager
 
  Code Works, but I have special characters to question marks issues
 
  Thanks.
  Kris.
 
 
 



Re: change in property value inside select/

2005-01-19 Thread Brice Ruth
Many diffierent solutions are presented here, personally - I use the
CONCAT string function which is present in most SQL databases, that
way you don't need to worry about how strings are concatenated in
short hand.

YMMV
Brice


On Tue, 18 Jan 2005 12:22:55 -0500, Nilesh Bhattad
[EMAIL PROTECTED] wrote:
  
  
 
 Hello, 
 
   
 
 Is there a way to change a property value before it is plugged in to the
 select statement? 
 
   
 
 select id=search parameterClass=java.util.HashMap
 resultClass=java.util.HashMap 
 
   select ConsultantId, BlackListed, FirstName, LastName,
 HomeTelephone, EmailAddress, InterviewGrade, TotalYrsOfExp from Consultant 
 
 dynamic prepend= where  
 
 isNotEmpty property=FirstName prepend= and FirstName
 like #FirstName#/isNotEmpty 
 
 isNotEmpty property=LastName prepend= and LastName
 like #LastName#/isNotEmpty 
 
 isNotEmpty property=ActiveInactive prepend= and
 ActiveInactive like #ActiveInactive#/isNotEmpty 
 
 /dynamic
 
   order by FirstName, LastName 
 
  /select 
 
   
 
 For example, in the above case, when FirstName is present, is there a way to
 attach '%' at the end of the FirstName's value and then perform the select
 operation? 
 
   
 
 For some reason, in the calling program, I won't be able to attach '%' at
 the end of the search fields. Well, somehow I could achieve that before the
 iBatis call is made, but I'm kindof hesitant to go with that approach. So I
 was wondering is there any way to handle it in iBatis layer. Any help is
 highly appreciated. 
 
   
 
 Thanks 
 
 Nilesh


Re: Connecting using User's Credentials

2004-12-21 Thread Brice Ruth
Yes, there is a previous example of how to do this, I believe it is on
the old SourceForge forum, if I'm not mistaken. I'll go search for the
link to the particular thread if I can find it.


On Tue, 21 Dec 2004 08:58:18 -0600, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
  
 I'm using the ibatis DAO framework and SQLMapping to develop a web
 application and it is working great.  I used Hibernate on the last project,
 but the client insisted on having more control over the SQL.  SQLMapping
 takes care of that.  Now the DBA is insisting that each user authenticate
 with their own Oracle ID and password.  Can I pass in the connection
 credentials at run time rather than use what is in the config file?