Re: groupBy

2005-06-08 Thread Ron Grabowski
You may find this thread helpful:

http://tinyurl.com/co6tt 
http://www.mail-archive.com/ibatis-dev%40incubator.apache.org/msg01015.html

--- Ersin Er [EMAIL PROTECTED] wrote:

 Brandon Goodin wrote:
 
 This will help you:

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+around+the+N+Plus+1+selects+problem%3F
   
 
 Infact, the document is the same as the Developer's Guide. What a
 pity, 
 it did not help me. Anyway, I'm trying and learning myself.
 
 The groupBy attribute's value is a class property, not a table
 column, 
 right?
 
 On 6/6/05, Ersin Er [EMAIL PROTECTED] wrote:
   
 
 Hi,
 
 What is the porpose of groupBy attribute used in the SQL Mapper
 doc for
 Complex Collection Properties subject? It says The important
 items here
 are the groupBy=quarter attribute.. but it doesn't say why. I've
 tried
 my own example for 1:M relations and I did not the effect of
 groupBy
 attribute clearly. (After a few examples, a new sample doc will
 come.. :)
 )
 
 Thanks.
 
 --
 Ersin
 
 
 
 
 
 



Re: [HELP] I can't not type sign in my sqlmap xml file

2005-05-25 Thread Ron Grabowski
Huy, could you give an example additional functionality that another
templating engine would provide? Someone (Brandon?) asked a question a
few weeks ago about what other dynamic sql tags people would like to
see. I don't think anyone ever responded. I couldn't think of any
additional tags myself.


Re: [HELP] I can't not type sign in my sqlmap xml file

2005-05-19 Thread Ron Grabowski
You can use:

 lt;

Or enclose the text within CDATA:

select id=getNOFBidding resultClass=int parameterClass=string
 ![CDATA[
  SELECT * FROM Sale WHERE TO_DAYS(NOW()) - TO_DAYS(SALEDATE) = 15
 ]]
/select

--- Pham Anh Tuan [EMAIL PROTECTED] wrote:
 Hi,
 
 I can't not type  sign in sql definition xml file, I don't know why,
 plz help me solve this problem :(
 
 select id=getNOFBidding resultClass=int parameterClass=string
 
 select COUNT(distinct ITEMID) 
 
 from SALE 
 
 where SALESTATUS = 0 and MAXPRICE = 1 
 
 and TO_DAYS(NOW()) - TO_DAYS(SALEDATE) = 15 and TO_DAYS(NOW()) -
 TO_DAYS(SALEDATE)  0 
 
 and BUYERUSERID = #value#
 
 /select
 
 report error: The content of elements must consist of well-formed
 character data or markup
 
 Thanks for reading
 
 Anh Tuan
 


Re: Custom Type Handler question

2005-05-16 Thread Ron Grabowski
After re-reading this sentance in the development guide:

The name value is simply a placeholder, you can use another moniker
if you like.

my comment probably wasn't all that relavent. On the flip side,
IBatisNet doesn't adhere to the documentation in this regard.

--- Clinton Begin [EMAIL PROTECTED] wrote:
 The answer to that question is yes (even if the parameterClass is 
 specified). 
 
 But is it meant to be part of this thread? 
 
 Cheers,
 Clinton
 
 On 5/15/05, Ron Grabowski [EMAIL PROTECTED] wrote:
  
  If a parameterClass or parameterMap is not specified:
  
  select id=getQuartersForServiceYear resultMap=quarterMap
  
  and a simple type is passed in, does the Java version allow the
 user to
  name the value something other than #value#?
  
  where SeasonYear = #year#
  
  --- Clinton Begin [EMAIL PROTECTED] wrote:
  
   I'm not really sure what the problem could be. It should work
 fine.
  
   Is there no way to just join the data and return a set of
 repeating
   groups
   and use the iBATIS N+1 Selects solution?
  
  
  
 

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I+get+around+the+N+Plus+1+selects+problem%3F
  
 
 


Re: Custom XML Resultmaps

2005-05-12 Thread Ron Grabowski
Do you want to have IBatis generate an xml file that can be loaded by a
DataSet's ReadXml method? Here's an example for the non-.Net people of
one way of saving a DataSet to XML:

 DataSet ds = new DataSet(People);

 DataTable dt = new DataTable(Person);
 dt.Columns.Add(Name, typeof(string));
 dt.Columns.Add(Age, typeof(int));

 DataRow dr = dt.NewRow();
 dr[Name] = Ron;
 dr[Age] = 99;
 dt.Rows.Add(dr);

 ds.Tables.Add(dt);

 ds.WriteXml(output.xml);

 People
   Person
 NameRon/Name
 Age99/Age
   /Person
 /People

Except for the outer People node, I believe IBatis can generate that
already.

--- Abdullah Kauchali [EMAIL PROTECTED] wrote:
 Is it possible to extend the current XML Resultmap format to a new 
 custom one?  Don't ask!, but were are investigating the possibility
 of 
 returning XML in Microsoft's ADO format.
 
 Any general advice on this would be greatly appreciated,
 
 Kind regards
 
 Abdullah
 


Re: Vote your favourite iBATIS community member onto the Contributors list

2005-05-11 Thread Ron Grabowski
Brandon is already a committer. If he wasn't, I'd vote for him and
Larry. Whenever I need an answer to something right away I hop on the
IRC channel and they answer it for me :)

--- Brice Ruth [EMAIL PROTECTED] wrote:
 Are we supposed to be voting for someone already on the list? It
 sounds like you want us to vote on *new* individuals (other than
 Kris,
 Nathan, Fabrizio, or Ron).
 
 If I am understanding that correctly, I'd like to vote for Brandon
 ... 
 
 Brice
 
 On 5/10/05, Clinton Begin [EMAIL PROTECTED] wrote:
  Hi all,
   
   The new website includes a Contributors section that recognizes
  individuals in our iBATIS community that contribute to the project
 in
  particularly helpful ways.  This includes providing documentation
 (sometimes
  language translations), FAQ entries and other Wiki contributions,
 answering
  to the Mailing Lists and even submitting good JIRA issues (new
 features or
  bugs).
   
   So far we have:
   
   Kris Jenkins - For his amazing Oracle experience that he shares on
 the
  lists regularly.
   
   Nathan Maves - For adding to (and fixing) the FAQ, aasking great
 questions
  in the past, and eventually answering questions on the mailing
 lists.
   
   Fabrizio Gianneschi - For speaking at Java User Groups in Italy,
 performing
  case studies and writing Italian documentation.
   
   Ron Grabowski - For being a helpful and very active member of the
 mailing
  list and submitting useful issues and feature requests regularly.
   
   If you'd like to vote someone else in, let us know (privately, or
  publicly).  There's no minimum number of votes required, one really
 good
  vote will do.
   
   Don't vote for yourself though, that's lame.  ;-)   (Unless you
 feel we
  really did miss you for doing something spectacular, in which case
 we're
  sorry, and let us know.)
   
   Cheers,
   Clinton
   
 
 
 -- 
 Brice Ruth
 Software Engineer, Madison WI
 


Re: Calling all Store Procedure Gurus

2005-05-02 Thread Ron Grabowski
Is the upcoming iBatis book going to be primarily focused on Java or
will equal time be spent on the .Net implementation as well?

--- Brandon Goodin [EMAIL PROTECTED] wrote:
 Please provide straight JDBC code that calls the stored procedure.
 
 I wanted to get a few examples from various databases if possible.
 But, one will do as much as several. Whoever delivers the best usable
 example will receive credit for it in the an upcoming iBatis book.


RE: iBatis DAO Loading dao.xml

2005-05-02 Thread Ron Grabowski
Calls to buildDaoManager resolve to this class:

http://tinyurl.com/9qymm
http://svn.apache.org/repos/asf/incubator/ibatis/trunk/java/mapper/mapper2/src/com/ibatis/dao/engine/builder/xml/XmlDaoManagerBuilder.java

Have you browsed the JPetstore source code:

http://tinyurl.com/bpgl7
http://svn.apache.org/repos/asf/incubator/ibatis/trunk/java/jpetstore/jpetstore4/src/com/ibatis/jpetstore/persistence/DaoConfig.java

to see how everything fits together?

Is something not working? Are calls to buildDaoManager throwing an
exception?

--- Folashade Adeyosoye [EMAIL PROTECTED] wrote:

 The best way to find this out is to use your IDE to step thru the
 code and
 but break points. I have resulted to that in the last couple of days
 to
 actually see how the framework works but sadly have not been able
 to get
 pass the daoManager = DaoManagerBuilder.buildDaoManager(reader); in
 my big
 project that am converting.
 
 But able to do it on a small one class (service class) file.
 
 
 
 
 -Original Message-
 From: Gregg D Bolinger [mailto:[EMAIL PROTECTED] 
 Sent: Monday, May 02, 2005 12:39 PM
 To: Brandon Goodin
 Cc: ibatis-user-java@incubator.apache.org
 Subject: Re: iBatis DAO Loading dao.xml
 
 The dao manager does not parse it every time. It only parses once.
 
 Is this documented somewhere?  How does that work if my code is
 telling the builder to build everytime a service request is made?  Is
 it cached somewhere in memory much like the hand made singleton class
 I am using?  I don't want to perform extra logic if I don't have to
 but I need proof it is doing as expected. :)
 
 Thanks.
 
 
 
 On 5/2/05, Brandon Goodin [EMAIL PROTECTED] wrote:
  It would be perfectly fine to instantiate the Service class in your
  web layer. But, you might want to follow a similar pattern as the
  service layer does with the Dao classes. Instantiate your service
  classes in the constructor and assign them to instance variables in
  your Servlet, Action(Struts) or whatever you are using on the web
  layer. Considering your Service classes and your Dao classes should
 be
  thread safe you will have no problem setting them as instance
  variables in the constructor.
  
  Brandon
  
  On 5/1/05, Gregg D Bolinger [EMAIL PROTECTED] wrote:
   Thanks for the reply.  I actually did something similar to this
 before
   I saw your response.  I made the following class
  
   DaoManagerLoader.java
   public class DaoManagerLoader {
  
   public static final String DAO_XML_PATH =
   com/intrust/anykey/database/dao/iBatis/dao.xml;
   public static DaoManager daoManager = null;
  
   public static DaoManager getInstance() {
   if (daoManager == null){
   System.out.println(Need a new one);
try{
final Reader reader =
   Resources.getResourceAsReader(DAO_XML_PATH);
daoManager =
 DaoManagerBuilder.buildDaoManager(reader);
   }catch(IOException e) {
   e.printStackTrace();
   }
   }else{
   System.out.println(Don't need a new one);
   }
   return daoManager;
   }
   }
  
   And then in my XxxxServiceImpl I do:
  
   daoManager = DaoManagerLoader.getInstance();
  
   That seems to work pretty good.  With that being said, can I ask
   another question. If I have my UserService, UserServiceImpl,
 UserDao,
   and UserDaoImpl all setup like the documentation states, and then
 in
   my application/web application I need to access the UserDAO, is
 it
   appropriate to instantiate it like this
  
UserService userDAO = new UserServiceImpl();
  
   Or am I supposed to do it a differnet way.  I have attached the
 files.
I'd really like to know if I am doing this correctly.  Thanks.
  
   Gregg
  
  
   On 5/2/05, Brandon Goodin [EMAIL PROTECTED] wrote:
Saw a typo! oopsie :-)
   
 I would not place the dao in my base service class.
   
Should be:
I would not place the dao manager in my base service class.
   
On 5/1/05, Brandon Goodin [EMAIL PROTECTED] wrote:
 Hi Gregg,

 The dao manager does not parse it every time. It only parses
 once.

 Also, I would do things a bit different than you are doing. I
 would
 not place the dao in my base service class. I would use a
 DaoConfig
 class that holds the DaoManager reference as an static final
 instance
 variable. I would setup my Service classes to contain
 instance
 variable DAO classes that are loaded via the DaoConfig class
 in the
 constructor. See the examples below.

 --- DaoConfig.java ---
 public class DaoConfig {

   private static final DaoManager daoManager;

   static {

 try {
   String resource =
 org/apache/ibatis/jgamestore/dao/sqlmap/dao.xml;
   Reader reader =
 Resources.getResourceAsReader(resource);
   daoManager = DaoManagerBuilder.buildDaoManager(reader);
 } catch 

RE: ANSI_PADDING

2005-04-29 Thread Ron Grabowski
Have you tried this:

SET ANSI_PADDING=OFF
GO
SELECT * FROM Foo

--- Bitra, Venkateswararao (Corporate, consultant)
[EMAIL PROTECTED] wrote:
 You are right its not an IBATIS question. I just needed to use
 executeUpdate method to execute SET ANSI_PADDING=OFF/ON statement. 
 
 -Original Message-
 From: Ron Grabowski [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, April 26, 2005 9:15 AM
 To: ibatis-user-java@incubator.apache.org
 Subject: RE: ANSI_PADDING
 
 
 How is this an IBatis question? It sounds like you need to contact
 the
 database vendor and find out how to turn it off. If you were using
 straight JDBC, how would you turn padding off?
 
 --- Bitra, Venkateswararao (Corporate, consultant)
 [EMAIL PROTECTED] wrote:
  We never required to turn it off. Because in Pervasive 8.6 by
 default
  it was turned off. But in Pervasive 9 its turned on and we need to
  explicitly turn it off
  
  --Venkat
  
  -Original Message-
  From: Clinton Begin [mailto:[EMAIL PROTECTED]
  Sent: Sunday, April 24, 2005 3:38 PM
  To: ibatis-user-java@incubator.apache.org
  Subject: Re: ANSI_PADDING
  
  
  How do you turn it off without iBATIS?
  
  Clinton
  
  On 4/24/05, Bitra, Venkateswararao (Corporate, consultant)
  [EMAIL PROTECTED] wrote:
   Hi,
   I user IBATIS layer for my Pervasive SQL database.
  Pervasive SQL 9 came up with an option to deal with ANSI_PADDING
  problem with datatype CHAR and VARCHAR. ANSI_PADDING is on by
 default
  in Pervasive. I need to set ANSI_PADDING off for all my
  transactions with Pervasive. Otherwise I have to trim all CHAR and
  VARCHARS. And when I use this trimming in my where clauses I loose
 my
  indexing advantage.
   How can I set this ANSI_PADDING off for all my
  transactions? Your help would be appreciated.
   
   thanks
   
   --Venkat
   
  
  
 


RE: ANSI_PADDING

2005-04-26 Thread Ron Grabowski
How is this an IBatis question? It sounds like you need to contact the
database vendor and find out how to turn it off. If you were using
straight JDBC, how would you turn padding off?

--- Bitra, Venkateswararao (Corporate, consultant)
[EMAIL PROTECTED] wrote:
 We never required to turn it off. Because in Pervasive 8.6 by default
 it was turned off. But in Pervasive 9 its turned on and we need to
 explicitly turn it off
 
 --Venkat
 
 -Original Message-
 From: Clinton Begin [mailto:[EMAIL PROTECTED]
 Sent: Sunday, April 24, 2005 3:38 PM
 To: ibatis-user-java@incubator.apache.org
 Subject: Re: ANSI_PADDING
 
 
 How do you turn it off without iBATIS?
 
 Clinton
 
 On 4/24/05, Bitra, Venkateswararao (Corporate, consultant)
 [EMAIL PROTECTED] wrote:
  Hi,
  I user IBATIS layer for my Pervasive SQL database.
 Pervasive SQL 9 came up with an option to deal with ANSI_PADDING
 problem with datatype CHAR and VARCHAR. ANSI_PADDING is on by default
 in Pervasive. I need to set ANSI_PADDING off for all my
 transactions with Pervasive. Otherwise I have to trim all CHAR and
 VARCHARS. And when I use this trimming in my where clauses I loose my
 indexing advantage.
  How can I set this ANSI_PADDING off for all my
 transactions? Your help would be appreciated.
  
  thanks
  
  --Venkat
  
 
 


Re: select with iterate

2005-04-24 Thread Ron Grabowski
iterate can be used in any statement tag. insert and update are
extensions of the statement tag. For readability and maintainablity,
I would make seperate calls in your dao class. I suppose you could make
up some kind of giant INSERT statment using iterate:

iterate property=idList
INSERT INTO content (ListId, Body) VALUES (#idList[]#, null); 
GO
/iterate

that would generate and execute the following statements:

INSERT INTO content (ListId, Body) VALUES (1, null);
GO
INSERT INTO content (ListId, Body) VALUES (2, null); 
GO
INSERT INTO content (ListId, Body) VALUES (3, null); 
GO

but that looks like it would be more prone to errors...

- Ron

--- Jason Punzalan [EMAIL PROTECTED] wrote:
 Ahh...very helpful. thank you. what about inserts? can you use
 iterate to 
 execute multiple inserts or updates? or do i have to make separate
 calls in 
 my dao class?
 
 
 
 On 4/23/05, Ron Grabowski [EMAIL PROTECTED] wrote:
  
  I believe your code would incorrectly generate the following sql
  statements (all on one line):
  
  select * from content where id = 1
  select * from content where id = 2
  select * from content where id = 3
  ...
  
  Take a look at the these test cases:
  
  http://tinyurl.com/dadn5
  
 

http://svn.apache.org/repos/asf/incubator/ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/DynamicAccount.xml
  
  You probably want to do something like this:
  
  SELECT * FROM content WHERE id IN
  iterate property=idList open=( close=) conjunction=,
  #idList[]#
  /iterate
  
  That would generate this sql:
  
  SELECT * FROM content WHERE id IN (1,2,3)
  
  If you want three seperate queries, your dao class would need to
 make
  three seperate calls to the database.
  
  --- Jason Punzalan [EMAIL PROTECTED] wrote:
   Can someone show me an example of doing a select with iterate? Is
 it
   possible to do the following
  
   statement id=getAllByList resultClass=Content
   parameterClass=Content
   resultMap=content-result 
   dynamic
   iterate property=idList
   select * from content where
   id = #idList[]#
   /iterate
   /dynamic
   /statement
  
   I'm currently getting an java.sql.SQLException...running mysql.
  
   Thanks
  
 
 


Re: select with iterate

2005-04-23 Thread Ron Grabowski
I believe your code would incorrectly generate the following sql
statements (all on one line):

select * from content where id = 1
select * from content where id = 2
select * from content where id = 3
...

Take a look at the these test cases:

http://tinyurl.com/dadn5
http://svn.apache.org/repos/asf/incubator/ibatis/trunk/java/mapper/mapper2/test/com/ibatis/sqlmap/maps/DynamicAccount.xml

You probably want to do something like this:

 SELECT * FROM content WHERE id IN
 iterate property=idList open=( close=)  conjunction=,
  #idList[]#
 /iterate

That would generate this sql:

SELECT * FROM content WHERE id IN (1,2,3)

If you want three seperate queries, your dao class would need to make
three seperate calls to the database.

--- Jason Punzalan [EMAIL PROTECTED] wrote:
 Can someone show me an example of doing a select with iterate? Is it 
 possible to do the following
 
 statement id=getAllByList resultClass=Content
 parameterClass=Content 
 resultMap=content-result 
 dynamic 
 iterate property=idList
 select * from content where
 id = #idList[]#
 /iterate
 /dynamic
 /statement
 
 I'm currently getting an java.sql.SQLException...running mysql.
 
 Thanks
 


Re: LIKE and Wildcards

2005-04-14 Thread Ron Grabowski
Have you tried using CDATA like this (I'd be curious to know if this
works or not):

 isNotEmpty prepend=AND property=description
  ![CDATA[
   xyz
  ]] 
 /isNotEmpty

Maybe I missed this in the other responses to this thread, but does
this work:

 isNotEmpty prepend=AND property=description
  description like '%$description$%'
 /isNotEmpty

--- Nic Werner [EMAIL PROTECTED] wrote:
 I tried the CDATA, but then the isEmpty type statements are not 
 processed and are passed directly to Oracle.


 
 Thanks for all the suggestions, I'll use the overly awkward concat 
 solution that Brandon and Paul mentioned.
 
 - NIc.
 
 Paul Barry wrote:
 
  CDATA is not going to help.  The acutal SQL query that iBATIS will 
  execute is:
 
  SELECT *
  FROM device,person
  where device.owner = person.regid
  and description like %'this is the descirption'%
 
  You can see how that is going to cause a problem.  Change your
 query 
  in the sqlmap to look like this:
 
 
  SELECT *
  FROM device,person
  where device.owner = person.regid
  and description like '%'||%#description#||'%'
 
  Sheehan, Andrew wrote:
 
  Hiya,
 
  Would you be able to use a CDATA section in your where clause?
 
  HTH,
 
  Andrew
 
  -Original Message-
  From: Nic Werner [mailto:[EMAIL PROTECTED] Sent: Wednesday, April
 
  13, 2005 8:57 PM
  To: ibatis-user-java@incubator.apache.org
  Subject: LIKE and Wildcards
 
  Hi again,
  Is there a way to use the 'like' operator and also use
 wildcards? 
  I'm trying to use Oracle with this, and the following does not
 work:
 
  SELECT
  *   FROM device,person
  where device.owner = person.regid
  isNotEmpty prepend=AND property=description
  description like %#description#% 
  (I get invalid symbol)
 
  All examples only use the equivalent of #description# which
 doesn't 
  add anything of value, it is the equivalent of using '='.
 
 
 


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 Ron Grabowski
Correct. The main point I was trying to make was that choice B from my
choices below is the correct way to parse things. 34 and 56 should
remain in the sql being sent to the database. 

This is related to an issue with IBatisNet:

 http://issues.apache.org/jira/browse/IBATISNET-29

I wanted to make sure my explaination and example made sense to other
people besides myself. The issue was marked as Won't Fix on Jira. I
posted more supporting comments on the issue but I wasn't sure those
made the issue any clearer (i.e. its still marked at Won't Fix).

For future reference, is there a better way to go about discussing
issues with IBatis? If I have concerns with an IBatis issue posted in
Jira, it gets marked as Won't Fix, and I'm not able to fix it myself,
is it appropriate to have open discussions on the mailing list(s)?

- Ron

--- Brice Ruth [EMAIL PROTECTED] wrote:
 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
 to
  the database that has a pound sign on either side of it?
  
  According to this post:
  
  http://tinyurl.com/44je6
  
 

http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01358.html
  
  I should use a double pound to send the literal pound. Given this
 sql
  statement:
  
  select parameterClass=map resultClass=string
  SELECT Name FROM Band WHERE Name = '12##34$BandName$56##78'
  /select
  
  Which 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 Ruth
 Software Engineer, Madison WI
 


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-06 Thread Ron Grabowski
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? 

According to this post:

 http://tinyurl.com/44je6
http://www.mail-archive.com/ibatis-user-java@incubator.apache.org/msg01358.html

I should use a double pound to send the literal pound. Given this sql
statement:

 select parameterClass=map resultClass=string
  SELECT Name FROM Band WHERE Name = '12##34$BandName$56##78'
 /select  

Which 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


Re: How to escape special characters (specifically '#')

2005-03-10 Thread Ron Grabowski
Have you tried using two pound signs?

 INSERT INTO ##tempCount
 
--- Narasimha Prasad [EMAIL PROTECTED] wrote:
 Hi 
 
  
 
 Is there a way to escape the ‘#’ characters used in iBATIS SQL maps ?
 The
 reason is ask this is that we are running into a situation where we
 need to
 create
 
 Temporary tables to read from, and they use the # character.  I tried
 enclosing the statement with ![CDATA[ …. ]], but this works only to
 escape
 special
 
 XML characters.
 
  
 
  
 
 Example:
 


 --
 
 BEGIN 
 
   CREATE TABLE #tempCount (id INT NOT NULL, count INT)
 
   
 
   INSERT INTO #tempCount
 
   (id, count)
 
   VALUES
 
   (1,2)
 
   SELECT * FROM #tempCount
 
   DROP TABLE #tempCount
 
 END
 
  
 
  
 
 Any suggestions welcome.
 
  
 
 Thanks,
 
 Prasad


Error message when trying to access SVN wiki link

2005-02-21 Thread Ron Grabowski
When I go to this page in the wiki:

http://tinyurl.com/4njot
http://wiki.apache.org/ibatis/How_20do_20I_20get_20read_2donly_20access_20to_20the_20source_20control_20repository_3f

and follow the first link to access the SVN repository I get the
following error message:

D:error xmlns:D=DAV: xmlns:m=http://apache.org/dav/xmlns;
xmlns:C=svn:
C:error/
m:human-readable errcode=160029
Could not open the requested SVN filesystem
/m:human-readable
/D:error

It took me a while to figure out that I needed to look in the Wiki to
find out how to access the SVN repository. Perhaps a link could be
added on the ibatis.com download page:

http://www.ibatis.com/common/download.html

That provides a link the wiki entry or a link to the SVN repository
itself.

Thanks,
Ron


Re: selectKey for MySql

2005-02-02 Thread Ron Grabowski
I've found that the column alias needs to match the property name:

selectKey resultClass=java.lang.Integer
keyProperty=criteriaConsistId 
SELECT LAST_INSERT_ID() AS criteriaConsistId
/selectKey

--- Clinton Begin [EMAIL PROTECTED] wrote:

 long should work (convenient aliases).  Now, beyond that it is
 completely up to the driver to decide whether it's a legal mapping or
 not.  See, if your JDBC driver maps BIGINT to a BigInteger that's
 fine
 as a preferred type.  Most GOOD drivers will still allow you to call
 getLong() or getInt() and only throw an error if the value has gone
 beyond the legal range of long or int.  This is typical JDBC driver
 behavioursomething MySQL has never been very good at following.
 
 One other thing you might want to try is aliasing the ...
 
  LAST_INSERT_ID() as ID
 
 Or something like that.
 
 Cheers,
 Clinton
 
 On Wed, 2 Feb 2005 08:32:56 -0600, Brice Ruth [EMAIL PROTECTED]
 wrote:
  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: Writing SQL Maps that support both SQL Server and Oracle

2005-01-21 Thread Ron Grabowski
You could use stored procedures. 

I'm starting to port statements originally written for SQL Server over
to Access (with the .Net version of iBatis) and I think I can get away
with defining database specific functions in the properties file that I
define my database information:

settings
add key=userid value=x /
add key=password value=x /
add key=database value=x /
add key=datasource value=x /
add key=getDate value=NOW() /
add key=selectKey value=SELECT @@IDENTITY /
/settings

Then in my sql maps:

insert id=AddressInsert parameterClass=Address
INSERT INTO Address
(
Street, 
City, 
Zip,
DateAdded
)
VALUES
(
#Street#,
#City#,
#Zip#,
${getDate}
)
selectKey property=AddressId type=post resultClass=int
${selectKey}
/selectKey
/insert

Another option would be to maintain database specific copies of your
sql maps :(

- Ron

--- Barnett, Brian W. [EMAIL PROTECTED] wrote:

 We have a web app that runs against SQL Server. All of our SQL maps
 are SQL
 Server compliant. We now have to be able to support Oracle as well.
 (We
 never thought it would happen... a mistake.)
 
 Anyway, we are wondering if anyone has some general guidelines for
 writing
 SQL Maps so that they run against both databases. Before you get
 scared and
 close this email, let me say we're not looking for a list of
 differences
 between the two databases, and how to resolve those differences. We
 already
 have a doc that explains those things.
 
 The first issue we have run into is the CONVERT and CAST functions of
 SQL
 Server. We make use of them in our SQL maps. We are debating on
 whether we
 should take them out and do the conversion or casting in java code or
 pass a
 parameter to the SQL map indicating SQL Server or Oracle and then
 have a
 dynamic element that generates the appropriate CONVERT or CAST
 syntax.
 
 All input is welcome.
 
 Thank you,
 Brian Barnett
 



Example of Solution for N+1 selects for 1:M and M:N and Remappable result sets...

2005-01-02 Thread Ron Grabowski
I saw that iBatis.com has been updated with 2.0.9. I had a hard time
following the snippets on the front page for N+1 selects:

 resultMap...groupBy=prop1,prop2
 result...resultMap=subResultMapForCollectionItems

and remappable result sets:

 select...remapResults=true

Could someone take out the ... and give a more complete example?

Thanks,
Ron