Any advice on using iBatis in a web service architecture
I'm aware that iBatis supports both input and output maps in the form of XML documents, but has anyone here used output result maps directly as web service object maps? How does this compare with the use of JDBC's WebRowSet - any comments are welcome. Kind regards Abdullah
Re: R: Query performs differently in SQL Query Analyzer [SOLVED]
Fabrizio Gianneschi wrote: The Microsoft JDBC driver for SQLServer is ***very*** buggy. We haven't had any serious performance problems with MS JDBC. Could this be the nvarchar unicode issue? http://groups.google.co.za/group/microsoft.public.sqlserver.jdbcdriver/browse_thread/thread/c11b52262f313bcb/db54939e2f1bb042?q=jdbc+unicode+performance+microsoft+SendStringParametersAsUnicode+kauchalirnum=1hl=en#db54939e2f1bb042
Re: Custom XML Resultmaps
U, I suppose we can, but that's another server-side processing we have to do then. What I'm looking for is the possibility of producing XML directly from the JDBC Resultset? Does the framework allow for extending them? Kind regards Abdullah Larry Meadors wrote: Could you transform it with XSLT? Larry On 5/12/05, *Abdullah Kauchali* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Is it possible to extend the current XML Resultmap format to a new custom one? Don't ask!, but were are investigating the possibility of returning XML in Microsoft's ADO format. Any general advice on this would be greatly appreciated, Kind regards Abdullah
Re: Custom XML Resultmaps
Hi Ron, That would have been ideal, but we are catering for a Win32 Application that deals with ADO 2.8 not ADO.NET. So we have to produce the ADO-XML Reduced schema. What we need specifically is the Resultset meta-data - column types, sizes etc. Kind regards, Abdullah Ron Grabowski wrote: Do you want to have IBatis generate an xml file that can be loaded by a DataSet's ReadXml method? Here's an example for the non-.Net people of one way of saving a DataSet to XML: DataSet ds = new DataSet(People); DataTable dt = new DataTable(Person); dt.Columns.Add(Name, typeof(string)); dt.Columns.Add(Age, typeof(int)); DataRow dr = dt.NewRow(); dr[Name] = Ron; dr[Age] = 99; dt.Rows.Add(dr); ds.Tables.Add(dt); ds.WriteXml(output.xml); People Person NameRon/Name Age99/Age /Person /People Except for the outer People node, I believe IBatis can generate that already. --- Abdullah Kauchali [EMAIL PROTECTED] wrote: Is it possible to extend the current XML Resultmap format to a new custom one? Don't ask!, but were are investigating the possibility of returning XML in Microsoft's ADO format. Any general advice on this would be greatly appreciated, Kind regards Abdullah
Re: Custom Tag
Brandon Goodin wrote: I see. The question here is whether this is a common database issue and if it should be supported. However, it does not seem to be a common issue and there are ways to work around this. My other thought is why do you have over 250+ IN parameters? My guess: they have a large table with a foreign key. When they do a select for this large table, they also want to obtain the parent table values specific only to *that* resultset. So we have: ChildTable ID COL1COL2FK_ID -- 001 ABCASD1 002 EDFASE 1 003 EDW746 2 (SELECT * FROM ChildTable) Now they want to do this: SELECT * FROM ParentTable where FK_ID IN ('1', '2') In two round-trips, you have Master-detail.
Custom XML Resultmaps
Is it possible to extend the current XML Resultmap format to a new custom one? Don't ask!, but were are investigating the possibility of returning XML in Microsoft's ADO format. Any general advice on this would be greatly appreciated, Kind regards Abdullah
Re: Advice sought: Designing cached User Session objects
Hi Clinton, (Thanks for commenting - really appreciated.) Is your suggestion that we'd rather interface with OSCache directly (and separately) instead of relying on the integrated iBatis approach? Can you briefly explain how that would afford us better performance instead? (To be honest, I'd feel more comfortable :) to stick with the existing integrated architecture of iBatis' caching!) Also, we had prototyped a hack in a 1.3.x release of iBatis where we modified iBatis code to mutate the cached object directly (I recall asking whether a public API could be made available ...). That hack seemed to work, but the project never really got off the ground and so we couldn't test it in controlled environment. Would that approach not be advisable to take with the latest version of iBatis? Thanks once again for your assistance, Kind regards, Abdullah Clinton Begin wrote: I would suggest you don't use the iBATIS cache and instead write your own. It's been proven to me numerous times that an application (i.e. business domain) level cache cannot be beaten in terms of performance. This is especially true considering your complex requirements. Alternatively, you could try taking one of the open source caches (OSCache, EHCache) or even a commercial one (Tangosol Coherence) and modify it or extend it to your needs. Cheers, Clinton
Re: MS SQL Server 2000 connection reset problem
Some guesses: * If you are using transactions, make sure you are commiting/rolling back the transactions. * Perhaps connection pool is not working and the number of server connection hits maximum: check sql server connection property, set Maximum Allowable Connection to zero (0) = no maximum. * Do sp_who on the server to see number of concurrent connections * Do netstat -n to see live TCP/IP connection on the client (many connections for a single user is telltale sign of leaky connection objects) HTH, Abdullah Brent Ryan wrote: Message I'm using Ibatis 2 with a web app and I get the following error after connecting to the data source and then letting it sit for 2 minutes and then retrying my web applicaiton. ERROR:2005-03-17 10:35:57,379 - Failed to queryForList - id [getUsers], parameterObject [null]. Cause: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error Here's my sql map config: transactionManager type=JDBC dataSource type=DBCP property name=JDBC.Driver value=${driver}/ property name=JDBC.ConnectionURL value=${url}/ property name=JDBC.Username value=${username}/ property name=JDBC.Password value=${password}/ property name=JDBC.DefaultAutoCommit value=true/ property name=Pool.MaximumActiveConnections value=20/ property name=Pool.MaximumIdleConnections value=5/ property name=Pool.MaximumWait value=12/ property name=Pool.TimeToWait value=500/ property name=Pool.PingQuery value=select 1 from BBEXTRACT.USERS/ property name=Pool.PingEnabled value=true/ property name=Pool.PingConnectionsOlderThan value=1/ property name=Pool.PingConnectionsNotUsedFor value=1/ /dataSource /transactionManager Thanks, !-- A.psl { TEXT-DECORATION: none; COLOR: #4e81c4; FONT-FAMILY: Verdana,Arial,fixed } A:hover { TEXT-DECORATION: underline } A.psl:hover { COLOR: #99 } .noro { FONT-SIZE: 8pt; COLOR: #4e81c4; FONT-FAMILY: Verdana,Arial,fixed } .logotext { TEXT-DECORATION:none; FONT-SIZE: 10pt; FONT-FAMILY: Verdana,Arial,fixed } A.brand { COLOR: #77; FONT-SIZE: 7pt; FONT-FAMILY: Verdana,Arial,fixed; TEXT-DECORATION: none } -- Brent Ryan *Don't miss the 2005 Blackboard Users Conference April 12-14 in Baltimore, MD! Visit **http://www.blackboard.com/about/events/BbUC05/index.htm** for more information.* This e-mail is intended only for the personal and confidential use of the recipient(s) named above. It may include Blackboard confidential and proprietary information, and is not for redistribution.
Re: MS SQL Server 2000 connection reset problem
Brent Ryan wrote: For some reason the datasource isn't running the ping command to check the connections. They seem to be timing out. Is there a setting in SQL Server that causes connections to timeout? What version of SQL Server are you using?
Re: MS SQL Server 2000 connection reset problem
Brent Ryan wrote: * The commiting/rolling back is handled by the datasource automatically. * The max allowable connection is set to 0 * netstat -n on client and server show 3 connections established. If I set this property to 0 then it works, but then this means there is nothing in the pool. Right? property name=Pool.MaximumIdleConnections value=0/ Also, can you post the SQL statement?
Re: MS SQL Server 2000 connection reset problem
Hi Brent, I think your best bet would be to talk to the folks at the JDBC forum on the Microsoft newsgroups. I've had a terrible week with SQL Server too. :) Sorry I couldn't be of further help, Abdullah Brent Ryan wrote: I'm running SQL Server 2000 8.00.760. The connection reset problem happens for any sql statement, but the ones that I'm testing are: select id=getUsers resultMap=userResult select * from BBEXTRACT.USERS /select select id=getRoles resultMap=roleResult select * from BBEXTRACT.ROLES /select I never had this problem when connection to a Oracle DB. This only happens when connecting to MS SQL Server. Brent Ryan -Original Message- From: Abdullah Kauchali [mailto:[EMAIL PROTECTED] Sent: Thursday, March 17, 2005 11:22 AM To: ibatis-user-java@incubator.apache.org Subject: Re: MS SQL Server 2000 connection reset problem Brent Ryan wrote: * The commiting/rolling back is handled by the datasource automatically. * The max allowable connection is set to 0 * netstat -n on client and server show 3 connections established. If I set this property to 0 then it works, but then this means there is nothing in the pool. Right? property name=Pool.MaximumIdleConnections value=0/ Also, can you post the SQL statement? Don't miss the 2005 Blackboard Users Conference April 12-14 in Baltimore, MD! Visit http://www.blackboard.com/about/events/BbUC05/index.htm for more information. This e-mail is intended only for the personal and confidential use of the recipient(s) named above. It may include Blackboard confidential and proprietary information, and is not for redistribution.
OT: Richard Grimes on .NET
Off-topic: But hellova interesting! (I was reading a thread on TSS the other night about .NET and Java where Clinton spoke of being impartial to either frameworks - I quite agree. Here's an article that depicts some of the silent thoughts in all of us about .NET... If you enjoy Grimes' writing, this one would be no different.) http://www.ddj.com/documents/s=9205/ddj050201dnn/ Kind regards Abdullah
Re: selectKey for Informix
select dbinfo('sqlca.errd1') from TABLENAME works for me ... the first column of the JDBC resultset will be the newly inserted value. Fire this immediately after your insert. HTH, Abdullah Clinton Begin wrote: Okay, you've posted this enough times. We've seen it and have responded. My suggestion is that you talk to Informix support about standard ways to access the serial generated ID. This issue barely has anything to do with iBATIS, it has more to do with Informix and your connection pool. Cheers, Clinton On Tue, 8 Feb 2005 16:26:27 -0800 (PST), Roger Baeza [EMAIL PROTECTED] wrote: Hello all Could any one help me, pls I'm looking for selectKey sintaxis to get serial value after inserting any row in tables for informix database... I was use getSerial() for ifxStatement JDBC class, but I moving to iBatis, I can't undertand what is the correct form tu use selectKey documentation say: for oracle selectKey resultClass=int keyProperty=id SELECT STOCKIDSEQUENCE.NEXTVAL AS ID FROM DUAL /selectKey for sqlServer selectKey resultClass=int keyProperty=id SELECT @@IDENTITY AS ID /selectKey for mysql selectKey resultClass=int keyProperty=id SELECT GET_LAST_ID() AS ID /selectKey Infomix have serial datatype that autogerate ID, example Create Table Addrees( addressId serial not null primary, ); Thanks alote regards __ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com
Re: What is N+1
What about relationships from the child up to the parent? Are they also classified as N+1? Suppose we have child table with a fk of parent_id. if I do: SELECT * from CHILD I'll get a column with parent_id with values. Now suppose I also want details pertaining to the parent_id along with the recordset of Child, I need not do 10 separate selects for the parent ... is this also an N+1 problem? What is the preferred iBatis model for this? Cheers Abdullah Kris Jenkins wrote: friendVU admin wrote: What is n+1? .V n++! :-P It's when each child object in a complex query has to be selected seperately. If 'parent' has 10 'children', you end up with 10+1 select statements being issued. See the developer's guide under 'Avoiding N+1 selects' for the full lowdown. Version 2.0.9 comes with new groupBy goodness to banish the N+1 problem. Kris
Re: What is N+1
Ok, the flip-side of this approach is that you increase the size of the returned result by N*(size of the lookup). So if the lookup is 10 bytes and you are fetching 10 records of the child, your payload size is 100 bytes instead of 10 bytes. ( I wonder if JDBC makes some internal optimisations - keeps a pointer or something to same record if duplicates exist?) That's not a problem per se, but which one is better: 1. This approach or ... 2. Using an in clause and making another round-trip? Cheers Abdullah Michal Malecki wrote: Well, I think you need only simple join in your sql, no extra features of ibatis needed: select * from CHILD, PARENT where parent_id=PARENT.id; am I right? Michal Malecki What about relationships from the child up to the parent? Are they also classified as N+1? Suppose we have child table with a fk of parent_id. if I do: SELECT * from CHILD I'll get a column with parent_id with values. Now suppose I also want details pertaining to the parent_id along with the recordset of Child, I need not do 10 separate selects for the parent ... is this also an N+1 problem? What is the preferred iBatis model for this? Cheers Abdullah Kris Jenkins wrote: friendVU admin wrote: What is n+1? .V n++! :-P It's when each child object in a complex query has to be selected seperately. If 'parent' has 10 'children', you end up with 10+1 select statements being issued. See the developer's guide under 'Avoiding N+1 selects' for the full lowdown. Version 2.0.9 comes with new groupBy goodness to banish the N+1 problem. Kris
Re: What is N+1
Qualification: Ok, the flip-side of this approach is that you increase the size of the returned result by N*(size of the lookup). Where N = number of records with *unique* parents.
Re: R: What is N+1
Clinton, I can see the point when friendlyVU (???) spoke about getting details of the appropriate parent. Appropriate being the operative word. (Lazy loading) In all our database applications, we have *seldom* required the need to work off a list of Categories then require to display (use) all the children of the different Categories viz. all the different products of the *different* Categories. We never needed it somehow. What we have required, however, is the proces the other way round. Where we work off a list of Products and while busy with them we require the details of their Categories. So, it is n+1 the other way round??? Currently we are using a second select with a IN statement containing a comma delimited entries of the unique parents. We then do the mapping in code. What are your thoughts on this? Kind regards Abdullah Clinton Begin wrote: Vic, I'm not sure what you're point was, but N+1 selects is THE most common relational databases performance problem caused by application developers today. Understanding it is critical if you want to avoid making this mistake. Not every application will have the luxury of simply being 1:1 Table:Screen. In fact, I've almost never seen this to be the case in enterprise applications. Consider a 3 tier hierarchy like in JPetStore: Categories -1---M- Products -1M- Items. For illustration purposes, the number of queries to load this data with an immediate or lazy load strategy is: 1 * count(categories) * count(Products) SNIPPED
Re: iBatis and EJB
Great stuff Clinton.Somehow, I'm surprised. :) {Shoot!} That should have been: Somehow, I'm *NOT* surprised!. :( Abdullah ps. that's what happens when you work with .NET