Re: 32k limitations for clob/blob?

2005-06-09 Thread Nathan Maves

Are you sure that your drivers are the most up-to-date available?

http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I 
+use+a+Custom+Type+Handler+with+a+BLOB+or+CLOB%3F


Check at the bottom of the page.

Nathan

On Jun 9, 2005, at 11:47 AM, Henry Lu wrote:

Could you send me an example of TypeHandlers in java? I only find  
some code in .NET.


-Henry

Brandon Goodin wrote:



I don't have any idea off the top of my head. This may be a good
opportunity for you to do it with straight JDBC to see what works and
then look at our TypeHandlers to see how they are translating.

Brandon

On 6/9/05, Henry Lu [EMAIL PROTECTED] wrote:



No, I didn't. However, I got more details on the errors.
1. If I insert into CLOB or LONG as jdbc type with String in  
java, I got

the 32K limitation error.

[java] size=1551138, 1551138
[java] org.springframework.jdbc.UncategorizedSQLException:
(SqlMapClientTem
plate): encountered SQLException [
[java] --- The error occurred in ibatis_map/AccessDB.xml.
[java] --- The error occurred while applying a parameter map.
[java] --- Check the insert_long-InlineParameterMap.
[java] --- Check the parameter mapping for the 'l' property.
[java] --- Cause: java.sql.SQLException: setString can only  
process

strings
of less than 32766 chararacters]; nested exception is
com.ibatis.common.jdbc.ex
ception.NestedSQLException:
[java] --- The error occurred in ibatis_map/AccessDB.xml.
[java] --- The error occurred while applying a parameter map.
[java] --- Check the insert_long-InlineParameterMap.
[java] --- Check the parameter mapping for the 'l' property.
[java] --- Cause: java.sql.SQLException: setString can only  
process

strings
of less than 32766 chararacters

2. If I insert into CLOB or LONG as jdbc type with byte[] in  
java, I got

the following errors:

[java] size=1461140, 1461140
[java] org.springframework.jdbc.UncategorizedSQLException:
(SqlMapClientTem
plate): encountered SQLException [
[java] --- The error occurred in ibatis_map/AccessDB.xml.
[java] --- The error occurred while applying a parameter map.
[java] --- Check the insert_long-InlineParameterMap.
[java] --- Check the statement (update failed).
[java] --- Cause: java.sql.SQLException: ORA-01461: can bind  
a LONG

value o
nly for insert into a LONG column
[java] ]; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLExc
eption:
[java] --- The error occurred in ibatis_map/AccessDB.xml.
[java] --- The error occurred while applying a parameter map.
[java] --- Check the insert_long-InlineParameterMap.
[java] --- Check the statement (update failed).
[java] --- Cause: java.sql.SQLException: ORA-01461: can bind  
a LONG

value o
nly for insert into a LONG column

Any idea?

-Henry


Brandon Goodin wrote:




I'm not aware of this limitation. We have run into similar things
before with the oracle driver. But, upgrading has always fixed it.
Have you attempted a test using straight JDBC?

Brandon

On 6/9/05, Henry Lu [EMAIL PROTECTED] wrote:




I got the following errors when I insert a large text into a  
CLOB in
oracle by using iBatis. How do I resulve it? I am using Oracle  
10G jdbc

deiver.


org.springframework.jdbc.UncategorizedSQLException:
(SqlMapClientTemplate): encountered SQLException [
--- The error occurred in
edu/umich/med/umms/tgsubmission/dao/ibatis_map/ 
tgs_info_trainee.xml.

--- The error occurred while applying a parameter map.
--- Check the Tgs_info_trainee.insert_Tgs_info_trainee_map.
--- Check the parameter mapping for the 'INFO_TEXT' property.
--- Cause: java.sql.SQLException: setString can only process  
strings of

less than 32766 chararacters]; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
edu/umich/med/umms/tgsubmission/dao/ibatis_map/ 
tgs_info_trainee.xml.

--- The error occurred while applying a parameter map.
--- Check the Tgs_info_trainee.insert_Tgs_info_trainee_map.
--- Check the parameter mapping for the 'INFO_TEXT' property.
--- Cause: java.sql.SQLException: setString can only process  
strings of

less than 32766 chararacters
org.springframework.jdbc.UncategorizedSQLException:
(SqlMapClientTemplate): encountered SQLException [
--- The error occurred in
edu/umich/med/umms/tgsubmission/dao/ibatis_map/ 
tgs_info_trainee.xml.

--- The error occurred while applying a parameter map.
--- Check the Tgs_info_trainee.insert_Tgs_info_trainee_map.
--- Check the parameter mapping for the 'INFO_TEXT' property.
--- Cause: java.sql.SQLException: setString can only process  
strings of

less than 32766 chararacters]; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in
edu/umich/med/umms/tgsubmission/dao/ibatis_map/ 
tgs_info_trainee.xml.

--- The error occurred while applying a parameter map.
--- Check the Tgs_info_trainee.insert_Tgs_info_trainee_map.
--- Check the parameter mapping 

Re: Support for generics

2005-05-28 Thread Nathan Maves
Hate to be the rookie, only CVS experience,  but do we have a page the 
explains how to get the source from subversion?



On May 27, 2005, at 9:09 PM, Brandon Goodin wrote:


yes, build it from the trunk.

On 5/27/05, Nathan Maves [EMAIL PROTECTED] wrote:

Of course!

Do I need to build it from the trunk?

Nathan

On May 27, 2005, at 8:32 PM, Clinton Begin wrote:



 I believe the new Mapper binding functionality would resolve 
this


 Nathan, are you up for trying it out?

 Cheers,
 Clinton


On 5/27/05, Nathan Maves [EMAIL PROTECTED] wrote:

gets to the DAO layer.

You can cast the List but you will always get the warning for and
unchecked assignment when the List is returned from the sqlmap.

ListStudent students = (ListStudent)executeQueryForList
(getStudents,null);

Looks good but does not resolve the warnings.

Nathan


On May 27, 2005, at 2:30 PM, Larry Meadors wrote:


I have done that with my DAO layer.

SqlMap returns it as List, but you can cast it.

Worked great. :)

Larry


On 5/27/05, Nathan Maves  [EMAIL PROTECTED] wrote:


Since apple is taking then sweet time I just got Java 1.5.I am
diving in head first but I am curious about what the plans for
Generics are.

Will I batis support them?
Could there be a way to specify the list type instead of Object?

i.e.
return a ListStudent back based on the result class of the 
query?


Nathan













Support for generics

2005-05-27 Thread Nathan Maves
Since apple is taking then sweet time I just got Java 1.5.  I am  
diving in head first but I am curious about what the plans for  
Generics are.


Will I batis support them?
Could there be a way to specify the list type instead of Object?

i.e.
return a ListStudent back based on the result class of the query?

Nathan



Re: Support for generics

2005-05-27 Thread Nathan Maves
Yeah, I have used generics everywhere but the missing link is when it  
gets to the DAO layer.


You can cast the List but you will always get the warning for and  
unchecked assignment when the List is returned from the sqlmap.


ListStudent students = (ListStudent)executeQueryForList 
(getStudents,null);


Looks good but does not resolve the warnings.

Nathan


On May 27, 2005, at 2:30 PM, Larry Meadors wrote:


I have done that with my DAO layer.

SqlMap returns it as List, but you can cast it.

Worked great. :)

Larry


On 5/27/05, Nathan Maves [EMAIL PROTECTED] wrote:


Since apple is taking then sweet time I just got Java 1.5.  I am
diving in head first but I am curious about what the plans for
Generics are.

Will I batis support them?
Could there be a way to specify the list type instead of Object?

i.e.
return a ListStudent back based on the result class of the query?

Nathan








Re: Support for generics

2005-05-27 Thread Nathan Maves
Of course!

Do I need to build it from the trunk?

Nathan

On May 27, 2005, at 8:32 PM, Clinton Begin wrote:

I believe the new Mapper binding functionality would resolve this

Nathan, are you up for trying it out?

Cheers,
Clinton


On 5/27/05, Nathan Maves [EMAIL PROTECTED]> wrote:
gets to the DAO layer.

You can cast the List but you will always get the warning for and
unchecked assignment when the List is returned from the sqlmap. 

ListStudent> students = (ListStudent>)executeQueryForList
(getStudents,null);

Looks good but does not resolve the warnings.

Nathan


On May 27, 2005, at 2:30 PM, Larry Meadors wrote: 

> I have done that with my DAO layer.
>
> SqlMap returns it as List, but you can cast it.
>
> Worked great. :)
>
> Larry
>
>
> On 5/27/05, Nathan Maves  [EMAIL PROTECTED]> wrote:
>
>> Since apple is taking then sweet time I just got Java 1.5.  I am
>> diving in head first but I am curious about what the plans for 
>> Generics are.
>>
>> Will I batis support them?
>> Could there be a way to specify the list type instead of Object?
>>
>> i.e.
>> return a ListStudent> back based on the result class of the query? 
>>
>> Nathan
>>
>>
>



Where are the test cases in the source download

2005-05-23 Thread Nathan Maves

Are these available anywhere?

Also I think the subversion repository on the web is not working.

Nathan


Re: null BLOB and byte array

2005-05-23 Thread Nathan Maves

Paul,

btye[] are objects so having them be null is just fine.

byte[] test = null;

I am not sure if there is a test case written for this yet.

I will look into it.

Nathan
On May 23, 2005, at 8:35 AM, Paul Barry wrote:

I have a BLOB column in my database that can be null.  I want to  
map it to a byte[], but when I do, I get a NullPointerException.   
Anyway have a good way of dealing with this?






Re: How to obtain results looking for a NULL

2005-05-20 Thread Nathan Maves
Ok good example.
Here is how I would acomplish this.
select parameterClass=parameterClass
select
*
from table_name
dynamic prepend=where
isNotNull property=A prepend=and
A = #A#
/isNotNull
isNull property=A prepend=and
A is null
/isNull
isNotNull property=B prepend=and
B = #B#
/isNotNull
isNull property=B prepend=and
B is null
/isNull
/dynamic
/select
This statement will give you 4 different select statements including  
the 2 you are looking for.  Just make sure that you parameterClass  
initializes A and B to null and not .

Nathan
On May 20, 2005, at 2:19 AM, [EMAIL PROTECTED] wrote:
I want that:
#1
if ParameterClass:
object.setA();
object.setB(VALUE B);
then Statement:
SELECT * FROM TABLE WHERE A= AND B=VALUE B
#2
if ParameterClass:
//object.setA();   /** Commmented **/
object.setB(VALUE B);
then Statement:
SELECT * FROM TABLE WHERE A IS NULL AND B=VALUE B
Not this statement. if I use the tag isnotempty iBatis put 
instead IS NULL
SELECT * FROM TABLE WHERE A= AND B=VALUE B

Re: How to obtain results looking for a NULL
Brandon Goodin
Fri, 06 May 2005 13:34:00 -0700
Then i'm not completely sure what you are asking for. Write out your
SQL statement in it's most complex form without tags. Just write
straight SQL. If you do that i think i'll understand what you are
wanting.

Brandon
On 5/5/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
To Brandon Goodin
The prepend=OR doesn't works; and I don't want the next:
Example: A='2' B=null
SELECT A, B FROM ME
WHERE A='2'
OR B IS NULL
I want AND, and then B='3' (for example) or B IS NULL.
Thanks for the answer.
To Brice Ruth
I don't try that, but I supose yes. How can that case be connected
with my
problem?
Thanks for your answer too.





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.

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.




Re: resend iBatis 2.0.9 Dynamic Statement Problem

2005-05-20 Thread Nathan Maves
Not sure if this will fix your problem but you should always declare your parameter class if possible, for performance reasons.  In your case parameterClass="map" should be enough.NathanOn May 20, 2005, at 2:05 PM, Jerry Jalenak wrote:  I'm not sure if this came through the first time or not, so I'm resending it. I apologize in advance if this is a double post. All,  I'm using 2.0.9 w/ a dynamic statement (passing in a Map), but it doesn't appear to be building the PreparedStatement completely.  code      public void getUserInfo(UserInfo ui)         throws SQLException     {         Map m = new HashMap();         m.put("lastName", ui.getLastName() + "%");         m.put("firstName", ui.getFirstName() + "%");         m.put("dob", ui.getDob());         m.put("patientId", ui.getPatientId());          SqlMapClient sqlMap = getSqlMapClient();         try         {             ui = (UserInfo) sqlMap.queryForObject("getUserInformation", m, ui);         }         catch(SQLException sqle)         {}         finally         {             m = null;         }     }  /code  sqlmap      select id="getUserInformation" resultMap="UserInformation"         SELECT ext_patient_id, insured_first_name, insured_last_name, member_ssn, carrier_num, pcs_group_id,             insured_dob, eff_begin_date, eff_end_date, app_addr1, app_addr2, city, state_code, zip_code,             order_received_dte, order_sent_dte, order_status, relation_code         FROM labcard_eligibility         WHERE relation_code = '00' and carrier_num ^= 'UNIVERSAL'         dynamic             isNotEmpty prepend="AND" property="lastName"                 insured_last_name LIKE #lastName#             /isNotEmpty             isNotEmpty prepend="AND" property="firstName"                 insured_first_name LIKE #firstName#             /isNotEmpty             isNotEmpty prepend="AND" property="dob"                 insured_dob = #dob#             /isNotEmpty             isNotEmpty prepend="AND" property="patientID"                 (ext_patient_id = $patientId$ or member_ssn = $patientId$)             /isNotEmpty         /dynamic      /select /sqlmap  log4j output  DEBUG 05/20/2005:11:33:14 - Created connection 5872987. DEBUG 05/20/2005:11:33:14 - {pstm-11} PreparedStatement:    SELECT ext_patient_id, insured_first_name, insured_last_name, member_ssn, carrier_num, pcs_group_id, insured_dob, eff_begin_date, eff_end_date, app_addr1, app_addr2, city, state_code, zip_code, order_received_dte, order_sent_dte, order_status, relation_code    FROM labcard_eligibility   WHERE relation_code = '00' and carrier_num ^= 'UNIVERSAL'   AND insured_last_name LIKE ?    AND insured_first_name LIKE ?  DEBUG 05/20/2005:11:33:14 - {pstm-11} Parameters: [REYNOLDS%, RICHARD%] DEBUG 05/20/2005:11:33:14 - {pstm-11} Types: [java.lang.String, java.lang.String] DEBUG 05/20/2005:11:33:15 - Returned connection 5872987 to pool.  /log4j output  From the DEBUG trace, it looks like it's only substituting the lastName and firstName attributes.  I've stopped the code and inspected the Map, and the other data elements (dob and patientID) are in the Map.  Is this a bug in 2.0.9?  or have I screwed something up?  Thanks!  Jerry Jalenak Senior Programmer / Analyst, Client Management LabOne, Inc. 10101 Renner Blvd. Lenexa, KS  66219 (913) 577-1496 [EMAIL PROTECTED]   This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] 

Re: Very Confused : Part 2 :)

2005-05-18 Thread Nathan Maves
Dave,First off I would try to get things working in a plain old java environment.  This means leave the servlet and web stuff out first.Second off the error you are getting is a common java error.  A NoClassDefFoundError means only one thing, you are missing a jar file.  Make sure that you have all necessary libraries.  My suggestion start back from scratch and use the documentation.If you get stuck feel free to contact me with specific questions/errors.Nathan  On May 18, 2005, at 12:44 PM, Dave Guzda wrote:Hello, Thanks for the replies to my Ibatis inquiry... My OS is Windows 2000, I'm using Java version "1.5.0_03", I do my compiling/coding with Eclipse V3.02. I'm really just interested in getting the most basic query functional and working from there... I'll look at the links already generously supplied in replies to my post, but any *simple* (talk to me like I'm 4 -grin-) examples would also be welcome. I've been trying to get the example in the tutorial working and it grants me a lovely 500 Internal Server Error...type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionjavax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/itest
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:388)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root causejava.lang.NoClassDefFoundError
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  I assume by this error java is looking for something...? Thanks again,Dave

cache question... how smart are they

2005-05-15 Thread Nathan Maves
I have not looked into the source code yet but I want to get some of the
basics questions out there first.

The real question is ...

Does flush really mean flush?  When you have a flush-on-insert setup
does the caches truly flush all elements in the cache?  If so what is
the reason behind doing that?  This question really applies to all of
the flush commands.

I assume that the caches use some sort of java.util.Map to store the
cached objects.  What are they keyed on?


Nathan


begin:vcard
n:Maves;Nathan
fn:Nathan Maves
tel;work:303.272.7456 x77456
version:2.1
email;internet:[EMAIL PROTECTED]
end:vcard



Re: Availability of 2.1.0

2005-05-12 Thread Nathan Maves
Now that we are on the topic.

Is this a bug fix release or a feature release?

In the case that it is a feature release what can we expect?

Nathan

On May 12, 2005, at 9:53 PM, Clinton Begin wrote:

Karen,

A release could be as early as this weekend, but is not guaranteed.

I'm sure if it's not, that we can at least commit to giving you (and everyone else) a date.

Sorry for the lack of clarity here. 

Cheers,
Clinton

On 5/12/05, Karen Koch [EMAIL PROTECTED]> wrote:
can't give you any real answer, that would be helpful.

Also, just to verify, do I understand correctly that the fix for IBATIS-79 in 
Jira will not be available until version 2.1.0 (presumably not released yet) is
released?

Thanks in advance, sorry to be a pest.

Karen
--- Karen Koch [EMAIL PROTECTED] > wrote:
> Date: Fri, 6 May 2005 09:46:59 -0700 (PDT)
> From: Karen Koch [EMAIL PROTECTED]>
> Subject: Availability of 2.1.0
> To: ibatis-user-java@incubator.apache.org
>
> Hello --
>
> I know one person already asked this in mid-April and didn't receive an
> answer,
> so perhaps you just don't know yet... but I'm going to ask anyway. 
>
> I have an iBATIS app that uses nested resultMaps being introduced at a
> customer
> site in the next month or so.  I just spent 7 hours chasing down Jira bug #79
> in my web app ( http://issues.apache.org/jira/browse/IBATIS-79), because I had
> primary keys on two tables related in a nested resultMap that just happened
> to
> be in sync.  Such fun.  :-)
>
> Anyway, I see that this problem has been fixed in 2.1.0.  I'd really like to
> have this fix, as the situation that causes the bug is perfectly valid and
> might occur easily in the future, but I don't see us upgrading to a nightly
> build for something we're going to install at a customer site.  Help?
>
> Thank you so much for any info you can give regarding the 2.1.0 release /
> release date.  iBATIS has been wonderful for this project.  Keep up the great
> work.
>
> Karen Koch
> Programmer/Analyst
> iDC Chicago, IL
>
>
>


New FAQ Posted

2005-05-11 Thread Nathan Maves
I have created a new FAQ about the classic invalid column type error.
Check it out and let me know if I have missed anything.
http://opensource.atlassian.com/confluence/oss/display/IBATIS/ 
What+causes+an+Invalid+column+type+error+with+Oracle%3F

Nathan


BLOB and CLOB FAQ page now restored.

2005-05-04 Thread Nathan Maves
Team,
I have restored the FAQ on one way to use the built in BLOB and CLOB  
Custom Type Handlers (CTH).  I have also added a section near the  
bottom on the to common problems.

- 86 length on the result
- 4000 limit on the result
http://opensource.atlassian.com/confluence/oss/display/IBATIS/How+do+I 
+use+a+Custom+Type+Handler+with+a+BLOB+or+CLOB%3F

Please take a look and feel free to contact me with any suggestions  
or other ways that people use the CTH.

Nathan Maves
[EMAIL PROTECTED]


OT sql problem

2005-04-29 Thread Nathan Maves
Say you had a customer transaction table that held all of the 
transactions for your customers.

Is there any way in one query to pull back the last n number of 
transactions for all customers?

This is only a hypothetical instance Mine is much more difficult :)
Nathan


Re: OT sql problem

2005-04-29 Thread Nathan Maves
hmm let me try and clarify what i need.
Here is the table with the data :
 METRIC_ID FREQUENCY PERIOD ACTUAL TARGET
     -  -  -
 1 1 2005-02-01 00:00:00.0  3  1
 1 1 2005-03-01 00:00:00.0  3  1
 1 1 2005-04-01 00:00:00.0  1  1
 1 2 2005-03-01 00:00:00.0  2  2
 1 2 2005-04-29 11:34:31.0  45 34
I want the query to return the following rows :
 1 1 2005-03-01 00:00:00.0  3  1
 1 1 2005-04-01 00:00:00.0  1  1
 1 2 2005-03-01 00:00:00.0  2  2
 1 2 2005-04-29 11:34:31.0  45 34
Notice that I want the results grouped by frequency.  I also only want 
the two most recent rows based on the period column.

Nathan
On Apr 29, 2005, at 3:54 PM, Larry Meadors wrote:
I presume you mean without using the queryForList(id, parms, skip, 
max) call in iBATIS. ;-)

 Using that it is a snap:
 List topNList = queryForList(Customer.getTransactions, parms, 0, n);
 Without that, depending on the database, it can be done.
 SQL server has a top (n) syntax that you can use, and i think 
Oracle has a rowid that you can use in a nested select (i.e., select 
blah from (select ... ) where rowid = 100 to get the top 100).

 In a db with stored procedures it would be fairly straightforward to 
do, too.

 Larry
On 4/29/05, Nathan Maves [EMAIL PROTECTED] wrote:
transactions for your customers.
Is there any way in one query to pull back the last n number of
transactions for all customers?
This is only a hypothetical instance Mine is much more difficult 
:)

Nathan



Re: CLOBs with Oracle 9i

2005-04-28 Thread Nathan Maves
Francisco,
I think you are correct.  The maximum sixe for a varchar2 is 4000 
characters.  If you need something bigger then that I would look into 
using a CLOB, which has a max of 4GB.

I have not tested it but I believe that you can you the built in CTH in 
iBatis with a CLOB.  Just make sure that your Java type is a String and 
you specify the jdbcType as a CLOB.

Nathan
On Apr 28, 2005, at 9:26 AM, Francisco Leon wrote:

As Richard has already said, the 10g drivers should
work.  If that is not possible or practical in your
environment, however, there is a way to create a
TypeHandler implementation that handles Oracle clobs
using the 9i thin driver and which doesn't suffer from
the 4000 character limit issue.  The caveat is that
you need to be using iBatis in conjunction with the
Spring framework and also need to be running the
queries inside transactions (which is simple if you're
using Spring anyway).
I am using the ojdbc14.jar but connecting with a 
jdbc:oracle:thin url
because i was told that connecting this way doesn't require any 
additional
oracle software.
I have a table with an attribute that uses a CLOB. I need to be able to
insert it (i am using transactions there), query it, search it, etc.
Using spring is really not an option.

The application already runs fine on postgresql. The oracle 9i docs say
varchar2 is limited to 4000 bytes, it doesn't say anything about a jdbc
bug (ok, i don't think they would say it's a bug anyway)
If i can get the same functionality with just replacing ojdbc14.jar 
with
the oracle 10g version i guess that's my answer, i will try it.

If there's any other info you need to help me please let me know.
Thanks



using properties in a sqlmap

2005-04-18 Thread Nathan Maves
Is there a way to use properties from a file in the sqlmap files 
themselves?

We use them in the sqlmap config files but I can not get them to work 
in the maps.

I am trying to use some global constants for some of the caching 
parameters.

Nathan


Re: Problem with BLOB and iBatis 2.0.9b, Oracle 8, Oracle 10g JDBC Drivers

2005-04-12 Thread Nathan Maves
I will make sure to add that error to the FAQ concerning BLOB and CLOB CTH's.

Nathan

On Apr 12, 2005, at 3:40 PM, Larry Meadors wrote:

Cool, thanks for the solution.

Larry

On Apr 12, 2005 3:39 PM, Paul Barry [EMAIL PROTECTED]> wrote:
Explicitly setting jdbcType=BLOB on the resultMap seems to have done
the trick, OCI vs. thin has nothing to do with it.

Paul Barry wrote:
> I just tried installing Oracle 10g Instant Client to use OCI.  I changed
> the URI to jdbc:oracle:oci:@myhost:1521:mysid, but I still get just 86
> bytes.
>
> Paul Barry wrote:
>
>> I am using iBatis 2.0.9b talking to an Oracle database.  Here the
>> specific database version:
>>
>> Oracle8i Enterprise Edition Release 8.1.7.0.0 - 64bit Production
>>
>> Did some googling on using BLOBs with iBATIS and Oracle, and f und this:
>>
>> http://www.mail-archive.com/ibatis-dev@incubator.apache.org/msg00517.html
>>
>> So I went here and downloaded the Oracle 10g JDBC drivers:
>>
>> http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
>>
>> So, I have an object with a byte[] property.  When I map the result of
>> a query that has a BLOB in it to this propery, the length always
>> returns 86.  Am using oracle.jdbc.driver.OracleDriver driver type
>> and  jdbc:oracle:thin:@myhost:1521:mysid for the URI.  Should this
>> work, or is there something else I need to do to get this to work?



Re: Customer Type Handler

2005-03-31 Thread Nathan Maves
I am not sure if this is what you are looking for.
http://wiki.apache.org/ibatis/ 
How_do_I_use_a_Custom_Type_Handler_with_complex_property_%28Type_Safe_En 
umeration%29

Nathan
On Mar 31, 2005, at 7:53 AM, Akins, Greg wrote:
I'm retrieving a integer from a database,
 
the result class has a value which should be an enumerator.
 
I don't necessarily want this enumerator to be a lookup table in the  
database (so I can't use a select attribute on my resultMap).
 
Is this something I should use a CustomTypeHandler for?  If so, could  
anyone point me to some examples, or more information on using a  
CustomerTypeHandler?
 
Greg Akins
Software Engineer
Sony Electronics, STP Systems
724.696.7322 (Sony)
724.696.6147 (AV)
724.454.7790 (Cell)
412.590.3973 (Pager)
 



Re: Struggling with insertion of Clob into the database. PS:

2005-03-25 Thread Nathan Maves
Well I have started on a simple example for the wiki.
http://wiki.apache.org/ibatis/ 
How_do_I_use_a_Custom_Type_Handler_with_a_BLOB_or_CLOB

We have been experiencing some problems with the wiki but this faq seem  
to be working.

More to come on this faq when I get some free time.
Nathan
On Mar 24, 2005, at 11:11 AM, Prashanth Sukumaran wrote:
Hi All,
We need a proper implementation explanation for LOBs with IBatis. I am  
really wasting a lot of
time.  Please advice.

Andrey you are right we need a clear implementation defn for iBatis.   
When i search for IBatis
CLOB in google in dont get any page that gives the proper  
implementation explanation.

Thanks in advance
Prashanth.
--- Andrey Rogov [EMAIL PROTECTED] wrote:
Hi Prashanth,
Some months ago I sent a letter about CLOB supporting to Clinton.
He sad me that LOB where not supported well! He sad, he hoped to solve
this problem with custom type handlers that will allow to deal with
LOBs as I like.
That's why I've been reading LOB's by my 'fingers' ( without iBatis.
), but, also I want to use iBatis in a whole!
Let's ask Clinton about LOB;s support now,
statement id=LobSupport
   is IBatis read Lobs ?
   isEqual property='YES'
   Long Live iBatis !
   /isEqual
   isNotEqual property='YES'
   We want bread  sight  LOBS !
   /isNotEqual
/statement
Andrey.
PS Hi Andrey,
PS I am able to get this working without ibatis this way, the normal  
JDBC way.
PS Do i have to do the same in iBatis in order to get the Large  
String written into CLOB field.

PS Thanks
PS Prashanth
PS --- Andrey Rogov [EMAIL PROTECTED] wrote:
Before updating CLOB object you must create it.
First of all I've got new primary key ( by sequence ), Insert ' '  
into clob simply
insert ' ' into ... clob, and when object was created, write string.

I use Oracle 9i,
classes12.jar.
PS Hi,
PS I am trying to insert a String into a CLOB field into an Oracle  
Database.

PS Can anybody paste the code for this if you have already done  
this.

PS Thanks
PS Prashanth.

PS __
PS Do you Yahoo!?
PS Yahoo! Small Business - Try our new resources site!
PS http://smallbusiness.yahoo.com/resources/

--
regards,
 Andrey  mailto:[EMAIL PROTECTED]

PS __
PS Do You Yahoo!?
PS Tired of spam?  Yahoo! Mail has the best spam protection around
PS http://mail.yahoo.com

--
Ñ óâàæåíèåì,
 Andrey  mailto:[EMAIL PROTECTED]



__
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/



how do you get this error?

2005-03-11 Thread Nathan Maves
I thought ibatis took care of all of this? :)
Caused by: java.sql.SQLException: ORA-02391: exceeded simultaneous 
SESSIONS_PER_USER limit



Re: Bug with CTH and order of a ResultMap

2005-03-07 Thread Nathan Maves
BTW I have updated the FAQ about CTH on the wiki as well.
Nathan
On Mar 8, 2005, at 12:02 AM, Nathan Maves wrote:
Jean-Francois,
You are once again the answer man!
I am not sure how those lines got switched around but that did the 
trick.  After changing about 8 CTH and running my unit tests, 
everything runs perfect.

Nathan
On Mar 7, 2005, at 5:18 PM, Jean-Francois Poilpret wrote:
Hello Nathan,
The answer to this problem is easy: iBATIS ResultGetter is just a 
wrapper
around JDBC ResultSet getter methods.
If you have a look at the JDBC doc, you will see that wasNull() must 
be
called _after_ getXxxx() for one given column, ie, wasNull() will 
tell you
if the _last column you have read_ was null or not (not the column 
you are
about to read).

So you should write your CTH that way:
 public Object getResult(ResultGetter getter) throws SQLException 
{
 int value = getter.getInt();
 if (getter.wasNull())
 return null;
 return TimeZone.findEnumeration(value);
 }

That's all!
By the way, thank you for reporting this problem: I have coded my own 
CTH
the same way, but I could not exhibit this problem because in fact, 
the
current column and the previous column in my own table are not 
nullable.

Cheers
Jean-Francois
-Original Message-
From: Nathan Maves [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 08, 2005 3:48 AM
To: ibatis-user-java@incubator.apache.org
Subject: Re: Bug with CTH and order of a ResultMap
Anyone had a chance to look at this issue yet?
Nathan
On Mar 3, 2005, at 9:46 AM, Nathan Maves wrote:
Team,
I know that this was not the intended way to use CTH but it works 99%
of the time!
The 1% of the time that it fails is really strange.  It will only 
fail
if the column before it in the result map is null.  In the example
below I can get it to work if I move the line

result property=timeZone column=time_zone/
after a result that is NOT null.
I am not sure why this is happening.  I thought that the order of the
result map meant nothing.
Nathan
SqlMapConfig
typeAlias alias=TimeZone
type=giveservice.domain.definitions.TimeZone/
typeHandler javaType=TimeZone
callback=giveservice.dao.ibatis.typeHandler.TimeZoneCTH/
CTH
public class TimeZoneCTH implements TypeHandlerCallback {
public Object getResult(ResultGetter getter) throws SQLException 
{
if (getter.wasNull())
return null;
int value = getter.getInt();
return TimeZone.findEnumeration(value);
}

public void setParameter(ParameterSetter setter, Object 
parameter)
throws SQLException {
if (parameter == null) {
setter.setNull(Types.INTEGER);
} else {
TimeZone param = (TimeZone) parameter;
setter.setInt(param.getDatabaseId());
}
}

public Object valueOf(String s){
return s;
}
}
ResultMap Working
resultMap id=simpleRequestResultMap class=Request
result property=id column=id/
...
result property=partner column=partner/
result property=partnerName column=partner_name/
result property=partnerEmail column=partner_email/
result property=partnerPhone column=partner_phone/
result property=contractNumber column=contract_number/
result property=timeZone column=time_zone/
...
/resultMap
ResultMap NOT Working!  Notice the order in regards to the time_zone
column 
resultMap id=simpleRequestResultMap class=Request
result property=id column=id/
...
result property=partner column=partner/
result property=partnerName column=partner_name/
result property=partnerEmail column=partner_email/
result property=partnerPhone column=partner_phone/
result property=timeZone column=time_zone/
result property=contractNumber column=contract_number/
...
/resultMap






Where to catch DaoException?

2005-02-16 Thread Nathan Maves
Just curious what the best practices about this are.  And since the 
DaoExcpetion is now a runtime you have to explicitly put your try {} 
catch {} blocks somewhere right :)

Here is my setup
Struts Actions (Presentation)
Service Layer (Business Logic) I assume here :)
Dao layer   (Data Access Layer)
Nathan


Re: cache question

2005-02-13 Thread Nathan Maves
Yes I am aware :)
Would you suggest using the same cache for two queries with different 
parameters but the same result objects?

i.e.
getStudentsByAge and a getStudentsByAgeAndGrade
These maps would both return a List of Student objects
Nathan
On Feb 11, 2005, at 4:32 PM, Clinton Begin wrote:
yes.  But please be aware of a critical bug currently affecting
caching by String keys (see JIRA).
It will be fixed as soon as we have SVN available.  !!!
Cheers,
Clinton
On Fri, 11 Feb 2005 15:57:22 -0700, Nathan Maves 
[EMAIL PROTECTED] wrote:
give the select below
select id=getlogById parameterClass=string
resultMap=logResultMap cacheModel=logCache
 select
 *
 from
 GST_log
 where
 id = #value#
 /select
if you call this select with both getQueryForObject and 
getQueryForList
with the caching work correctly?

Nathan




What are the valid jdbcTypes and their default values.

2005-02-13 Thread Nathan Maves
If I can get a list togeter I will post it to the faq's.
I am looking for things like...
#termsAccepted:DATE:NO_ENTRY#
which does not seem to be working for me.
Nathan


Re: N+1 with a twist?

2005-02-11 Thread Nathan Maves
How about 3 levels deep?
A from request
	List of B from products
	List of C from approvals
		User object from users (where user's id maps to a column in the 
approvals table)

Nathan
On Feb 9, 2005, at 10:30 AM, Clinton Begin wrote:
If you can join the data into a single resultset with repeating
groups, the N+1 solution will work, no matter how the collections are
arranged.
As long as you group by some column in table_a, you can separately map
2 collections on the same class.
This will work.
Try it out!
Clinton
On Wed, 09 Feb 2005 10:21:54 -0700, Nathan Maves 
[EMAIL PROTECTED] wrote:
I dont think that the current implementation will work for this but I
was looking for some best practices on how to do it.
Parent Class A has n number of List properties that all come for their
own tables.
A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan




Re: N+1 with a twist?

2005-02-11 Thread Nathan Maves
This was all looking great but I hit a show stopper.
I have one parent table with 3 child tables.  The problem is that the 
child rows might or might not be there.  This means that I have to use 
an outer join to these tables.  Oracle only allows a table to have one 
outer join.  Suck!

Nathan
On Feb 11, 2005, at 1:37 PM, Clinton Begin wrote:
Doesn't matter.  In series, or in parallel, any number of levels, any
time any place.  It will work.
Each resultMap= mapping is treated separately.
The coolest thing is that to do all of this it still only iterates
over the result set a single time...  ;-)
Cheers,
Clinton
On Fri, 11 Feb 2005 12:50:05 -0700, Nathan Maves 
[EMAIL PROTECTED] wrote:
How about 3 levels deep?
A from request
List of B from products
List of C from approvals
User object from users (where user's id maps to a 
column in the
approvals table)

Nathan
On Feb 9, 2005, at 10:30 AM, Clinton Begin wrote:
If you can join the data into a single resultset with repeating
groups, the N+1 solution will work, no matter how the collections are
arranged.
As long as you group by some column in table_a, you can separately 
map
2 collections on the same class.

This will work.
Try it out!
Clinton
On Wed, 09 Feb 2005 10:21:54 -0700, Nathan Maves
[EMAIL PROTECTED] wrote:
I dont think that the current implementation will work for this but 
I
was looking for some best practices on how to do it.

Parent Class A has n number of List properties that all come for 
their
own tables.

A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan





Better Solution for null properties

2005-02-11 Thread Nathan Maves
Is there a better way for dealing with null attributes?
Currently I have to do something like..
insert id=insertA
insert into A (
id
isNotNull prepend=, property=name
name
/isNotNull
) values (
#id#
isNotNull prepend=, property=name
#name#
/isNotNull
)
/insert
or
insert id=insertA
insert into A (
id,
name
) values (
#id#
isNotNull prepend=, property=name
#name#
/isNotNull
isNull prepend=, property=name
null
/isNotNull
)
/insert
This become very tedious when you have 10+ columns that might be null.  
Why does this happen with Oracle?  Is there anyway that iBatis could 
check if the property was null and if so call the setNull() of a 
prepared statement?  I am sure that I am over simplifying the process 
but just thought I would throw it out there.

Nathan


Dao unit testing?

2005-02-10 Thread Nathan Maves
I have been trying for two day to get DBunit to work with only partial 
success.  The support for this project is nonexistent.  Anyone know of 
a more supported project or have any experience with this one?  How do 
most of you test your database layer?

Nathan


Re: Dao unit testing?

2005-02-10 Thread Nathan Maves
Kris,
I am really close to getting everything to work with dbunit.   
Everything works fine from an Ant task. I created my first Junit test  
and this is where the trouble started.

public class UserDaoTest extends DatabaseTestCase {
private static Log log = LogFactory.getLog(UserDaoTest.class);
private DaoManager daoManager = DaoConfig.getDaomanager();
private UserDao userDao = (UserDao)  
daoManager.getDao(UserDao.class);
public UserDaoTest(String testName) {
super(testName);
}

protected IDatabaseConnection getConnection() throws Exception {
log.debug(Creating Connection);
Properties props =  
Resources.getResourceAsProperties(giveservice/resources/ 
database.properties);
SimpleDataSource dataSource = new SimpleDataSource(props);
IDatabaseConnection connection = new  
DatabaseDataSourceConnection(dataSource);
DatabaseConfig config = connection.getConfig();
config.setFeature(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES,  
true);
return connection;
}

protected IDataSet getDataSet() throws Exception {
log.debug(Read DataSet);
return new  
XmlDataSet(Resources.getResourceAsStream(dbunit/GST_USERS.xml));
}

testMothods.
}
Everything runs fine but I can never see the data that should get  
inserted into the db.  Hence all of my test fail!

Does everything look ok to you?
Can you send me any example that is like this?
Nathan
On Feb 10, 2005, at 8:56 AM, Kris Jenkins wrote:
Nathan Maves wrote:
I have been trying for two day to get DBunit to work with only  
partial success.  The support for this project is nonexistent.   
Anyone know of a more supported project or have any experience with  
this one?  How do most of you test your database layer?
I use DBunit, and I'm happy with it.  Have you seen this onjava  
article?

   http://www.onjava.com/pub/a/onjava/2004/01/21/dbunit.html
It got me started pretty quickly.  I could send you some sample files  
from one of my projects if you like, but you'll find that that article  
is much better documented. :-)

Hope that helps,
Kris
--
Kris Jenkins
Email:  [EMAIL PROTECTED]
Blog:   http://cafe.jenkster.com/
Wiki:   http://wiki.jenkster.com/




Re: N+1 with a twist?

2005-02-10 Thread Nathan Maves
Great!  I will give it a try.
What do you suggest when you have ambiguously defined column names in a 
n+1 query?

nathan
On Feb 9, 2005, at 10:30 AM, Clinton Begin wrote:
If you can join the data into a single resultset with repeating
groups, the N+1 solution will work, no matter how the collections are
arranged.
As long as you group by some column in table_a, you can separately map
2 collections on the same class.
This will work.
Try it out!
Clinton
On Wed, 09 Feb 2005 10:21:54 -0700, Nathan Maves 
[EMAIL PROTECTED] wrote:
I dont think that the current implementation will work for this but I
was looking for some best practices on how to do it.
Parent Class A has n number of List properties that all come for their
own tables.
A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan




Re: N+1 with a twist?

2005-02-10 Thread Nathan Maves
That is how I was going to handle them.  I was just looking to see if 
there was some tricky way  to use select * from multiple tables.  I 
have one table that has 30 columns in it.  It is very painful to list 
out each column :)

Nathan
On Feb 10, 2005, at 3:50 PM, Kris A. Jenkins wrote:
Nathan,
Ambiguous column names are easily handled.  Just
differentiate the names in the query, then you can
assign them explicitly in the resultMaps.  Here's an
example with an ambiguous 'name' column:
sqlMap namespace=Example
 resultMap id=parentResult class=com.eg.Parent
groupBy=parentId
  result property=parentId column=parent_id/
  result property=name column=parent_name/
  result property=children
resultMap=Example.childResult/
 /resultMap
 resultMap id=childResult class=com.eg.Child
  result property=name column=child_name/
  result property=description
column=description/
column=broadcastEndDate/
 /resultMap
 select id=getFamilies resultMap=parentResult
  select
p.id AS parent_id,
p.name AS parent_name,
c.name AS child_name,
c.desc AS description
  FROM child c, parent p
  WHERE p.id = c.parent_id
/select
/sqlMap
In this example both the column and the property names
are ambiguous, but it's gracefully handled. :-)
HTH,
Kris
 --- Nathan Maves [EMAIL PROTECTED] wrote:
Great!  I will give it a try.
What do you suggest when you have ambiguously
defined column names in a
n+1 query?
nathan
On Feb 9, 2005, at 10:30 AM, Clinton Begin wrote:
If you can join the data into a single resultset
with repeating
groups, the N+1 solution will work, no matter how
the collections are
arranged.
As long as you group by some column in table_a,
you can separately map
2 collections on the same class.
This will work.
Try it out!
Clinton
On Wed, 09 Feb 2005 10:21:54 -0700, Nathan Maves
[EMAIL PROTECTED] wrote:
I dont think that the current implementation will
work for this but I
was looking for some best practices on how to do
it.
Parent Class A has n number of List properties
that all come for their
own tables.
A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan



	
	
		
___
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com



Re: N+1 with a twist?

2005-02-10 Thread Nathan Maves
PERFECT!
On Feb 10, 2005, at 4:07 PM, Mike Fagan wrote:
If you are using oracle the following is legal:
select p.*, c.name child_name, c.description
from parent p, child c
WHERE p.id = c.parent_id;
Nathan Maves wrote:
That is how I was going to handle them.  I was just looking to see if 
there was some tricky way  to use select * from multiple tables.  I 
have one table that has 30 columns in it.  It is very painful to list 
out each column :)

Nathan
On Feb 10, 2005, at 3:50 PM, Kris A. Jenkins wrote:
Nathan,
Ambiguous column names are easily handled.  Just
differentiate the names in the query, then you can
assign them explicitly in the resultMaps.  Here's an
example with an ambiguous 'name' column:
sqlMap namespace=Example
 resultMap id=parentResult class=com.eg.Parent
groupBy=parentId
  result property=parentId column=parent_id/
  result property=name column=parent_name/
  result property=children
resultMap=Example.childResult/
 /resultMap
 resultMap id=childResult class=com.eg.Child
  result property=name column=child_name/
  result property=description
column=description/
column=broadcastEndDate/
 /resultMap
 select id=getFamilies resultMap=parentResult
  select
p.id AS parent_id,
p.name AS parent_name,
c.name AS child_name,
c.desc AS description
  FROM child c, parent p
  WHERE p.id = c.parent_id
/select
/sqlMap
In this example both the column and the property names
are ambiguous, but it's gracefully handled. :-)
HTH,
Kris
 --- Nathan Maves [EMAIL PROTECTED] wrote:
Great!  I will give it a try.
What do you suggest when you have ambiguously
defined column names in a
n+1 query?
nathan
On Feb 9, 2005, at 10:30 AM, Clinton Begin wrote:
If you can join the data into a single resultset
with repeating
groups, the N+1 solution will work, no matter how
the collections are
arranged.
As long as you group by some column in table_a,
you can separately map
2 collections on the same class.
This will work.
Try it out!
Clinton
On Wed, 09 Feb 2005 10:21:54 -0700, Nathan Maves
[EMAIL PROTECTED] wrote:
I dont think that the current implementation will

work for this but I
was looking for some best practices on how to do

it.
Parent Class A has n number of List properties

that all come for their
own tables.
A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan



   
___
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com






N+1 with a twist?

2005-02-09 Thread Nathan Maves
I dont think that the current implementation will work for this but I 
was looking for some best practices on how to do it.

Parent Class A has n number of List properties that all come for their 
own tables.

A from table_a
List of B from table_b
List of C from table_c
.
.
.
Nathan


Re: Problems with implicit HashMap result mapping

2005-01-26 Thread Nathan Maves
Anyone get a chance to look at this yet?
On Jan 25, 2005, at 3:36 PM, Nathan Maves wrote:
Here is our sqlmap query
select id=getShipped resultClass=java.util.HashMap
select al1.parts__t as part, SUM(al1.qty_despatched) as shipped
from despatch AL1, despatch_header AL2
where AL1.despatch_note__T = al2.despatch_note__T and
trunc(AL2.despatch_date,'MON') = 
add_months(trunc(sysdate,'MON'),-1)
AND AL1.request_orig in ('BRR','CM')
group by al1.parts__t
 /select

And the logs
DEBUG 01-25 13:32:39 Created connection 23667197. 
(SimpleDataSource.java:480)
DEBUG 01-25 13:32:39 {conn-10} Connection  
(ConnectionLogProxy.java:24)
DEBUG 01-25 13:32:39 {pstm-11} PreparedStatement: select 
al1.parts__t as part,  SUM(al1.qty_despatched) as shipped
from despatch AL1, despatch_header AL2 where AL1.despatch_note__T = 
al2.despatch_note__T and trunc(AL2.despatch_date,'MON') = 
add_months(trunc(sysdate,'MON'),-1) AND AL1.request_orig in 
('BRR','CM') group by al1.parts__t (PreparedStatementLogProxy.java:30)
DEBUG 01-25 13:32:39 {pstm-11} Parameters: [] 
(PreparedStatementLogProxy.java:31)
DEBUG 01-25 13:32:39 {pstm-11} Types: [] 
(PreparedStatementLogProxy.java:32)
DEBUG 01-25 13:36:20 {rset-12} ResultSet  
(ResultSetLogProxy.java:25)
DEBUG 01-25 13:36:21 {rset-12} Header: [, PART] 
(ResultSetLogProxy.java:45)
DEBUG 01-25 13:36:21 {rset-12} Result: [100-6889, 44] 
(ResultSetLogProxy.java:49)
DEBUG 01-25 13:36:21 {rset-12} Result: [100-7192, 1] 
(ResultSetLogProxy.java:49)
DEBUG 01-25 13:36:21 {rset-12} Result: [100-7270, 7] 
(ResultSetLogProxy.java:49)

Why is the first field null in the Header of the ResultSet?  PART 
should be the first element in the header.

Nathan



selectKey problem

2005-01-21 Thread Nathan Maves
using the statement below we are getting an invalid column type error.  The Log class has a String property named id, and the oracle sequence works fine.

insert id=insertMetricLog parameterClass=Log>
    selectKey resultClass=string keyProperty=id>
    select SD_METRIC_LOG_CURRENT_ID.nextval as id from dual
    /selectKey>
    insert into SD_METRIC_LOG (
    id,
    emp_id,
    modified_date,
    dashboard_id,
    category_id,
    metric_id,
    log
    ) values (
    #id#,
    #employeeNumber#,
    SYSDATE,
    (select dashboard_id from SD_CATEGORY where id = 
    (select category_id from SD_METRIC where id = #metricId#)),
    (select category_id from SD_METRIC where id = #metricId#),
    #metricId#,
    #log#
    )
  /insert>

Nathan

Re: Strange problems with Custom Type Handler

2005-01-20 Thread Nathan Maves
here is my latest getter in the CTH
public Object getResult(ResultGetter getter) throws SQLException {
if (getter.wasNull())
return null;
int value = getter.getInt();
Frequency frequency = Frequency.get(value);
return frequency;
}
when I run the query from sqlplus I get a 1 for the frequency_id field.
but in the code above I get a value of 0 from the getter object.
Nathan
On Jan 20, 2005, at 2:16 PM, Nathan Maves wrote:
I tried that just now and not change.
On Jan 20, 2005, at 2:01 PM, Clinton Begin wrote:
result column=frequency_id property=frequency
typeHandler=reporting.viewer.dao.ibatis.FrequencyTypeHandler/




Nit Picky Question

2005-01-18 Thread Nathan Maves
Why is there not a method like
public List executeQueryForList(String mapName) {
return executeQueryForList(mapName,null);
}
Just looks kinda bad that you have to put in null when thery are no 
parameters.

Nathan


Re: 2.0.9 CLOB

2005-01-11 Thread Nathan Maves
Yes,
Download the newest jdbc drivers from oracle.  That will fix the 4kb 
problem.

Nathan
On Jan 10, 2005, at 3:09 PM, Mitchell, Steve wrote:
Can the new Default CLOB/BLOB Handlers in 2.0.9 be used with Oracle 
9i? I looked in http://issues.apache.org/jira/browse/IBATIS-4 for 
iBATISClob.zip, but I didn't find the ZIP file there.  I tried using 
the 2.0.9 default CLOB Handler with Oracle, but it only works with 
data less than 4 KB.  If I have more than 4 KB of data I get 
java.sql.SQLException: Data size bigger than max size for this type: 
.

My mapping looks like this:
	insert id=insertProductRequirement 
parameterClass=com.serff.prl.core.ProductRequirement
		INSERT INTO
		PRODUCT_REQ (PRODUCT_REQ_ID, DESCRIPTION, FILING_TYPES,
		PRODUCT_ID, PRODUCT_REQ_CAT_ID, SERFF_STATE_ID, DATE_LAST_MODIFIED, 
USER_LAST_MODIFIED, DATE_CREATED, USER_CREATED)
		VALUES (#id:NUMERIC#, #description:CLOB#, #filingTypes:VARCHAR#,
		#product.id:NUMERIC#, #productRequirementCategory.id:NUMERIC#, 
#state.id:NUMERIC#, #lastModified#, #userLastModified:VARCHAR#, 
#dateCreated#, #userCreated:VARCHAR#)
	/insert





Re: Default CLOB/BLOB Handlers in 2.0.9

2005-01-10 Thread Nathan Maves
Steve,
I use the 2.0.9 version with Oracle9i Enterprise Edition Release 
9.2.0.2.0.  I have never tried CLOB's but I use BLOB's all the time and 
they are all larger then 4k.

I would suggest not specifying the type and let iBatis figure it out 
for you.  I assume that the description field is a java.lang.String.

Nathan
On Jan 10, 2005, at 3:41 PM, [EMAIL PROTECTED] wrote:
Can the new Default CLOB/BLOB Handlers in 2.0.9 be used with Oracle 
9i? I looked in http://issues.apache.org/jira/browse/IBATIS-4 for 
iBATISClob.zip, but I didn't find the ZIP file there.  I tried using 
the 2.0.9 default CLOB Handler with Oracle, but it only works with 
data less than 4 KB.  If I have more than 4 KB of data I get 
java.sql.SQLException: Data size bigger than max size for this type: 
.

 My mapping looks like this:
     insert id=insertProductRequirement 
parameterClass=com.serff.prl.core.ProductRequirement
         INSERT INTO
         PRODUCT_REQ (PRODUCT_REQ_ID, DESCRIPTION, FILING_TYPES,
         PRODUCT_ID, PRODUCT_REQ_CAT_ID, SERFF_STATE_ID, 
DATE_LAST_MODIFIED, USER_LAST_MODIFIED, DATE_CREATED, USER_CREATED)
         VALUES (#id:NUMERIC#, #description:CLOB#, 
#filingTypes:VARCHAR#,
         #product.id:NUMERIC#, 
#productRequirementCategory.id:NUMERIC#, #state.id:NUMERIC#, 
#lastModified#, #userLastModified:VARCHAR#, #dateCreated#, 
#userCreated:VARCHAR#)
     /insert





Re: How to include code examples in the wiki?

2005-01-05 Thread Nathan Maves
I read that but did not see how to place java or xml code inline.
On Jan 5, 2005, at 2:38 PM, Larry Meadors wrote:
http://wiki.apache.org/ibatis/HelpOnFormatting
On Wed, 05 Jan 2005 14:34:21 -0700, Nathan Maves 
[EMAIL PROTECTED] wrote:
I wanted to update/add some things to the wiki but how do you format
code/xml in the text?



Re: oracle sequence trouble

2005-01-05 Thread Nathan Maves
This one is really stumping me.  Anyone else ever had such a problem?  
This seems so trivial but it is hold up a ton of development :)

On Jan 5, 2005, at 12:24 PM, Nathan Maves wrote:
I jest created this sequence today and I works fine from the command 
line but it returns null from ibatis.  Are there any tricks when using 
sequences?

Here are the logs...
DEBUG 01-05 12:21:56 Checked out connection 10110166 from pool.  
(SimpleDataSource.java:563)
DEBUG 01-05 12:21:56 {conn-100087} Connection  
(ConnectionLogProxy.java:42)
DEBUG 01-05 12:21:56 {pstm-100088} PreparedStatement:  select 
CurrentId.NextVal from dual   (PreparedStatementLogProxy.java:48)
DEBUG 01-05 12:21:56 {pstm-100088} Parameters: []  
(PreparedStatementLogProxy.java:49)
DEBUG 01-05 12:21:56 {pstm-100088} Types: []  
(PreparedStatementLogProxy.java:50)
DEBUG 01-05 12:21:56 {rset-100089} ResultSet  
(ResultSetLogProxy.java:41)
DEBUG 01-05 12:21:56 Returned connection 10110166 to pool.  
(SimpleDataSource.java:527)

Here is from the command line...
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
With the Partitioning and Oracle Data Mining options
JServer Release 9.2.0.2.0 - Production
SQL select CurrentId.NextVal from dual;
   NEXTVAL
--
 20025
SQL exit
They are both using the same user/passwd.



Type Handler Exception in xml parser

2005-01-04 Thread Nathan Maves
Here is the error..
Exception in thread main java.lang.ExceptionInInitializerError
at  
reporting.viewer.service.ReportService.init(ReportService.java:30)
at  
reporting.viewer.service.ReportService.clinit(ReportService.java:26)
at reporting.viewer.util.DataBaseLoader.main(DataBaseLoader.java:27)
Caused by: com.ibatis.dao.client.DaoException: Error while configuring  
DaoManager.  Cause: java.lang.RuntimeException: Error occurred.  Cause:  
com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:  
org.xml.sax.SAXParseException: Element sqlMapConfig does not allow  
typeHandler here.
Caused by: org.xml.sax.SAXParseException: Element sqlMapConfig does  
not allow typeHandler here.
Caused by: java.lang.RuntimeException: Error occurred.  Cause:  
com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:  
org.xml.sax.SAXParseException: Element sqlMapConfig does not allow  
typeHandler here.
Caused by: org.xml.sax.SAXParseException: Element sqlMapConfig does  
not allow typeHandler here.
at  
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(X 
mlDaoManagerBuilder.java:126)
at  
com.ibatis.dao.client.DaoManagerBuilder.buildDaoManager(DaoManagerBuilde 
r.java:59)
at reporting.viewer.dao.DaoConfig.clinit(DaoConfig.java:35)
... 3 more
Caused by: java.lang.RuntimeException: Error occurred.  Cause:  
com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause:  
org.xml.sax.SAXParseException: Element sqlMapConfig does not allow  
typeHandler here.
Caused by: org.xml.sax.SAXParseException: Element sqlMapConfig does  
not allow typeHandler here.
at  
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConf 
igParser.java:80)
at  
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConf 
igParser.java:68)
at  
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapCli 
entBuilder.java:78)
at  
com.ibatis.dao.engine.transaction.sqlmap.SqlMapDaoTransactionManager.con 
figure(SqlMapDaoTransactionManager.java:52)
at  
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseTransactionM 
anager(XmlDaoManagerBuilder.java:190)
at  
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.parseContext(XmlD 
aoManagerBuilder.java:154)
at  
com.ibatis.dao.engine.builder.xml.XmlDaoManagerBuilder.buildDaoManager(X 
mlDaoManagerBuilder.java:99)
... 5 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.   
Cause: org.xml.sax.SAXParseException: Element sqlMapConfig does not  
allow typeHandler here.
Caused by: org.xml.sax.SAXParseException: Element sqlMapConfig does  
not allow typeHandler here.
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
at  
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConf 
igParser.java:77)
... 11 more
Caused by: org.xml.sax.SAXParseException: Element sqlMapConfig does  
not allow typeHandler here.
at org.apache.crimson.parser.Parser2.error(Parser2.java:3354)
at  
org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume(Val 
idatingParser.java:349)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1497)
at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at  
org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at  
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.ja 
va:185)
at  
com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java: 
148)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:48)
... 12 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

here is the sqlMapConfig file...
?xml version=1.0 encoding=UTF-8 standalone=no?
!DOCTYPE sqlMapConfig PUBLIC -//iBATIS.com//DTD SQL Map Config  
2.0//EN http://www.ibatis.com/dtd/sql-map-config-2.dtd;

sqlMapConfig
  settings
cacheModelsEnabled=true
enhancementEnabled=true
maxSessions=64
maxTransactions=8
maxRequests=128
useStatementNamespaces=false/
  transactionManager type=JDBC
dataSource type=SIMPLE
property name=JDBC.Driver  
value=oracle.jdbc.driver.OracleDriver/
property name=JDBC.ConnectionURL  
value=jdbc:oracle:thin:@oradevdb1.central.sun.com:1541:DEVLAM/
!--property name=JDBC.ConnectionURL  
value=jdbc:oracle:thin:@datastore.central.sun.com:1525:UBRRPTAM/--
property name=JDBC.Username value=WEBAPPS_APP/
property name=JDBC.Password value=WEBAPPS_APP/
!--Optional Properties --
property name=Pool.MaximumActiveConnections value=20/
property name=Pool.MaximumIdleConnections value=3/
/dataSource
  /transactionManager

  typeHandler 

Different twist on complex properities

2004-12-23 Thread Nathan Maves
Team,
I was curious if anyone has used a Type Safe Enumeration as a complex 
property of a class.

I have a class Report that needs to have a property named Frequency.
In the database this is stored as a number.  (1-daily, 2-weekly ...)
But I would like to use a Type Safe Enumeration for this attribute in 
the class.  If anyone has any good ideas on how to accomplish this 
please let me know.

Nathan


resultset map aliases

2004-12-01 Thread Nathan Maves
Any thought to adding java.util.HashMap to the default  type aliases 
since it is a supported type.

Nathan


Re: resultset map aliases

2004-12-01 Thread Nathan Maves
well I found that there is a alias to java.util.Map on page 21 but why 
is it not listed on page 29 in the table of supported types for 
parameter maps?

I still would like to know about a type alias for hashmap.
Nathan
On Dec 1, 2004, at 2:55 PM, Nathan Maves wrote:
Any thought to adding java.util.HashMap to the default  type aliases 
since it is a supported type.

Nathan