Re: Problem in resultMap:Cause: java.sql.SQLException: Invalid state, the ResultSet object is closed
I noticed there are only two tables involved, could you try with some different database engine ? If you still get similar exception, one should start inspecting your code/iBatis code, if not, definitely it's a driver/db server problem (try different driver)...
Re: iBATIS querying pattern for web applications
Can your query raise exception that's handled elsewhere, so that session.close() is not called? Try this: SqlMapSession session = sqlMap.openSession(); List list = null; try { list = (List) session.queryForList(queryId); } catch (Exception e) { log. } finally { session.close(); } On Tue, May 27, 2008 at 6:09 PM, Filipe David Manana [EMAIL PROTECTED] wrote: Hello, I am developing a webapp and using iBATIS for the first time. I configured iBATIS to use a JDBC transaction manager and a JNDI datasource, provided by Tomcat+DBCP. When my webapp is deployed, a Servlet executes and initializes iBATIS : SqlMapClient sqlMap = null; Reader reader = null; try { reader = Resources.getResourceAsReader(configFile); } catch( Exception ex ) { String error = Could not get Reader for iBATIS config file: + ex; log.fatal(error); throw new DatabaseException(error); } try { sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); } catch( Exception ex ) { String error = Could not create iBATIS SqlMapClient object: + ex; log.fatal(error); throw new DatabaseException(error); } This initialization is done only once. For each http request, I use the sqlMap object to get a new session, execute select queries (through queryForList method) and close the session. The pattern is like this: SqlMapSession session = sqlMap.openSession(); List list = null; list = (List) session.queryForList(queryId); session.close(); Although I frequently get the SQLException : java.sql.SQLException: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit Am I doing something wrong? I am the only user. My Tomcat+DBCP configuration is supposedly ok, as it is the same I used for another application (using Hibernate and same Database Server). It seems to me that iBATIS is somehow not releasing the DB connections. I am using iBATIS 2.3.0 cheers -- Filipe David Manana, [EMAIL PROTECTED] First they ignore you, then they laugh at you, then they fight you, then you win.
Re: Mapping HSQLDB's binary using iBatis
I'm inserting images into MS Sql (table field type is image i.e. variable-length binary data) without problems with no special configuration. I have an Image class with two properties String imageID byte[] imageBytes and the insert looks like insert id='insertImage' parameterClass='Image' insert into images (ImageID,image) values ( #imageID#,#imageBytes#) /insert Maybe you should try different DB engine to identify whether it's DB/jdbc driver issue or your app/configuration problem? On Tue, May 27, 2008 at 6:32 PM, Jonathan Alvarsson [EMAIL PROTECTED] wrote: Okey this was a really long time ago but attempt to circumvent this is not working. I really need the BINARY data type in the database because I need to perform bitwise and during a query (btw: would you do that in a stored procedure?). I am using HSQLDB for the moment and I see that they use byte[] for internal representation of a binary so I thought I would try that but that was of course not the way to go. How do I insert to a binary column using iBatis? It must be possible to do somehow right? On Fri, Sep 28, 2007 at 5:35 PM, Yee, Richard K CTR DMDC [EMAIL PROTECTED] wrote: What does the code look like that you are using to call the sqlMap.insert() with? It looks like you are passing in a string for the byte[] -Richard -Original Message- From: Jonathan Alvarsson [mailto:[EMAIL PROTECTED] Sent: Friday, September 28, 2007 4:56 AM To: user-java@ibatis.apache.org Subject: Mapping HSQLDB's binary using iBatis I am trying persist a serializable object to hsqldb's binary datatype. I am currently building a byte[] but obviously there is no iBatis standard type handler for this operation because I get the following errorwhen trying to persist: org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in sqlMap.xml. --- The error occurred while applying a parameter map. --- Check the Structure.insertWithoutLibrary-InlineParameterMap. --- Check the statement (update failed). --- Cause: java.sql.SQLException : Wrong data type: java.io.IOException: hexadecimal string contains non hex character in statement [ INSERT INTO Structure ( id, baseObject, smiles, fingerPrintString, molecule )VALUES ( '07bdad55-1433-4b12-8446-aa7d0fe644f9', '07bdad55-1433-4b12-8446-aa7d0fe644f9', '', '', '[ [EMAIL PROTECTED]' ); ] Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in sqlMap.xml. --- The error occurred while applying a parameter map. --- Check the Structure.insertWithoutLibrary-InlineParameterMap . --- Check the statement (update failed). --- Cause: java.sql.SQLException: Wrong data type: java.io.IOException: hexadecimal string contains non hex character in statement [ INSERT INTO Structure ( id, baseObject, smiles, fingerPrintString, molecule )VALUES ( '07bdad55-1433-4b12-8446-aa7d0fe644f9', '07bdad55-1433-4b12-8446-aa7d0fe644f9', '', '', '[ [EMAIL PROTECTED]' ); ] How can I make this work? -- // Jonathan -- // Jonathan
Re: iBATIS querying pattern for web applications
Can you look from another side, i.e. check database sessions when the the exception occurs. I'd look at last sql executed in those sessions to find if there's same sql that's stuck or long running. It could tell you which part of your code to check... Last time I've seen that exception it was pure JDBC where a guy forgot to close a statement and most of sleeping database connections showed that statement was the last one. On Tue, May 27, 2008 at 7:08 PM, Filipe David Manana [EMAIL PROTECTED] wrote: Not really. I was catching exceptions, just omitted them in the email for the sake of shortness :). So, the possibility of leaving sessions open is strange, as there are no more than 1 request at a time, as the queries are very simple and with small result sets, so the life period of sessions should be very short, less than a few seconds maybe. On Tue, May 27, 2008 at 4:28 PM, Nicholoz Koka Kiknadze [EMAIL PROTECTED] wrote: Can your query raise exception that's handled elsewhere, so that session.close() is not called? Try this: SqlMapSession session = sqlMap.openSession(); List list = null; try { list = (List) session.queryForList(queryId); } catch (Exception e) { log. } finally { session.close(); } On Tue, May 27, 2008 at 6:09 PM, Filipe David Manana [EMAIL PROTECTED] wrote: Hello, I am developing a webapp and using iBATIS for the first time. I configured iBATIS to use a JDBC transaction manager and a JNDI datasource, provided by Tomcat+DBCP. When my webapp is deployed, a Servlet executes and initializes iBATIS : SqlMapClient sqlMap = null; Reader reader = null; try { reader = Resources.getResourceAsReader(configFile); } catch( Exception ex ) { String error = Could not get Reader for iBATIS config file: + ex; log.fatal(error); throw new DatabaseException(error); } try { sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); } catch( Exception ex ) { String error = Could not create iBATIS SqlMapClient object: + ex; log.fatal(error); throw new DatabaseException(error); } This initialization is done only once. For each http request, I use the sqlMap object to get a new session, execute select queries (through queryForList method) and close the session. The pattern is like this: SqlMapSession session = sqlMap.openSession(); List list = null; list = (List) session.queryForList(queryId); session.close(); Although I frequently get the SQLException : java.sql.SQLException: ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit Am I doing something wrong? I am the only user. My Tomcat+DBCP configuration is supposedly ok, as it is the same I used for another application (using Hibernate and same Database Server). It seems to me that iBATIS is somehow not releasing the DB connections. I am using iBATIS 2.3.0 cheers -- Filipe David Manana, [EMAIL PROTECTED] First they ignore you, then they laugh at you, then they fight you, then you win. -- Filipe David Manana, [EMAIL PROTECTED] First they ignore you, then they laugh at you, then they fight you, then you win.
Inserting lists
/* I apologize for re-posting this, but I think my previous post ended in junk folders because I was using all-numeric mailbox */ Recently I found that I'm writing loops to insert lists of objects way too often. I think it makes sense implementing methods like: insertList(insertSingleSomeObject,ListSomeObject)(with insertSingleSomeObject beeing sqlmap entry for inserting single object, which I have to use in loops) batchInsert(insertSingleSomeObject,ListSomeObject) (with batch size configurable like row prefetch is) updateList(updateSingleSomeObject,ListSomeObject) batchUpdate(updateSingleSomeObject,ListSomeObject) Think it will make iBatis more consistent: we have queryForList, i.e. getting list of objects in a single line of code, so it's quite natural to expect that one should be able to persist the list in a single call. Wonder what others think about it. Nicholoz Koka Kiknadze
Re: Inserting lists
Jeff, Just for an argument ;) -- you are understating powers of iBatis ;) iBatis can return list of objects running multiple susbselects for each row (property column= select= / ) - something you'd have to do manually in pure JDBC. In fact, I'd go further allowing inserting object with list properties in a single sqlmap method using somethimg similar to subselects, but thats another story. I understand you philosophy, but I'm trying to look from practical point of view - the less boilerplate code in my app, the happier I am, quite a selfish approach ;)
Re: Help with what commitRequired=true param means
Here's extract from iBatis docs: *Normally iBATIS will not commit transactions unless an insert, update, or delete operation has been performed. This is true even if you explicitly call the commitTransaction() method. This behavior creates problems in some cases. If you want iBATIS to always commit transactions, even if no insert, update, or delete operation has been performed, then set the value of the commitRequired attribute to true. Examples of where this attribute is useful include: 1. If you call a stored procedures that updates data as well as returning rows. In that case you would call the procedure with the queryForList() operation – so iBATIS would not normally commit the transaction. But then the updates would be rolled back. 2. In a WebSphere environment when you are using connection pooling and you use the JNDI dataSource and the JDBC or JTA transaction manager. WebSphere requires all transactions on pooled connections to be committed or the connection will not be returned to the pool. Note that the commitRequired attribute has no effect when using the EXTERNAL transaction manager. * So it does not explain why your transactions are not commited with commitRequired=false if you do call commitTransactio() after insert/update/delete (and I think you do not care about commiting after selects). Could you provide sample transaction code from your app which you suspect does not commit ? On Tue, Jun 10, 2008 at 5:26 PM, jlaur [EMAIL PROTECTED] wrote: Hi, We are using Ibatis vs 2.2.0, and are going thru the process of updating our db to Oracle 10g. We are noticing behavior (after the upgrade) in our test env where our ibatis transactions do not commit. Through some research on the internet, we discovered that we were not providing the commitRequired=true param to the transaction manager config found in the sql-map-config.xml file. When we did provide this param setting, the transactions handled by ibatis would then commit. transactionManager type=JDBC commitRequired=true !--Oracle DataSource -- dataSource type=JNDI property name=DataSource value=${urlOracle}/ property name=Driver.SetBigStringTryClob value=true / /dataSource /transactionManager My question is : What exactly does this param signify, and were we correct in its application for the problem described above ? Thanks greatly for your help, Regards, Jason. -- View this message in context: http://www.nabble.com/Help-with-what-%22commitRequired%3Dtrue%22-param-means-tp17755411p17755411.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Help with what commitRequired=true param means
First of all I'd add catch block to log errors to your try/finally. In your code you do multiple inserts, so if any of them fails your whole transaction will roll back. I can see no other possible scenario :(
Re: Subtle bug in Abator and iBatis
wildcard parameter like qu* Should not it be Like qu% ? Turn on logging for connection and iBatis and check what SQL is actually executed and whether it returns anything when executed from TOAD. On Wed, Jun 18, 2008 at 3:13 AM, [EMAIL PROTECTED] wrote: Dear sir(s): Currently I am working with iBatis with Oracle 10g as the backend. I have a number of jsps or Web pages which take various input parameters in the format of ## where represents the dataitem from the Javascript. In my sqlmap, there is a complex join involving nested SELECT statements. The nesting works fine as one of them is used for grouping a result set of no more than 500 rows at a time. This works fine. The main problem with the sqlmap is that part of the SELECT statment involves a composite join between three Oracle tables/views. By using the backend utility TOAD, I can see all the individual columns and data, so there is no issue with the underlying data. The problem I am facing is a subtle one. Throughout my application, there are various queries involving wildcard searches with the input parameters. When there is a query involving a single table, the wildcard parameter like qu* will return the result set with the values quit, queer, question quintessence, etc. When I use the wildcard with the multiple joins and there are logical asisgnments to the joined tbales, the query returns back an empty set. What gives ?? Here is the code snippet. SQLstatement SELECT * FROM ( SELECT /*+ FIRST_ROWS(500) */ B.*, ROWNUM RNUM FROM( SELECT TC.TXN_CODE, TC.DESCRIPTION TC_DESCR, TC.CR_DB, TM.TXN_TYPE_NAME TXN_TYPE, TT.DESCRIPTION TT_DESCR, TC.REVERSAL, TC.SIGN, TC.CHANNEL FROM LKP_TXN_CODES_VW TC, LKP_TXN_TYPES_VW TT, MAP_AML_TXN_CODES TM WHERE TC.TXN_CODE = TM.POSTED_TXN_CODE (+) AND TT.TXN_TYPE = TM.TXN_TYPE_NAME lt;dynamicgt; lt;isNotNull property=TXN_CODEgt; lt;isNotNull property=CONDITION_TXN_CODE_LIKEgt; AND TC.TXN_CODE LIKE #TXN_CODE# lt;/isNotNullgt; lt;isNotNull property=CONDITION_TXN_CODE_EQUALgt; AND TC.TXN_CODE = #TXN_CODE# lt;/isNotNullgt; lt;/isNotNullgt; lt;isNotNull property=TC_DESCRgt; lt;isNotNull property=CONDITION_TC_DESCR_LIKEgt; AND TT.DESCRIPTION LIKE #TC_DESCR# lt;/isNotNullgt; lt;isNotNull property=CONDITION_TC_DESCR_EQUALgt; AND TT.DESCRIPTION = #TC_DESCR# lt;/isNotNullgt; lt;/isNotNullgt; lt;isNotNull property=CR_DB gt; AND TC.CR_DB = #CR_DB# lt;/isNotNullgt; lt;isNotNull property=TXN_TYPEgt; AND TT.TXN_TYPE = #TXN_TYPE# lt;/isNotNullgt; lt;/dynamicgt; ORDER BY TXN_CODE ) B WHERE ROWNUM amp;lt; #ROW_TO_END# ) WHERE RNUM amp;gt; #ROW_TO_START# /SQLstatement I look forward to any input from the iBatis user community. regards,
Result HashMap elemnt order
Hi, I get results using resultClass=java.util.HashMap and I expected that if I iterate values of the HashMap the order will correspond to the order in my fields. However it does not. Is that normal behavior? In other words I have 'Select f1, f2, f3 from Blah', and iterating in the HashMap values I get something like f2,f1,f3 iBatis version 2.3.0.677. Tya
Re: Result HashMap elemnt order
Aaah, many thanks, so I think I'd better try with LinkedHashMap. Will test it in the evening. On Fri, Jul 4, 2008 at 4:56 PM, Larry Meadors [EMAIL PROTECTED] wrote: Maps in Java are not ordered. public static void main(String[] args) { Map m = new HashMap(); m.put(this, this); m.put(is, is); m.put(a, a); m.put(test, test); for(Object o:m.values()) System.out.println(o); } The output on my box is: a is this test Larry On Fri, Jul 4, 2008 at 6:19 AM, Nicholoz Koka Kiknadze [EMAIL PROTECTED] wrote: Hi, I get results using resultClass=java.util.HashMap and I expected that if I iterate values of the HashMap the order will correspond to the order in my fields. However it does not. Is that normal behavior? In other words I have 'Select f1, f2, f3 from Blah', and iterating in the HashMap values I get something like f2,f1,f3 iBatis version 2.3.0.677. Tya
Re: Thread starvation - pool / Throttle issue?
Have a look at this thread: http://www.mail-archive.com/user-java@ibatis.apache.org/msg11828.html Good luck On Wed, Aug 6, 2008 at 4:47 PM, Brian Parkinson [EMAIL PROTECTED] wrote: Hello: So, I have things up and running under Java and iBATIS, but running into some starvation issue, and my server is locking up. When I dump threads, I see a bunch that are waiting for the connnection pool (see output #1 below) and as well, a bunch that are waiting on Throttle.increment (see output #2). Has anyone see anything similar? I am stumped right now - looking for ANY hints to help me track down (and fix :) what is going on - I don't know databases all that well, so help appreciated greatly. First up, I'm going to upgrade to latest version of iBATIS, but thinking I might have something wrong in my thread pool setup. The pool setup: bean id=mapConfig class=org.springframework.core.io.ClassPathResource constructor-arg valuecom/ecobee/foundation/dao/ibatis/SqlMapConfig.xml/value /constructor-arg /bean bean id=dataSource class=org.apache.commons.dbcp.BasicDataSource destroy-method=close property name=driverClassName value=com.mysql.jdbc.Driver / property name=url value=jdbc:mysql:///ecobee / property name=username value=XXX / property name=password value=XXX / property name=initialSize value=10 / property name=maxActive value=100 / property name=maxIdle value=10 / /bean bean id=sqlMapClient class=org.springframework.orm.ibatis.SqlMapClientFactoryBean property name=dataSource ref=dataSource / property name=configLocation ref=mapConfig / /bean I currently have no settings element in my SqlMapConfig.xml file, so running with those defaults. Any help is greatly appreciated - I am mystified. I am using iBATIS 2.3.0.667 and commons dbcp 1.2.2, and running MySQL 5.0.32. Off to upgrade to latest iBATIS as a start - Cheers, parki... --- x8 snip Output #1: Thread: Thread[pool-1-thread-121,5,main]= -- java.lang.Object.wait(Native Method) -- java.lang.Object.wait(Object.java:474) -- org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjec tPool.java:810) -- org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSourc e.java:96) -- org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:880) -- org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin (DataSourceTransactionManager.java:200) -- org.springframework.transaction.support.AbstractPlatformTransactionManag er.getTransaction(AbstractPlatformTransactionManager.java:377) -- org.springframework.transaction.interceptor.TransactionAspectSupport.cre ateTransactionIfNecessary(TransactionAspectSupport.java:261) -- org.springframework.transaction.interceptor.TransactionInterceptor.invok e(TransactionInterceptor.java:101) -- org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref lectiveMethodInvocation.java:171) -- org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(E xposeInvocationInterceptor.java:89) -- org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref lectiveMethodInvocation.java:171) -- org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo pProxy.java:204) -- $Proxy2.saveLogSet(Unknown Source) -- com.ecobee.communicator.rest.restlet.LogRestlet.doPost(LogRestlet.java:7 6) -- com.ecobee.communicator.rest.RestletManager.handleRequest(RestletManager .java:195) -- com.ecobee.communicator.engine.EngineRequest.handleRequest(EngineRequest .java:112) -- sun.reflect.GeneratedMethodAccessor338.invoke(Unknown Source) -- sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) -- java.lang.reflect.Method.invoke(Method.java:585) -- com.whatevernot.engine.standard.StateRunnable.run(StateRunnable.java:56) -- java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto r.java:650) -- java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja va:675) -- java.lang.Thread.run(Thread.java:595) Output #2: Thread: Thread[pool-1-thread-613,5,main]= -- java.lang.Object.wait(Native Method) -- java.lang.Object.wait(Object.java:474) -- com.ibatis.common.util.Throttle.increment(Throttle.java:70) -- com.ibatis.common.util.ThrottledPool.pop(ThrottledPool.java:57) -- com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.popSession(SqlMapEx ecutorDelegate.java:933) -- com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.init(SqlMapSessionImpl .java:51) -- com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.getLocalSqlMapSession(Sql MapClientImpl.java:259) -- com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.startBatch(SqlMapClientIm pl.java:161) --
Re: Manual for Ibatis
Indeed the link is broken. But the subversion one works: http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-2/ibatis-2-docs/en/ Anyway usually docs in SVN are more up to date Peace On Mon, Aug 11, 2008 at 11:04 PM, Reuben Firmin [EMAIL PROTECTED]wrote: I'm looking for the Ibatis Manual, the PDF which used to be linked to from the site. The documentation section on the site is broken: http://ibatis.apache.org/javadownloads.html -- I assume that's where it should be? Thanks Reuben
Re: IBatis 2.3 lazy loading issue for return null instead of an list
AFAIK the root of the problem is that when iBatis handles resultset of left joining master table with child table the child table columns may be all NULL and it's not quite clear whether child table indeed contained corresponding row with NULL elements or there was no result found in the child table. Hence it adds a single element (with NULL values) to the list. So i think it's not lazy loading issue at all. Hence in such situations I add a check in my DAO layer and discard the child list if it contains single element with all NULL values. Wish iBatis could handle this for me through, say, some boolean flag 'discardNullChildLists'. 2008/8/12 Haulyn R. Jason [EMAIL PROTECTED] Hi, I use the feature Lazy loading for IBatis2.3, I have a domain class like: public class Role(){ private String id; private String name ; private ListPrivilege privilegeList ; } the problem is: when the privilegeList is not null, I mean a Role object has more than one Privilege, ok, everything goes well. But when the Role doesn't has any Privilege, I hope my Dao could return null for the property privilegeList. When I debug my program, I found it's stranger, the privilegeList is not null, it is a List with one element, the only one element is Privilege Object but doesn't have values. I try to google the issue and find this: http://opensource.atlassian.com/confluence/oss/display/IBATIS/Lazy+loading+issues but I really can not understand how can I achieve my goal. Always thanks for solution or some urls reference. -- Thanks! Mobile: +086-15864011231 EMailgtalk:[EMAIL PROTECTED] [EMAIL PROTECTED] EMailyahoo:[EMAIL PROTECTED] [EMAIL PROTECTED] Skype:saharabear 贾昊林(Haulyn Runner Jason)
Re: Same queries, different tables
To be honest in the first place I'd ask DBA to use partitioning if your db engine supports that, and if not, to create union USERS query to run my queries against.
Re: Miles Palis is not available until 09/08/2008
miles_davis is out also, what a pity ;) On Sat, Aug 30, 2008 at 12:03 PM, [EMAIL PROTECTED] wrote: I will be out of the office starting 08/29/2008 and will not return until 09/08/2008. I will respond to your message when I return. Please contact Alan May if you need your questions address prior to my return.
Re: linked server with list parameter
Should not you use CDATA sections to get quotation marks intact in your SQL ? And like Jeff pointed out, look at the generated statements in your log
Re: Using Operators in Compare Value in Ibatis Result maps
Look into the sqlmaps guide. There are condidtions like isGreaterThen isGreaterEqual isLessThen isLessEqual On Tue, Nov 11, 2008 at 1:37 AM, Mehak [EMAIL PROTECTED] wrote: Hi Please help me with this simpl problem regarding using operators in compare value. I have a condition something like: lastUpdatedDate givenTime, then do this. lastUpdatedDate givenTime, then do this. lastUpdatedDate = givenTime, then do this. To achieve this I have the following data ready: isEqual property=operator compareValue= TIMESTAMP( #checkValue# ,'00.00.00') + 1 DAY /isEqual Now how to use and = operator in this as it does not accept something like: isEqual property=operator compareValue= TIMESTAMP( #checkValue# ,'00.00.00') + 1 DAY /isEqual Please guide urgently. I would be very thnakful to you. Thanks -- View this message in context: http://www.nabble.com/Using-Operators-in-Compare-Value-in-Ibatis-Result-maps-tp20434297p20434297.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Statement Caching Question
Or can somebody suggest another solution? Maybe ask your DBA to increase max open cursors allowed? ;) Honestly, I never quite understood iBATIS statement cacheing performance gains with oRACLE (which IMO maintains stetement cache on its own). Are you sure disabling it throughout your application affects performance?
Re: Using Operators in Compare Value in Ibatis Result maps
oops, misspelled, should be isGreaterThan isGreaterEqual isLessThan isLessEqual gl ;) On Tue, Nov 11, 2008 at 5:30 AM, [EMAIL PROTECTED] wrote: XML does not support and operator as it is. You have to use ![CDATA[ Give your operator here]] Hope this will help you Regards Ankit -Original Message- From: Mehak [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2008 12:07 PM To: user-java@ibatis.apache.org Subject: Using Operators in Compare Value in Ibatis Result maps Hi Please help me with this simpl problem regarding using operators in compare value. I have a condition something like: lastUpdatedDate givenTime, then do this. lastUpdatedDate givenTime, then do this. lastUpdatedDate = givenTime, then do this. To achieve this I have the following data ready: isEqual property=operator compareValue= TIMESTAMP( #checkValue# ,'00.00.00') + 1 DAY /isEqual Now how to use and = operator in this as it does not accept something like: isEqual property=operator compareValue= TIMESTAMP( #checkValue# ,'00.00.00') + 1 DAY /isEqual Please guide urgently. I would be very thnakful to you. Thanks -- View this message in context: http://www.nabble.com/Using-Operators-in-Compare-Value-in-Ibatis-Result- maps-tp20434297p20434297.htmlhttp://www.nabble.com/Using-Operators-in-Compare-Value-in-Ibatis-Result-maps-tp20434297p20434297.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. Please do not print this email unless it is absolutely necessary. The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
Re: Strange problems and wrong data on Linux (redhat) not on Windows
When I deploy everthing to a Linux box I get the weirdest errors from the Driver. --- Cause: java.sql.SQLException: [unixODBC][INTERCHAIN][UNIMS-ODBC] [UNIMS] Well, maybe we can blame differences in ODBC layer? I've have never used ODBC (or ODBC-JDBC bridge) on linux, any chance you can test with JDBC driver for your database?
Re: update with parameterMap and parameterClass ?
parameterMap id=messageParameterMap class=Message parameter property=id1 jdbcType=INTEGER/ parameter property=id2 jdbcType=INTEGER/ parameter property=messageCount jdbcType=INTEGER / parameter property=title jdbcType=VARCHAR/ /parameterMap insert id=insertMessage parameterMap=messageParameterMap INSERT INTO MSGS ( SY_ID1, SY_ID2, MS_COUNT, MS_TITLE) VALUES (#id1#,#id2,#messageCount#,#title#) /insert update id=update parameterMap=messageParameterMap UPDATE MSGS SET MS_COUNT=#messageCount#, MS_TITLE=#title# WHERE SY_ID1=#id1# AND SY_ID2 = #id2# /update I.e. for selects/crud replace question marks with actual property name enclosed with ##. However you'll have to use questionmark placeholders when calling stored procedures, and there you'll need to care about the order in your parameter map.
Re: Question on iBatis Implicit Transactions ?
2b) Scenario: copy/pasting from manual: __ The transactionManager element also allows an optional attribute * commitRequired* that can be *true* or *false*. Normally iBATIS will not commit transactions unless an insert, update, or delete operation has been performed. *This is true even if you explicitly call the commitTransaction() method*. This behavior creates problems in some cases. If you want iBATIS to always commit transactions, even if no insert, update, or delete operation has been performed, then set the value of the *commitRequired* attribute to *true*. Examples of where this attribute is useful include: 1. If you call a stored procedures that updates data as well as returning rows. In that case you would call the procedure with the queryForList() operation – so iBATIS would not normally commit the transaction. But then the updates would be rolled back. _ So yes, iBatis will rollback. 2a scenario: if you forget to call endTransaction iBatis will do nothing and sooner or later your connection pool will get exhausted. Copy/pasting again: ___ Notice how endTransaction() is called regardless of an error. This is an important step to ensure cleanup. The rule is: if you call startTransaction() be absolutely certain to call endTransaction() (whether you commit or not). ___ 1a: Again some little copy/paste ;) ___ Although using explicit transactions is very highly recommended, there is a simplified semantic that can be used for simple requirements (generally read-only). If you do not explicitly demarcate transactions using the startTransaction(), commitTransaction() and endTransaction() methods, they will all be called automatically for you whenever you execute a statement outside of a transactional block Not sure, but think COMMIT_REQUIRED applies here also, i.e. iBatis will rollback after any SELECT statement unless COMMIT_REQUIRED=true Try to use docs from SVN, nowadays they contain far more info than they used to couple of years ago ;) On Tue, Nov 25, 2008 at 10:43 PM, mfs [EMAIL PROTECTED] wrote: Hello Guys, I have got a couple of questions relating to iBatis starting out implicit trasactions..Let me add that i am using iBatis JDBC TransactionManager. Please comment/correct me on the following understanding, given COMMITREQUIRED=TRUE : 1a) iBatis implicitly starts a transaction if one isn't explicitly started ? If that is true would iBatis commit the transaction in the end (given we never started one mistakenly or otherwise and hence not committing/rolling-back) ? 2a) Second Scenario. We do start a transaction but don't explicitly do a commit in the end. Would iBatis do the commit for you, given no exceptions got raised OR it would just rollback the transaction ? 2b) Relating to the above scenario, I read somewhere that iBatis would rollback the transaction if it is select query, what if it is select for update ? Thanks Farhan. -- View this message in context: http://www.nabble.com/Question-on-iBatis-Implicit-Transactions---tp20694266p20694266.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Can't delete without the setter method
Please enable logging to see what gets executed and specifically what value for #jobPostingId# is passed. On Thu, Dec 4, 2008 at 9:15 PM, Michael He [EMAIL PROTECTED] wrote: Nothing happens without deleting anything Micheal Kai Grabfelder-2 wrote: hm looks like a bug to me. What happens when you perform the delete? Just nothing or an exception? Regards Kai --- Original Nachricht --- Absender: Michael He Datum: 03.12.2008 15:56 if i don't set the setter method of the keyword-column property in a javabean,then i can't delete it using this property? for example: the javabean: public class JobPosting implements Serializable { private int jobPostingId; //missing other properties... ... public int getJobPostingId() { return jobPostingId; }//only the getter method //missing other getter/setter methods ... } the xml: delete id=deleteJobPosting parameterClass=JobPosting delete from jobPosting where jobPostingId=#jobPostingId# /delete the java code: public void deleteJobPosting(JobPosting j) { getSqlMapClientTemplate().delete(deleteJobPosting, j); } i have tested it can't be deleted in this case,there is also no error messages,but i can insert with the same model, anyone knows why? thanks in advance -- View this message in context: http://www.nabble.com/Can%27t-delete-without-the-setter-method-tp20814477p20846623.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: [ANNOUNCE] Ibator Version 1.2.1 Available
Thank you Jeff for this wonderful tool! Plugins making classes serializable and adding equals/hashcode are exactly what I wished for ;) May I ask whether standalone version is fully functional - initially it was not, but then I was using Eclipse anyway. Merry Christmas and Happy New Year On Mon, Dec 22, 2008 at 7:21 PM, Jeff Butler jeffgbut...@gmail.com wrote: Ibator version 1.2.1 is now available. Ibator is a code generation tool for iBATIS. It runs standalone, or as an Eclipse plugin. It is the renamed and improved version of Abator. This is primarily a bug-fix release to resolve two issues that manifested in the Eclipse plugin. There are also enhancements to the IbatorPlugin API, and a couple of new features in the Eclipse plugin. See the What's New? page for details of the changes here: http://ibatis.apache.org/docs/tools/ibator/whatsNew.html See this page for download links and other information: http://ibatis.apache.org/ibator.html Happy Holidays Everyone! Jeff Butler
Re: [SURVEY] How many connections are in your pool?
Ours is an application that requires guaranteed response times under 50 ms, so: 1) We dropped using any kind of pool, so that 2) number of constantly open connections equals to the number of processors (16) 3) I know you were asking about pool, but still I dared to respond with this no-pool variant because I think maybe what you are asking can be reformulated as: is there any use of DB pool in a short lived transaction scenario, or its better to have one connection per CPU. Testing our app made us to drop using pool with TimesTen (in memory) database. Now I started to suspect that using using db pool (I've mostly used dbcp ) in other less demanding projects (but again w/o long running transactions) was just saving development time (let pool handle concurrency issues), but not any substantial performance gain. Wonder what others think... On Tue, Jan 20, 2009 at 8:43 AM, Clinton Begin clinton.be...@gmail.comwrote: Hi all, I've been studying a few large enterprise applications and have noticed an interesting trend... many of these apps have HUNDREDS of connections (like 600) available or even open in their connection pools... Survey Questions: 1. How many connections do you have available in your pool? 2. And if you know, how many CPU cores are available on your database server (or cluster)? 3. If you have 2x or 3x more connections than you do CPUs, do you have a reason that you could share? Cheers, Clinton
Re: [SURVEY] How many connections are in your pool?
We have a pool of 16 threads (one per cpu) with a single connection assigned per thread, so its rather a thread pool... On Tue, Jan 20, 2009 at 2:39 PM, Clinton Begin clinton.be...@gmail.comwrote: It sounds like you're still using a pool, but your max, min, idle, and active connections are all equal (i.e. 16). Otherwise, how do you allocate connections to the incoming requests? Cheers, Clinton On Tue, Jan 20, 2009 at 12:33 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: Ours is an application that requires guaranteed response times under 50 ms, so: 1) We dropped using any kind of pool, so that 2) number of constantly open connections equals to the number of processors (16) 3) I know you were asking about pool, but still I dared to respond with this no-pool variant because I think maybe what you are asking can be reformulated as: is there any use of DB pool in a short lived transaction scenario, or its better to have one connection per CPU. Testing our app made us to drop using pool with TimesTen (in memory) database. Now I started to suspect that using using db pool (I've mostly used dbcp ) in other less demanding projects (but again w/o long running transactions) was just saving development time (let pool handle concurrency issues), but not any substantial performance gain. Wonder what others think... On Tue, Jan 20, 2009 at 8:43 AM, Clinton Begin clinton.be...@gmail.comwrote: Hi all, I've been studying a few large enterprise applications and have noticed an interesting trend... many of these apps have HUNDREDS of connections (like 600) available or even open in their connection pools... Survey Questions: 1. How many connections do you have available in your pool? 2. And if you know, how many CPU cores are available on your database server (or cluster)? 3. If you have 2x or 3x more connections than you do CPUs, do you have a reason that you could share? Cheers, Clinton
Re: [SURVEY] How many connections are in your pool?
Hi Sundar, I am not an hardware expert, but I suspect that even with modern dma access etc if you ask your CPU to process N database transactions (initiated by different users) in parallel it may take longer compared to when you ask it to do them consequently. So quite possible that pools with connection number CPU number induce performence penalties. In other words the time your pool waits for a connection to get available in the pool is just caused by your hardware (CPU) beeing busy, so why add extra latency with extra pool code... Again, of course the logic can not applyed to long running transactions when CPU is idling in the midst of transaction waiting for e.g. extra user input. On Tue, Jan 20, 2009 at 2:50 PM, Sundar Sankar fatboys...@gmail.com wrote: Hi Clinton, I apologize ahead, if I am missing or not getting something right. As far as my understanding goes, arent number of connections in a pool in relation to the number of parallel users that access the application than the number of CPU cores in a database? Regards S On Tue, Jan 20, 2009 at 12:39 PM, Clinton Begin clinton.be...@gmail.comwrote: It sounds like you're still using a pool, but your max, min, idle, and active connections are all equal (i.e. 16). Otherwise, how do you allocate connections to the incoming requests? Cheers, Clinton On Tue, Jan 20, 2009 at 12:33 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: Ours is an application that requires guaranteed response times under 50 ms, so: 1) We dropped using any kind of pool, so that 2) number of constantly open connections equals to the number of processors (16) 3) I know you were asking about pool, but still I dared to respond with this no-pool variant because I think maybe what you are asking can be reformulated as: is there any use of DB pool in a short lived transaction scenario, or its better to have one connection per CPU. Testing our app made us to drop using pool with TimesTen (in memory) database. Now I started to suspect that using using db pool (I've mostly used dbcp ) in other less demanding projects (but again w/o long running transactions) was just saving development time (let pool handle concurrency issues), but not any substantial performance gain. Wonder what others think... On Tue, Jan 20, 2009 at 8:43 AM, Clinton Begin clinton.be...@gmail.comwrote: Hi all, I've been studying a few large enterprise applications and have noticed an interesting trend... many of these apps have HUNDREDS of connections (like 600) available or even open in their connection pools... Survey Questions: 1. How many connections do you have available in your pool? 2. And if you know, how many CPU cores are available on your database server (or cluster)? 3. If you have 2x or 3x more connections than you do CPUs, do you have a reason that you could share? Cheers, Clinton
Re: [VOTE] Should iBATIS support SQLJ?
0 == Doesn't matter to me Absolutely
Re: SimplePooledConnection Exception
Maybe it makes sense to switch to DBCP as it has testOnBorrow setting (needs a validation query of course) and the DBCP docs saying: testOnBorrow: The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. On Tue, Jan 27, 2009 at 3:57 AM, Zsolt Koppany zkoppanyl...@intland.comwrote: Nathan, we do that. Zsolt Nathan Maves schrieb: Sounds like you need to use a validation query to ensure your connections are not stale. On Sun, Jan 25, 2009 at 10:06 AM, Zsolt Koppany zkoppanyl...@intland.commailto: zkoppanyl...@intland.com wrote: Hi, after getting the Exception below I get lot of database related Exceptions. What happens if ibatis finds an invalid connection? Will that be removed from the pool? What should the application do to prevent such problems? We use ibatis 2.3.4.726 with mysql-5.0.67. Zsolt 2009-01-25 15:32:43,436 ERROR servlet.build.BackgroundBuildTimerTask - java.lang.RuntimeException: Error accessing SimplePooledConnection. Connection is invalid. [DefaultQuartzScheduler_Worker-2] java.lang.RuntimeException: Error accessing SimplePooledConnection. Connection is invalid. at com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.getValidConnection(SimpleDataSource.java:913) at com.ibatis.common.jdbc.SimpleDataSource$SimplePooledConnection.invoke(SimpleDataSource.java:958) at $Proxy0.rollback(Unknown Source) at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.rollback(JdbcTransaction.java:72) at com.ibatis.sqlmap.engine.transaction.TransactionManager.end(TransactionManager.java:87) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:734) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:176) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:153) at com.intland.codebeamer.persistence.util.SqlMapClientWrapper.endTransaction(SqlMapClientWrapper.java:251) Zsolt
Re: iBATIS 2.3.4 (latest version)
I have used it with TimesTen 6 / 7 with JDK6. Had no iBatis related problems. On Thu, Jan 29, 2009 at 1:39 AM, Avitzur Alon alon.avit...@comverse.comwrote: Hi, I am thinking of using iBATIS in my application in order to access the DB. I have two questions: 1. Does this version support JDK 1.6? 2. Does iBATIS can work with TimesTen in memory DB? Thanks in advance, Alon
Re: logging not working using log4j
I recall one has to call com.ibatis.common.logging.LogFactory.selectLog4JLogging() before sqlmap is initialized On Fri, Feb 6, 2009 at 4:25 PM, Stanley, Eric eric.r.stan...@qwest.comwrote: Richard, I know its being read. As I mentioned below, all other components of the app are using it just fine. My app, struts2 and tomcat are both using it without a problem. The only thing that's not logging is iBATIS. -Ryan -Original Message- From: Richard Yee [mailto:r...@cruzio.com] Sent: Friday, February 06, 2009 7:53 AM To: user-java@ibatis.apache.org Subject: Re: logging not working using log4j Where did you put your log4j.properties file? It needs to be in the classpath. Do you get any indication that it is being read at all? -R Stanley, Eric wrote: Hello, I have a Tomcat 6 container, and my java 1.5 app is using iBATIS 2.3.4 and struts2. This is my log4.properties: # Set root logger log4j.rootLogger=INFO, R, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %C %x - %m%n # R is a file appender log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=log/pt.log log4j.appender.R.MaxFileSize=1MB log4j.appender.R.MaxBackupIndex=5 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %C %x - %m%n # SqlMap logging configuration... log4j.logger.com.ibatis=DEBUG log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG log4j.logger.com.ibatis.sqlmap.engine.cache.CacheModel=DEBUG log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientImpl=DEBUG log4j.logger.com.ibatis.sqlmap.engine.builder.xml.SqlMapParser=DEBUG log4j.logger.com.ibatis.common.util.StopWatch=DEBUG log4j.logger.java.sql.Connection=DEBUG log4j.logger.java.sql.Statement=DEBUG log4j.logger.java.sql.PreparedStatement=DEBUG log4j.logger.java.sql.ResultSet=DEBUG If I understand correctly, this should spit out debug for everything iBATIS logs, right? Problem is, I dont get any logging for iBATIS, but I do for my app, tomcat, and struts2. What am I missing here? -Ryan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
Re: aBator does not create getter and setter for new column in table
Add it manually :) Yours is such a weird problem, some unique combination of some circumstances. I bet there's some no-framework related problem, both iBatis and iBator are so simple or rather transparent (like everything genial) On Wed, Feb 18, 2009 at 4:41 PM, sanv viv...@gmx.at wrote: Is there any other workaround to this problem. I am kind of stuck... I need that column in the table :-D Thanks in advance. Jeff Butler-2 wrote: Write a Java program that does this: public static void main(String[] args) { String[] abArgs = {-configfile, config.xml, -overwrite}; AbatorRunner.main(abArgs); } Compile it in an IDE, set the break point, off to the races. Jeff Butler On Mon, Feb 16, 2009 at 5:06 PM, sanv viv...@gmx.at wrote: Hi, thanks for your answer. But how can I add the break point? Jeff Butler-2 wrote: I'm stumped - sorry. If there are no warnings about unsupported data types, then my best guess is that the column got added to a table that is not in the schema being queried by Abator. Since you don't specify a schema anywhere, Abator is looking in the default schema for this connection. I'd recommend attaching the Abator source and debugging - put a breakpoint in the getColumns method of org.apache.ibatis.abator.internal.db.DatabaseIntrospector - you should be able to see if the column is returned to Abator from the JDBC driver. Jeff Butler On Mon, Feb 16, 2009 at 11:32 AM, sanv viv...@gmx.at wrote: Sorry, the only warning is not just Statistics.java but also for the other files. But I didnt paste them in all as they are all the same. The config.xml is the following: ?xml version=1.0 encoding=UTF-8? !DOCTYPE abatorConfiguration PUBLIC -//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN http://ibatis.apache.org/dtd/abator-config_1_0.dtd; abatorConfiguration abatorContext id=OracleTables generatorSet=Java5 jdbcConnection driverClass=oracle.jdbc.driver.OracleDriver connectionURL=jdbc:oracle:thin:@127.0.0.1:1521:XE userId=SOME_USER password=some_pwd classPathEntry location=ojdbc14.jar / /jdbcConnection javaTypeResolver property name=forceBigDecimals value=false / /javaTypeResolver javaModelGenerator targetPackage=com.tool.ibatis.model targetProject=ibatis\src\main\java property name=enableSubPackages value=true / property name=trimStrings value=true / /javaModelGenerator sqlMapGenerator targetPackage=com.tool.ibatis.xml targetProject=ibatis\src\main\resources property name=enableSubPackages value=true / /sqlMapGenerator daoGenerator type=GENERIC-SI targetPackage=com.tool.ibatis.dao targetProject=ibatis\src\main\java property name=enableSubPackages value=true / /daoGenerator table tableName=CUSTOMER property name=useActualColumnNames value=true/ generatedKey column=CaseID sqlStatement=Select caseid_seq.nextval from dual/ /table table tableName=PATCH property name=useActualColumnNames value=true/ generatedKey column=PatchID sqlStatement=Select patchid_seq.nextval from dual/ /table table tableName=STATISTICS property name=useActualColumnNames value=true/ generatedKey column=ID sqlStatement=Select statistics_seq.nextval from dual/ /table /abatorContext /abatorConfiguration Jeff Butler-2 wrote: The only warning is that Statistics.java was overwritten. It is a mystery. Could we see your config.xml? Jeff Butler On Mon, Feb 16, 2009 at 10:51 AM, sanv viv...@gmx.at wrote: If I run the following command in the command line: java -jar abator.jar -configfile config.xml -overwrite I get an output saying the files were overwritten: Existing file C:\server\ibatis\src\main\java\com\tool\ibatis\model\Statistics.java was overwritten Abator finshed successfully, there were warninigs. This is all I get. thanks Jeff Butler-2 wrote: Warnings are displayed differently depending on how you run Abator... 1. They could be written to System.out if you are running from the command line 2. They can be logged to the Ant console if you are using Ant 3. They will be displayed in the completion dialog box if you are running in Eclipse Jeff Butler On Mon, Feb 16, 2009 at 10:33 AM, sanv viv...@gmx.at wrote: 1. The classes are regenerated and the timestamp is also updated. 2. The new field is added. 3. I have tried using different datatypes (Oracle: VARCHAR2, CHAR and NUMBER) 4. There are warnings, but how can I display the warnings? thanks in advance. Jeff Butler-2 wrote: Not much to go on here - we probably need more information. Some questions... 1. Are you sure the classes are regenerated (the comment timestamp will help you know for
Re: mysql default value
I do not like idea of keeping defaults both in database and application. If I have a not nullable database field with some default value, besides setting default value in database I use 'before insert' table trigger that checks if supplied value is NULL and sets it to the desired value. Well, I believe database vendors should treat not-null fields with default values in that way saving me from writing those tedious triggers ;) On Wed, Mar 18, 2009 at 9:00 AM, Alex Sherwin alex.sher...@acadiasoft.comwrote: What I ususally do: public String getStatus() { return null == status ? Some Default Value : status; } Alin Popa wrote: Thanks Nicholoz, This is what I've done. And I also have a facade that will abstract for the user, the insert actions. I thought that ibatis knows how to handle this, or have a trick for it. On Wed, Mar 18, 2009 at 10:51 AM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: Why don't you just exclude this field in the insert? insert id=insertExampleWithDefaults parameterClass=com.test. Example INSERT INTO vjobs(name, description) VALUES (#name#,#description#) /insert GL IMO because sometimes one need to insert NULL values too. So why don't you add another insert statement to your xml that will omit the status field? On Wed, Mar 18, 2009 at 4:19 AM, Kengkaj Sathianpantarit kengka...@gmail.com wrote: However, I think that default value is good in the case that we don't need to specify value in INSERT command. Why don't you just exclude this field in the insert? For update, I think that we should specify value explicitly in the model, error from database is correct behavior in case the field has null value (actually this is the reason why we set NOT NULL constraint). Kengkaj On Wed, Mar 18, 2009 at 3:06 PM, Alin Popa alin.p...@gmail.com wrote: Thanks Kengkaj, But from what I read it seems that nullValue is used to substitute value with a database NULL. The thing is that I'm not allowed to use null since field is NOT NULL. On Wed, Mar 18, 2009 at 6:00 AM, Kengkaj Sathianpantarit kengka...@gmail.com wrote: Use null value replacement feature, read user manual. Kengkaj On Tue, Mar 17, 2009 at 10:37 PM, Alin Popa alin.p...@gmail.com wrote: Hi, I have the following db table (MySQL): CREATE TABLE `examples`( `id` SERIAL PRIMARY KEY, `name` VARCHAR(255), `status` VARCHAR(20) NOT NULL DEFAULT 'ready', `description` TEXT ) ENGINE=innodb DEFAULT CHARSET utf8 DEFAULT COLLATE utf8_bin; Using ibatis sql-map I'm doing this: insert id=insertExample parameterClass=com.test.Example INSERT INTO vjobs(name, status, description) VALUES (#name#,#status#,#description#) /insert When inserting an example object, without having status field set, I got Column 'status' cannot be null; but the DEFAULT is 'ready'. How can this be managed using ibatis ? It is possible ? Thanks. Alin -- Best Regards, Alin
Re: Executed SQL log
It's possible to display the executed SQL somehow ? Sure, it's possible to log what statements are prepared, what parameters are set to and what results are retrived. Check the 'Logging SqlMap Activity' section in developer guide.
Re: Cannot serialize session attribute ...
I have never used tomcat clustering, but it sounds to me reasonable that disabling persisting sessions upon tomcat exit has nothing to do with clustering. However, in order to replicate session object in clustered environment the session object *has to be* serializable. So, imho, any reference to singleton objects in your session can be and must be marked with 'transient'. On Fri, Mar 20, 2009 at 7:53 AM, Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2 jonathan.leffingwell@navy.mil wrote: Here's my concern: Let's say that I am running two instances of Tomcat in a cluster: Server A and Server B. While a user is in the web application on Server A, Server A goes down. I need for Server B to have all of the session information for the user that Server A had, so the user will not notice anything while he/she is using the web app. That's why we're using clustering. If the web application is properly exited, then I don't care if the session information is saved upon exiting the app. It's probably better if the session info is NOT saved upon properly exiting the app. But what I want to know is this: If I use any of the previously mentioned solutions (i.e. the Manager pathname=/ or the Manager className=org.apache.catalina.session.PersistentManager saveOnRestart=false / approaches), will my clustering still work as I need it to? Thank you for your help, everyone! Jonathan -Original Message- From: charlie bird [mailto:zebthe...@yahoo.co.uk] Sent: Friday, March 20, 2009 7:46 AM To: user-java@ibatis.apache.org Subject: Re: Cannot serialize session attribute ... Alternatively you could disable session serialization completely by adding the following line to your tomcat application xml: Manager pathname=/ Only if you're not bothered about retrieving the sessions on restart of course --- On Fri, 20/3/09, Kengkaj Sathianpantarit kengka...@gmail.com wrote: From: Kengkaj Sathianpantarit kengka...@gmail.com Subject: Re: Cannot serialize session attribute ... To: user-java@ibatis.apache.org Date: Friday, 20 March, 2009, 11:18 AM Mark transient in declaration - transient StandardDaoManager standardDaoManager; Kengkaj On Fri, Mar 20, 2009 at 6:13 PM, Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2 jonathan.leffingwell@navy.mil wrote: What does that mean, set reference to it transient? -Original Message- From: Nicholoz Koka Kiknadze [mailto:kikna...@gmail.com] Sent: Thursday, March 19, 2009 3:30 PM To: user-java@ibatis.apache.org Subject: Re: Cannot serialize session attribute ... My first thought is that maybe StandardDaoManager can not be serializable as it deals with database connections. Maybe makes sense to set reference to it transient? On Thu, Mar 19, 2009 at 2:55 PM, Leffingwell, Jonathan R CTR FRCSE, JAX 7.2.2 jonathan.leffingwell@navy.mil wrote: I am running a web app in IBM RAD 7 with a Tomcat 5.5.26 server, with clustering (two Tomcat instances). When shutting down the Tomcat server(s), I get the following warning: Mar 19, 2009 2:52:43 PM org.apache.catalina.session.StandardSession writeObject WARNING: Cannot serialize session attribute createXXXManager for session 8B1876E5C5C54B242E4256674843600B java.io.NotSerializableException: com.ibatis.dao.engine.impl.StandardDaoManager at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java: 1375) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:134 7) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java :1290) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302) at org.apache.catalina.session.StandardSession.writeObject(StandardSessio n.java :1478) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession. java:948) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.j ava:51 7) at org.apache.catalina.session.StandardManager.unload(StandardManager.jav a:463) at org.apache.catalina.session.StandardManager.stop(StandardManager.java: 667) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:436 0) at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1067
Re: iBator CommentGenerator: Java Model Class with database column comment
Wow, took less than 24 hours ;). On Fri, Mar 20, 2009 at 5:23 PM, Jeff Butler jeffgbut...@gmail.com wrote: Support for this is now available in SVN. Jeff Butler On Fri, Mar 20, 2009 at 6:57 AM, Jeff Butler jeffgbut...@gmail.com wrote: Interesting idea. Ibator does not currently capture database field comments from the metadata, so there's no simple way to do this now. It's a relatively simple change to add it. I'd need to change the CommentGenerator interface to expose it - hopefully that won't cause too much trouble for people. I'll look into it. Jeff Butler On Thu, Mar 19, 2009 at 4:30 PM, Benjamin-Klatt benja...@bar54.de wrote: Hi all, I am trying to use the comment I modeled in my database to be automatically used in javadoc comment of the data fields within the java data model source code. I started to implement my own commentGenerator, but the method addFieldComment(Field field, FullyQualifiedTable, String columnName) does not provide the required information. There is no element that provides access to the comment of the appropriate column in the database. Does someone has implement a solution for this or at least does know this information could be accessed? Thanks in advance Benjamin -- View this message in context: http://www.nabble.com/iBator-CommentGenerator%3A-Java-Model-Class-with-database-column-comment-tp22608433p22608433.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Oracle11g question .
URL seems fine. Try using ojdb*6*.jar, I'm using it without problems.. GL On Fri, Mar 20, 2009 at 9:35 PM, Sergey Livanov sergey.liva...@gmail.comwrote: driver , url, user pwd. jdbc.ORAdriverClassName=oracle.jdbc.driver.OracleDriver jdbc.ORAurl=jdbc:oracle:thin:@192.168.1.15:1521:ORCL jdbc.ORAusername=servers jdbc.ORApassword=servers 2009/3/21 Sergey Livanov sergey.liva...@gmail.com I installed Oracle11g and can not set up driverClassName and url parameters of connection. Help me please, who install already please. ( I downloaded ojdbc5.jar and orai18n. ) NLS_LANG=UKRAINIAN_UKRAINE.CL8MSWIN1251 error : java.lang.NoSuchMethodError: oracle.i18n.util.GDKOracleMetaData.getDataPath()Ljava/lang/String; at oracle.i18n.text.converter.CharacterConverterOGS.clinit(CharacterConverterOGS.java:71) at java.lang.Class.forName0(Native Method) thank you a lot ...
Re: Oracle11g question .
Meant ojdbc6.jar of course On Sat, Mar 21, 2009 at 2:08 AM, Nicholoz Koka Kiknadze kikna...@gmail.comwrote: URL seems fine. Try using ojdb*6*.jar, I'm using it without problems.. GL On Fri, Mar 20, 2009 at 9:35 PM, Sergey Livanov sergey.liva...@gmail.comwrote: driver , url, user pwd. jdbc.ORAdriverClassName=oracle.jdbc.driver.OracleDriver jdbc.ORAurl=jdbc:oracle:thin:@192.168.1.15:1521:ORCL jdbc.ORAusername=servers jdbc.ORApassword=servers 2009/3/21 Sergey Livanov sergey.liva...@gmail.com I installed Oracle11g and can not set up driverClassName and url parameters of connection. Help me please, who install already please. ( I downloaded ojdbc5.jar and orai18n. ) NLS_LANG=UKRAINIAN_UKRAINE.CL8MSWIN1251 error : java.lang.NoSuchMethodError: oracle.i18n.util.GDKOracleMetaData.getDataPath()Ljava/lang/String; at oracle.i18n.text.converter.CharacterConverterOGS.clinit(CharacterConverterOGS.java:71) at java.lang.Class.forName0(Native Method) thank you a lot ...
Re:
Found this: http://www.nabble.com/Statement-Caching-Question-td20437084.html Hope it helps GL 2009/3/25 Daniel Sánchez Gómez dsanc...@satec.es Hi, I have a problem with open cursors using Ibatis in an Oracle data base. When I open a transaction with a lot of querys and before the transaction ends, an exception appears: “Too many cursors are open”. What can I do to resolve this problem? Is there any instruction to close cursors without ending transaction? We can’t increase the number of cursors in the database. Thanks!
Re: ibatis can use proxool connection pool?
I think you can use any DataSource (including ProxoolDataSource). Just use full class name in your transactionManager's dataSource element and IMO it should work. On Mon, Mar 23, 2009 at 3:39 AM, Mike.G hyli...@gmail.com wrote: Hi, everyone, ibatis can use proxool connection pool? how? thanks Mike.G
Re: ibatis can use proxool connection pool?
Sorry, I have not used iBatis without spring for ages. As for Spring/iBatis I just checked replacing my datasource in applicationContext.xml with bean id=dataSource class=org.logicalcobwebs.proxool.ProxoolDataSource destroy-method=close property name=drivervaluenet.sourceforge.jtds.jdbc.Driver/value/property property name=driverUrlvaluejdbc:jtds:sqlserver://server:1433;socketTimeout=20;loginTimeout=10/value/property property name=uservaluesomeusername/value/property property name=passwordvaluesomepassword/value/property /bean works fine. Note that you can add any property that has crresponding setXXX in ProxoolDataSource. On Wed, Mar 25, 2009 at 9:54 AM, Mike.G hyli...@gmail.com wrote: Hi, thanks for you response. could you give some example configurations? thanks Mike.G 2009/3/25 Nicholoz Koka Kiknadze kikna...@gmail.com: I think you can use any DataSource (including ProxoolDataSource). Just use full class name in your transactionManager's dataSource element and IMO it should work. On Mon, Mar 23, 2009 at 3:39 AM, Mike.G hyli...@gmail.com wrote: Hi, everyone, ibatis can use proxool connection pool? how? thanks Mike.G
Re: Inserting null value in ibatis
In the manual we read: The *jdbcType* element is used to specify the JDBC type of the parameter. The value must be one of the types listed in java.sql.Types (VARCHAR, INTEGER, etc.) Generally the *jdbcType* element is needed if there is a possibility that the value could be NULL, or to specify the use of DATE or TIME fields (as opposed to TIMESTAMP fields). So please read the manual ;) and use #propertyName:jdbcType# On Wed, Mar 25, 2009 at 12:56 PM, Sekar, Sowmya sse...@ucsd.edu wrote: Hi, I am trying to insert null value for a column and it throws the following exception Cause: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 0. Caused by: java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: JZ0SL: Unsupported SQL type 0. *! Does ibatis allow insertion of null values? Thanks, *Sowmya Sekar*
Re: How to Compare database record before UPDATE using iBatis?
No I think. iBatis is not aware whether your VO-s have changed and can not decide whther to run updates or not. Why don't you override the Object.hashcode() method on your VO and call it and save the value when you retrieve the record. Call it again when the user submits their changes. If the values are different, the a change was made. Hm, I usually override equals. Any advantages with hashCode? But most of the time (being lazy) I execute updates without checking if there were atual changes. You know modern hardware and database software are so fast.
Re: Some one can help me?
Follow Nathan's suggestion. Look up ping query in the developers manual. It will validate the query before it uses it In fact it will validate connection, discard the old one if necessary and opens/return fresh one. On Tue, Apr 14, 2009 at 11:13 PM, yhliu yh...@cn.ufinity.com wrote: Thanks for your reply. okay, the reason of this iusse may be the end transaction method was called but there is not any transaction started in my program, but there are too many classes to correct, it will be cost very high because this section is working with the production. So how can I release the connections when the DB server shut down and get new connection to connecting DB server? 2009-04-15 -- On Tue, Apr 14, 2009 at 10:47 PM, Nathan Maves nathan.ma...@gmail.comwrote: Look up ping query in the developers manual. It will validate the query before it uses it. On Apr 14, 2009, at 8:27 PM, yhliu yh...@cn.ufinity.com wrote: I got a problem that the program will throw close connection exception when the DB server(oracle 10G) shut down and it is unforeseeable, the worse is it will not connect the DB server in a successful manner again when the DB server resurged. After discuss with my colleagues, the point is how can I reconnect the DB server or get new connection from Pool? and what the use's of SqlMapTransactionManager.setUserConnection(...) , Can I use this method to get new connection with DB server? Thx for any help! 2009-04-15 -- yhliu
Re: stored procedure - resultClass example?
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Oracle+REF+CURSOR+Solutions On Tue, Apr 21, 2009 at 12:19 AM, sjpn p...@vignette.com wrote: Hi, I want to use ibatis as the standard for a large project. The client I'm working for does everything in stored procs for performance and transaction mgmt. So I need to be able to use ibatis with stored procs. I have it working for simple insert/update, but when I'm getting back a result set/oracle ref cursor, I'm having trouble working with it. Can anyone provide an example of how to use ibatis to call a stored procedure and get back a list of objects from it? When I get on my other laptop, I can post some of the code I currently have. Thanks, Peter -- View this message in context: http://www.nabble.com/stored-procedure--%3E-resultClass-example--tp23148960p23148960.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: stored procedure - resultClass example?
Maybe this would help http://markmail.org/message/3r7dx4uixs273kxu On Tue, Apr 21, 2009 at 1:33 PM, sjpn p...@vignette.com wrote: could it be possible that ibatis is return back an empty cached resultset? if so, how can i disable this cache or trigger it to clear? -- View this message in context: http://www.nabble.com/stored-procedure--%3E-resultClass-example--tp23148960p23160958.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: problem with the parameter in select clause
Try $thresholdValue$ On Mon, Apr 27, 2009 at 5:43 PM, Alex Sherwin alex.sher...@acadiasoft.comwrote: #thresholdValue# will put '100' in the SQL that is created (note: with single quotes, making it a non-number value) I assume what you want is to use $thresholdValue$, which will explicitly insert that value from your map as: 100 (no quotes, etc) Vasantha Rapuru wrote: Hi All, Below is my query. When I tried to run this in Ibatis, its throwing an exception saying *Syntax Error Occured*. select id=searchQuery resultMap=cityresult parameterClass=map select first #thresholdValue# cityName from city; /select ThresholdValue is set in the map as given below: paramMap.put(thresholdValue,100); Can anybody help to solve this problem. Thanks Regards, Vasantha CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS***
Re: force flushOnExecute without real query
To flush on demand you can just call SqlMapClient.flushDataCache(String cacheId). HTH On Tue, Apr 28, 2009 at 10:32 AM, WhyDontYouSlide whydontyousl...@gmail.com wrote: Hello, I was asking myself if It's possible to force flushing of the cache without execute a real statement for example: the traditinal way is to execute a query defined in somequeryname flushOnExecute statement=somequeryname/ but.. can I simply do nothing instead of calling a statement here? flushOnExecute statement=somequeryname/ select id=somequeryname doing nothing here... / doing this way I could for example be able to call the flush on demand from a DTO outside thx whydontyouslide -- View this message in context: http://www.nabble.com/force-flushOnExecute-without-real-query-tp23274367p23274367.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Looks like iBatis is processing data slowly...
Well, let DBA optimize query, but from the iBatis side maybe it makes sense to increase fetchSize. See e.g. http://markmail.org/message/3vy7p455yr5qkzbk#query:ibatis%20fetchsize+page:1+mid:tgs7lyqlyetn2jfv+state:results On Wed, Apr 29, 2009 at 2:01 AM, Chris O'Connell oconn...@gorillachicago.com wrote: Thanks for the response. I finally got the DBA involved and it looks like the query was executing very slowly on the server. I don't understand everything that goes on in the communication between the driver and the database, but it looks like I was seeing those first results coming back because the database was sending the data over as it got it. Since the query takes 11 seconds to execute, it took 11 seconds for the last row to get sent over. Chris On Tue, Apr 28, 2009 at 4:55 PM, Nathan Maves nathan.ma...@gmail.comwrote: Are the queries being run against the same database? Are the connection pools set up the same on both servers? Is your test(slower) server located somewhere else geographically? Maybe just provide us with a bit more data. On Mon, Apr 27, 2009 at 1:26 PM, Chris O'Connell oconn...@gorillachicago.com wrote: I know that if I were to get a DBA involved, I could get some further details, but I'm trying to get as much information as I can before I start to get the bureaucracy involved... Anyway, I am able to log my sql and the results with no problems. The issue I have is that stuff is just running so slowly on my test server. When I test my code on my local development server (which is talking to a remote database), my 'queryForList' method takes a total of about 2.5 seconds. When I push the code out to my test server (more powerful hardware, etc.), the method takes 10 or 11 seconds. So, I'm trying to figure out if the extra time is occurring on the database server or on the application server. So, I turned up all the logging and I looked at what it is spitting out at me. Of course, takes a bit longer with logging turned on, but not hugely so. I looked at the times of the different statements, and the 'About to execute SQL' log statement shows up at second 0. The next line of the log file is each row of the result set. This is logged in the same 'second' as the line of the 'About to execute'. The next 2000 rows in the log are each of the lines of the result set and it takes 9 or 10 seconds for this to occur. My question is, is this an indication of the database slowly returning the data, or does iBatis really get all of the data back to the application server by the time that first result set record is logged and it really is taking iBatis 10 seconds to go through data on my review server that takes 2 seconds to go through on my dev server. This is a 'hierarchical' query (if that makes sense). The data is in the form of product information and product attribute information. I am using the iBatis 'groupBy' clause in the resultMap to tell iBatis which columns constitute the objects lower down on the hierarchy. Does it makes sense that iBatis would take this long to process the data? Should I look at writing a RowHandler to process this data? Thanks in advance for any comments/help, Chris -- -- Chris O'Connell Application Developer Gorilla 312.243.8777 x19
Re: How to use SqlMapClient
Have I generate for every session an own SqlMapClient or can they share one. I found no example which shows it. Share. It's thread safe.
Re: Identify the record that caused unique constraint violation
It may be database dependent. Here's extract from oracle docs http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/oraperf.htm After a batch exception, the update counts array can be retrieved using the getUpdateCounts() method of the BatchUpdateException object. This returns an int array of update counts, just as the executeBatch() method does. In the Oracle implementation of standard update batching, contents of the update counts array are as follows after a batch exception: - For a prepared statement batch, it is not possible to know which operation failed. The array has one element for each operation in the batch, and each element has a value of -3. According to the JDBC 2.0 specification, a value of -3 indicates that an operation did not complete successfully. In this case, it was presumably just one operation that actually failed, but because the JDBC driver does not know which operation that was, it labels all the batched operations as failures. You should always perform a ROLLBACK operation in this situation.
Re: date doesn't include hours, minutes, seconds
IBatis creates this select: to_date('2009-05-15 23.59.59', '-mm-dd hh24.mi.ss') Well, there's no to_date function in your XML, so iBatis can not create it. It only prepares statement (ps) with AND b.ins_time = ? AND b.ins_time = ? and calls ps.setDate Could you re-check your xml files and re-check iBatis logs, I'm sure iBatis is not 'smart' enough to add Oracle-specific to_date functions to generated sql. On Tue, May 19, 2009 at 10:15 AM, MichaelSK n-b...@post.sk wrote: Hello, I’ve a problem with select that is created by IBatis. In my .xml file I’ve the following statement: SELECT b.id, b.id_credit, b.status, b.tag, b.ins_time, b.modif_time FROM ws.vi_batchcompl b dynamic prepend=WHERE isEqual prepend= AND property=searchFilter.completionStatusType compareValue=1 decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) IN (1, 4) /isEqual isEqual prepend= AND property=searchFilter.completionStatusType compareValue=2 decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) = 2 /isEqual isEqual prepend= AND property=searchFilter.completionStatusType compareValue=3 decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) = 3 /isEqual isEqual prepend= AND property=searchFilter.completionStatusType compareValue=4 decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) = 4 /isEqual isNotNull prepend= AND property=completionInsTimeFrom ![CDATA[b.ins_time = #completionInsTimeFrom#]] /isNotNull isNotNull prepend= AND property=completionInsTimeTo ![CDATA[b.ins_time = #completionInsTimeTo#]] /isNotNull /dynamic Variables completionInsTimeFrom and completionInsTimeTo have type java.util.Date. IBatis creates this select: SELECT b.id, b.id_credit, b.status, b.tag, b.ins_time, b.modif_time FROM ws.vi_batchcompl b WHERE decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) IN (1, 4) AND b.ins_time = to_date('2009-05-11', '-mm-dd') AND b.ins_time = to_date('2009-05-15', '-mm-dd') The problem is that I want to compare the dates using also hours, minutes and seconds. I want this select to look like this: SELECT b.id, b.id_credit, b.status, b.tag, b.ins_time, b.modif_time FROM ws.vi_batchcompl b WHERE decode(status, 'a', 1, 'c', 2, 'n', 3, 'x', 4, NULL) IN (1, 4) AND b.ins_time = to_date('2009-05-11 00.00.00', '-mm-dd hh24.mi.ss') AND b.ins_time = to_date('2009-05-15 23.59.59', '-mm-dd hh24.mi.ss') I cannot use java.util.Timestamp because there is an index on the column and when I use Timestamp Oracle won’t use the index and but uses full scan. Can you please help me how to solve this problem? Michael -- View this message in context: http://www.nabble.com/date-doesn%27t-include-hours%2C-minutes%2C-seconds-tp23613367p23613367.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: FW: Connection Closing Problem
I think what happens to open (pooled) connection upon JVM exit depends on JDBC driver. IMO if you were using SimpleDataSource of iBatis, you'd have to call forceCloseAll() to close all pooled connections at the end of execution of your app (I think I have even used that years ago). Not sure about DBCP, but I bet calling basicDataSource.close() must help. GL On Wed, Jun 3, 2009 at 12:18 AM, Nathan Modrzewski nmodrzew...@eaglexm.comwrote: Not yet…getting ready too. If I’m using Apache Dbcp to handle connection pooling, do I have to manually close the pooling objects?
Re: help to reduce db round-trip
I think the only reliable way to check whether connection is valid is to execute something using the connection (so it requires roundtrip to db). However a) this execution happens only once for your transaction (which may include numbers of CRUD operations etc) b) Validation query is chosen to be simple (like select 1 from dual for oracle), so that performance penalty is minimal. So IMO unless you are designing some realtime application you can stop worrying about additional roundtrip stealing maybe a dozen of milliseconds... On Wed, Jun 10, 2009 at 7:35 AM, jochen songzhou...@gmail.com wrote: Hi all, When I was using the validationQuery and testOnBorrow properties to ensure connection works fine, did it mean two round-trip happened? Validation query and my SQL query? thus, how to reduce the db round-trip while the query became huge? I knew iBatis to mysql would not ensure connection valid while disabling testOnBorrow, if it is the same toward oracle? is there any workaound to reduce db round-trip? any help is appreciated, thanks. Best regards, Joe
Re: issue of ibatis sqlmap list of list
Turn on logging (see iBatis docs) to see what does the generated SQL statement look like. On Fri, Jun 19, 2009 at 7:34 AM, BruceKKK sibyl0...@gmail.com wrote: i met ora-01795 error, so i need separate list to several size limited lists, I am trying use nested iterators to iterate over a List of List using following code: select id=getList parameterClass=map resultClass=com.ResultObject select * from ** where isNotEmpty property=outLists iterate property=outLists open=( close=) conjunction=OR data in iterate property=outLists[] open=( close=) conjunction=, #outLists[].[]# /iterate /iterate /isNotEmpty /select but i got exception: com.ibatis.common.beans.ProbeException: Error getting ordinal list from JavaBean. Cause java.lang.NumberFormatException: For input string: how to make it run? by the way: the version of ibatis i used is 2.1.7 -- View this message in context: http://www.nabble.com/issue-of-ibatis-sqlmap-list-of-list-tp24105006p24105006.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
Re: Issue with special character
Have you tried enclosing field names containing # with *CDATA *? Maybe it will help... On Thu, Jun 25, 2009 at 2:56 PM, markus.k...@bafin.de wrote: Hi, in our DB2 database, some columns have a # in their name, e.g. ID# This conflicts now with the iBatis placeholder character #, e.g. select * from table where ID# = #myId# does not work. Also the resultMap mapping resultMap id=TableResult class=Table result property=id column=ID# / … /resultMap Does not work. Does anybody know, how to escape # in iBatis? Thanks a lot Markus
Re: problem with insert
Is it possible that you just did not set your log file encoding? Kind of log4j.appender.someappender.Encoding=UTF-8 On Tue, Jul 14, 2009 at 8:40 PM, Odelya YomTov ode...@jpost.com wrote: Hi! I am trying to insert data in Hebrew into the database The table is set to utf-8. But in the log file I see: DEBUG [http-12091-Processor24] - Created connection 27901603. DEBUG [http-12091-Processor24] - {conn-10} Connection DEBUG [http-12091-Processor24] - {pstm-11} PreparedStatement: SELECT * FROM users WHERE NAME = ? AND PASSWORD = ? DEBUG [http-12091-Processor24] - {pstm-11} Parameters: [×ž× ×”×œ, ×ž× ×”×œ×™×œ×§×•×˜] DEBUG [http-12091-Processor24] - {pstm-11} Types: [java.lang.String, java.lang.String] DEBUG [http-12091-Processor24] - {rset-12} ResultSet DEBUG [http-12091-Processor24] - Returned connection 27901603 to pool. Which means that I receive rubbish. What can I do to handle it? My browser reads Hebrew all right (I wrote something in struts and I see that the messages that I get back for the user are in Hebrew) - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: problem with insert
Try this thread: http://www.mail-archive.com/user-java@ibatis.apache.org/msg13497.html Seems similar problem was solved there GL On Tue, Jul 14, 2009 at 11:00 PM, Odelya YomTov ode...@jpost.com wrote: Hi! It's not the problem with the log file encoding. It's something is the connection between ibatis and mysql *From:* Nicholoz Koka Kiknadze [mailto:kikna...@gmail.com] *Sent:* Tuesday, July 14, 2009 9:52 PM *To:* user-java@ibatis.apache.org *Subject:* Re: problem with insert Is it possible that you just did not set your log file encoding? Kind of log4j.appender.someappender.Encoding=UTF-8 On Tue, Jul 14, 2009 at 8:40 PM, Odelya YomTov ode...@jpost.com wrote: Hi! I am trying to insert data in Hebrew into the database The table is set to utf-8. But in the log file I see: DEBUG [http-12091-Processor24] - Created connection 27901603. DEBUG [http-12091-Processor24] - {conn-10} Connection DEBUG [http-12091-Processor24] - {pstm-11} PreparedStatement: SELECT * FROM users WHERE NAME = ? AND PASSWORD = ? DEBUG [http-12091-Processor24] - {pstm-11} Parameters: [×ž× ×”×œ, ×ž× ×”×œ×™×œ×§×•×˜] DEBUG [http-12091-Processor24] - {pstm-11} Types: [java.lang.String, java.lang.String] DEBUG [http-12091-Processor24] - {rset-12} ResultSet DEBUG [http-12091-Processor24] - Returned connection 27901603 to pool. Which means that I receive rubbish. What can I do to handle it? My browser reads Hebrew all right (I wrote something in struts and I see that the messages that I get back for the user are in Hebrew) - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals computer viruses.
Re: Prepared Statement cache
Maybe I'm totally wrong, but I'm almost sure it must be possible to force database server to RE-generate execution plans even for cached statements. I've never used DB2 but googling a little I found: http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.ugref/db2z_invalidatestatementscache.htm HTH
Re: PL/SQL package level variables
You are quite right. Your problem is that calls to those two procedures are not in a single transaction. Include them in a single transaction and proc2 will see package level variables set in proc1. Note that executing those procs on a single connection object is not enough (i.e. you need transaction). hth On Tue, Aug 4, 2009 at 8:48 AM, CuriousMind yogeshcjad...@hotmail.comwrote: Hi, I am having 3 procedures which i want to call using IBatis framework. These procedure are using package level variables and hence when I try to call them, it ends up throwing error as the package variable value is not found. Consider following scenario for more details Package level variable = varPK Procedure 1 sets varPK (Package level variable) to SomeValue Procedure 2 tries to check value of varPK and finds that it is empty. I know this could be resolved by writing wrapper procedure which will call above listed procedure in sequence but I am looking for better solution. The problem is that I am migrating existing application to Ibatis framework and hence it is not possible to find out where such scenarios would come. The error that I am facing is probably due to for every call to iBatis API gets different connection object (I am using connection pool and spring integration with ibatis.). I think this can be resolved only if current thread will get same connection instance. Is there any way to ensure that the current thread will always receive same connection instance? -- View this message in context: http://www.nabble.com/PL-SQL-package-level-variables-tp24802267p24802267.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: PL/SQL package level variables
Hm, but I have used package variables at Oracle 9 times (with JDBC though, but iBatis just wraps JDBC) and it worked fine. May I ask how do you handle transactions, and may I look at the code snippet calling those procedures? On Tue, Aug 4, 2009 at 9:44 AM, CuriousMind yogeshcjad...@hotmail.comwrote: Hi Nichol, Thanks for your response. We are already using same transaction while calling these procedures. But we are not getting expected results. Nicholoz Koka Kiknadze wrote: You are quite right. Your problem is that calls to those two procedures are not in a single transaction. Include them in a single transaction and proc2 will see package level variables set in proc1. Note that executing those procs on a single connection object is not enough (i.e. you need transaction). hth On Tue, Aug 4, 2009 at 8:48 AM, CuriousMind yogeshcjad...@hotmail.comwrote: -- View this message in context: http://www.nabble.com/PL-SQL-package-level-variables-tp24802267p24802615.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Separate iBATIS3 mailing list
I've enjoyed much using iBatis and the mailing list was always very helpful. Well, now and then I have to search for answers in the mailing list and usually find the answer ;) So far so good. But... I've used mailing list for another framework - Tapestry for three major versions (3/4/5) and always found it very annoying not to be able to filter for which version I needed to search. Now, as questions about iBatis3 start to pore in I wondered maybe in long run it may be better to have separate mailing list for it. I don't mind subscribing to two lists - my gmail inbox will handle both ;) Wonder what others think...
Re: PL/SQL package level variables
Honestly, I don't quite understand your config. You have tx:annotation-driven transaction-manager=txManager / So I guess you use annotations to mark transactions. In that case you all that advice/pointcut stuff seems redundant. Now as you do not set proxy-target-class=true dont forget that you need to put Transactional annotations at the interface level. On Thu, Aug 20, 2009 at 5:09 PM, CuriousMind yogeshcjad...@hotmail.comwrote: Here is the code snippet for the transaction management bean id=txManager class=org.springframework.jdbc.datasource.DataSourceTransactionManager property name=dataSource ref=dataSource / /bean tx:annotation-driven transaction-manager=txManager / tx:advice id=txAdvice transaction-manager=txManager tx:attributes tx:method name=get* propagation=SUPPORTS read-only=true/ tx:method name=* propagation=REQUIRED rollback-for=java.sql.SQLException,com.framework.exception.types.BusinessException/ /tx:attributes /tx:advice aop:config aop:pointcut id=databaseOperation expression=execution(* com.business.component..*(..))/ aop:advisor advice-ref=txAdvice pointcut-ref=databaseOperation/ /aop:config Here goes the code for ibatis configuration bean id=sqlMapClient class=org.springframework.orm.ibatis.SqlMapClientFactoryBean property name=configLocation value=classpath:com/dataservice/ibatis/config/SQLMapConfig.xml/ property name=dataSource ref=dataSource/ property name=useTransactionAwareDataSource value=true / property name=transactionConfigClass valuecom.ibatis.sqlmap.engine.transaction.external.ExternalTransactionConfig/value /property property name=transactionConfigProperties props prop key=DefaultAutoCommitfalse/prop /props /property /bean Nicholoz Koka Kiknadze wrote: Hm, but I have used package variables at Oracle 9 times (with JDBC though, but iBatis just wraps JDBC) and it worked fine. May I ask how do you handle transactions, and may I look at the code snippet calling those procedures? On Tue, Aug 4, 2009 at 9:44 AM, CuriousMind yogeshcjad...@hotmail.comwrote: Hi Nichol, Thanks for your response. We are already using same transaction while calling these procedures. But we are not getting expected results. -- View this message in context: http://www.nabble.com/PL-SQL-package-level-variables-tp24802267p25061697.html Sent from the iBATIS - User - Java mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Separate iBATIS3 mailing list
No reply... Seems separate list idea is soo absurd that no one bothers to explain why ;) On Tue, Aug 18, 2009 at 10:00 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: I've enjoyed much using iBatis and the mailing list was always very helpful. Well, now and then I have to search for answers in the mailing list and usually find the answer ;) So far so good. But... I've used mailing list for another framework - Tapestry for three major versions (3/4/5) and always found it very annoying not to be able to filter for which version I needed to search. Now, as questions about iBatis3 start to pore in I wondered maybe in long run it may be better to have separate mailing list for it. I don't mind subscribing to two lists - my gmail inbox will handle both ;) Wonder what others think...
Re: Separate iBATIS3 mailing list
No. Lol On Fri, Aug 21, 2009 at 3:23 PM, Larry Meadors larry.mead...@gmail.comwrote: Because it's a bad idea. Happy? Larry On Fri, Aug 21, 2009 at 12:47 AM, Nicholoz Koka Kiknadzekikna...@gmail.com wrote: No reply... Seems separate list idea is soo absurd that no one bothers to explain why ;) On Tue, Aug 18, 2009 at 10:00 PM, Nicholoz Koka Kiknadze kikna...@gmail.com wrote: I've enjoyed much using iBatis and the mailing list was always very helpful. Well, now and then I have to search for answers in the mailing list and usually find the answer ;) So far so good. But... I've used mailing list for another framework - Tapestry for three major versions (3/4/5) and always found it very annoying not to be able to filter for which version I needed to search. Now, as questions about iBatis3 start to pore in I wondered maybe in long run it may be better to have separate mailing list for it. I don't mind subscribing to two lists - my gmail inbox will handle both ;) Wonder what others think... - To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org
Re: Separate iBATIS3 mailing list
#3 - I think I'm the only person who does moderation on the ibatis lists and don't want another one to manage. (NOTE: If someone wants to do that with me, let me know, it's easy, but when I'm out of the office the please subscribe emails pile up). I'll be out of the office till September 6 (hehe, don't worry I have autoreply off). Meanwhile as I watch this list almost on the daily basis I could help in handling those out-of-the-office-please-unsubscribe-enlarge-something things after that. Or what else does moderation mean?
Re: Problem calling Stored function in Oracle
Though I've never used oraclecursor with iBatis, I'll dare to note that from the image attached I see that parametermap property for the ORALECURSOR is the last one in the map. But it must be the first one (order parameter map properties must match order of ?,?... ). On Fri, Aug 21, 2009 at 8:18 PM, M V Chetan chetan.minaj...@tcs.com wrote: Hi, I'm facing certain problems in getting my ibatis mapping to work with an oracle stored function Here is my mapping -- { ? = call PKG_SEARCH_LIST.F_COMPANY_LIST(?,?,?,?,?,?,?,?) } -- The error that I get is * PLS-00306: wrong number or types of arguments in call to 'F_COMPANY_LIST' ORA-06550: line 1, column 7: PL/SQL: Statement ignored * The stored function is as follows -- * CREATE OR REPLACE PACKAGE BODY PKG_SEARCH_LIST AS FUNCTION F_COMPANY_LIST(p_Company varchar2,p_EntFromDt date, p_EntToDt date, p_LstModFromdt date, P_LstModToDt date, p_TransStatus varchar2, p_sort varchar2, p_QueryType varchar2) RETURN pkg_crs_util.ref_cursor IS ret_cursor pkg_crs_util.ref_cursor; BEGIN OPEN ret_cursor for select 1 parent_flg, 'Company1'company, null active_status ,null role, null security, null Deal_Fr_Dt, null Deal_To_Dt, null Deal_Title, null Deal_type from dual union select 0 parent_flg , 'Company1' company, 'Y' active_status ,1 role, 'xyz' security, sysdate Deal_Fr_Dt, sysdate Deal_To_Dt, 'Mydeal' Deal_Title,'Financing' Deal_type from dual order by parent_flg desc ; RETURN ret_cursor; END; END PKG_SEARCH_LIST; * -- Can someone please point out where I am going wrong? Regards, Chetan -- View this message in context: Problem calling Stored function in Oraclehttp://www.nabble.com/Problem-calling-Stored-function-in-Oracle-tp25082929p25082929.html Sent from the iBATIS - User - Java mailing list archivehttp://www.nabble.com/iBATIS---User---Java-f370.htmlat Nabble.com.