You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by "Svancara, Randall - CO 7th" <Sv...@idhw.state.id.us> on 2006/03/28 18:35:56 UTC

DataAccess problems

I have implemented IBATIS data access and data mapper.  I have been
looking at the Subversion repository for examples of how to implement
IBATIS.

Right now I am receiving an error:


ERROR 4722778ms [672              ] AccountService         .ctor
- ** Error: 
- The error occurred while configure DaoSessionHandler.
- The error occurred in <property name="resource" value="SqlMap.config"
xmlns="http://ibatis.apache.org/dataAccess" />.  
- Check the
IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler.
'Test.Client.vshost.exe' (Managed): Loaded 'D:\Data\Visual Studio
2005\Projects\IBATIS_TEST\Test.Client\bin\Debug\IBatisNet.DataMapper.dll
', No symbols loaded.
A first chance exception of type
'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
IBatisNet.DataAccess.dll
A first chance exception of type
'IBatisNet.DataAccess.Exceptions.DataAccessException' occurred in
Test.Service.dll
The program '[1548] Test.Client.vshost.exe: Managed' has exited with
code 0 (0x0).

Here is my dao.config:

<?xml version="1.0" encoding="utf-8"?>
<daoConfig  xmlns="http://ibatis.apache.org/dataAccess" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <context id="SqlMapDao" default="true">


    <!-- ==== Sql Server : SqlClient configuration ========= -->
		<database>
      <provider name="sqlServer1.1"/>
			<dataSource name="SqlServer"
connectionString="data source=(local)\NetSDK;database=TEST;user
id=sa;password=dofa7h;connection reset=false;connection lifetime=5; min
pool size=1; max pool size=50"/>
		</database>

    <daoSessionHandler id="SqlMap">
      <property name="resource" value="SqlMap.config"/>
    </daoSessionHandler>

    <daoFactory>
      <dao
interface="Test.Persistance.Dao.Interface.Accounts.IaccountDao,
Test.Persistance.Dao"
implementation="Test.Persistance.Dao.Implementations.Accounts.AccountDao
, Test.Persistance.Dao"/>
    </daoFactory>
  </context>

</daoConfig>

Here is my SqlMap.config:

<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >


  <settings>
		<setting useStatementNamespaces="false"/>
		<setting cacheModelsEnabled="true"/>
	</settings>
			
	<!-- ==== SqlClient configuration =========	-->
	<!-- Optional ( default ) -->
	<!-- Rem : If used with a Dao it will be ignored -->
	<database>
		<provider name="sqlServer1.1"/>
    <dataSource name="SqlServer" connectionString="data
source=(local)\NetSDK;database=TEST;user
id=sa;password=dofa7h;connection reset=false;connection lifetime=5; min
pool size=1; max pool size=50"/>
  </database>

	<sqlMaps>
		<sqlMap resource="Maps/Account.xml"/>
	</sqlMaps>
</sqlMapConfig>

I can not figure out why I am getting this error message.  The line of
code that throws and error for me is "builder.Configure("dao.config");"

I am using Visual Studio 2005/.net 2.0.

Thanks,


Randall Svancara
Web Developer

The information contained in this email may be privileged, confidential or otherwise protected from disclosure.  All persons are advised that they may face penalties under state and federal law for sharing this information with unauthorized individuals.  If you received this email in error, please reply to the sender that you have received this information in error.  Also, please delete this email after replying to the sender.

RE: MySpace.com

Posted by Christopher Bissell <ch...@enhypniomancy.com>.
Just checked with the aboves... yes, we're totally cool to go on the
feedback and Powered By page.
 
Chris

  _____  

From: Clinton Begin [mailto:clinton.begin@gmail.com] 
Sent: Wednesday, March 29, 2006 7:49 PM
To: user-cs@ibatis.apache.org
Subject: Re: MySpace.com



And on the "Powered By" page...

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Powered+by+iBA
TIS
<http://opensource.atlassian.com/confluence/oss/display/IBATIS/Powered+by+iB
ATIS> 

Thanks for sharing this Chris, it made my day.  :-)  And good job to our
fantastic .NET team...you guys are really doing a great job.  

Cheers,
Clinton



On 3/29/06, Roberto R <ro...@gmail.com> wrote: 

Chris,

Do you mind if we post the text of your email to our user feedback page?
The iBATIS.NET  <http://iBATIS.NET> section is a little sparse at the
moment.  :-)

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Feedback+and+E
xperiences


Roberto



On 3/29/06, Christopher Bissell <  <ma...@enhypniomancy.com>
chris@enhypniomancy.com> wrote: 


Hello everyone,

I didn't want to talk about it until it was a 'core' piece of our 
architecture, but MySpace.com is now running IBatis for a good portion of
its data access abstraction layer.

We like the flexibility.  I came in from a 'heavier' ORM background but very
much appreciated the configurability IBatis offers against a changing data 
storage medium, because we have a whole range of heavily denormalized
databases.

The performance takes a hit due to the multiple reflection calls made
through the system, but we ate that in the name of a nicely abstracted 
back-end tier, and with thoughts towards the possibility of using emitted
classes to someday improve performance.  (A natural evolution of this kind
of model in the context of the CLR). If there's any efforts we can make in 
that direction, please let me know.

The only performance optimization we've made so far is to ensure that the
call to pre-load stored procedure parameters borrows the already-open
connection of the IDalSession above it.  We saw that under super-heavy load 
the fact that the sproc parameter populator tried to grab its own connection
within the connection of its parent that a semi-deadlock situation would
result, because the parameter populator does all its work in a heavy lock. 
Interested in hearing why this was done, because we definitely got a big
boost on app startup post-optimization.

All-in-all I really like the system.  I thought it was pretty cool that the
SqlMapper interface was so nicely abstracted that you could plug in generic 
collections from 2.0 without a rewrite:

List<MyObject> l = new List<MyObject>();
Mapper.QueryForList("GetMyObjects",myParam,l);

Wishlist?

*Like I said above, emitted types for populating and instantiating result 
objects could very well be revolutionary--I'm not aware of an existing
framework that robustly does this.

*Syntactically, better support in the mapping files for stored procedure
parameters.  We like the inline parameter methods you can use with dynamic 
SQL, would be nice to have a way to use that with sprocs too.

*Better decoupling of SqlMappers from physical databases / db connections.
Decoupling is implicit in the object model, but it's difficult to use the 
SqlMapper as 'just' a repository of maps, rather than as an abstraction in
front of a physical database.

Anyways, this is a truly excellent project and we'd like to help any way we
can.  This is the best model I've seen for a well structured but heavily 
decoupled object -> db scenario.

Chris Bissell
Managing Architect
MySpace.com







Re: MySpace.com

Posted by Clinton Begin <cl...@gmail.com>.
And on the "Powered By" page...

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Powered+by+iBATIS

Thanks for sharing this Chris, it made my day.  :-)  And good job to our
fantastic .NET team...you guys are really doing a great job.

Cheers,
Clinton


On 3/29/06, Roberto R <ro...@gmail.com> wrote:
>
> Chris,
>
> Do you mind if we post the text of your email to our user feedback page?
> The iBATIS.NET section is a little sparse at the moment.  :-)
>
>
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/Feedback+and+Experiences
>
> Roberto
>
>
> On 3/29/06, Christopher Bissell < chris@enhypniomancy.com> wrote:
> >
> >
> > Hello everyone,
> >
> > I didn't want to talk about it until it was a 'core' piece of our
> > architecture, but MySpace.com is now running IBatis for a good portion
> > of
> > its data access abstraction layer.
> >
> > We like the flexibility.  I came in from a 'heavier' ORM background but
> > very
> > much appreciated the configurability IBatis offers against a changing
> > data
> > storage medium, because we have a whole range of heavily denormalized
> > databases.
> >
> > The performance takes a hit due to the multiple reflection calls made
> > through the system, but we ate that in the name of a nicely abstracted
> > back-end tier, and with thoughts towards the possibility of using
> > emitted
> > classes to someday improve performance.  (A natural evolution of this
> > kind
> > of model in the context of the CLR). If there's any efforts we can make
> > in
> > that direction, please let me know.
> >
> > The only performance optimization we've made so far is to ensure that
> > the
> > call to pre-load stored procedure parameters borrows the already-open
> > connection of the IDalSession above it.  We saw that under super-heavy
> > load
> > the fact that the sproc parameter populator tried to grab its own
> > connection
> > within the connection of its parent that a semi-deadlock situation would
> > result, because the parameter populator does all its work in a heavy
> > lock.
> > Interested in hearing why this was done, because we definitely got a big
> > boost on app startup post-optimization.
> >
> > All-in-all I really like the system.  I thought it was pretty cool that
> > the
> > SqlMapper interface was so nicely abstracted that you could plug in
> > generic
> > collections from 2.0 without a rewrite:
> >
> > List<MyObject> l = new List<MyObject>();
> > Mapper.QueryForList("GetMyObjects",myParam,l);
> >
> > Wishlist?
> >
> > *Like I said above, emitted types for populating and instantiating
> > result
> > objects could very well be revolutionary--I'm not aware of an existing
> > framework that robustly does this.
> >
> > *Syntactically, better support in the mapping files for stored procedure
> > parameters.  We like the inline parameter methods you can use with
> > dynamic
> > SQL, would be nice to have a way to use that with sprocs too.
> >
> > *Better decoupling of SqlMappers from physical databases / db
> > connections.
> > Decoupling is implicit in the object model, but it's difficult to use
> > the
> > SqlMapper as 'just' a repository of maps, rather than as an abstraction
> > in
> > front of a physical database.
> >
> > Anyways, this is a truly excellent project and we'd like to help any way
> > we
> > can.  This is the best model I've seen for a well structured but heavily
> >
> > decoupled object -> db scenario.
> >
> > Chris Bissell
> > Managing Architect
> > MySpace.com
> >
> >
> >
>

Re: MySpace.com

Posted by Roberto R <ro...@gmail.com>.
Chris,

Do you mind if we post the text of your email to our user feedback page?
The iBATIS.NET section is a little sparse at the moment.  :-)

http://opensource.atlassian.com/confluence/oss/display/IBATIS/Feedback+and+Experiences

Roberto

On 3/29/06, Christopher Bissell <ch...@enhypniomancy.com> wrote:
>
>
> Hello everyone,
>
> I didn't want to talk about it until it was a 'core' piece of our
> architecture, but MySpace.com is now running IBatis for a good portion of
> its data access abstraction layer.
>
> We like the flexibility.  I came in from a 'heavier' ORM background but
> very
> much appreciated the configurability IBatis offers against a changing data
> storage medium, because we have a whole range of heavily denormalized
> databases.
>
> The performance takes a hit due to the multiple reflection calls made
> through the system, but we ate that in the name of a nicely abstracted
> back-end tier, and with thoughts towards the possibility of using emitted
> classes to someday improve performance.  (A natural evolution of this kind
> of model in the context of the CLR). If there's any efforts we can make in
> that direction, please let me know.
>
> The only performance optimization we've made so far is to ensure that the
> call to pre-load stored procedure parameters borrows the already-open
> connection of the IDalSession above it.  We saw that under super-heavy
> load
> the fact that the sproc parameter populator tried to grab its own
> connection
> within the connection of its parent that a semi-deadlock situation would
> result, because the parameter populator does all its work in a heavy lock.
> Interested in hearing why this was done, because we definitely got a big
> boost on app startup post-optimization.
>
> All-in-all I really like the system.  I thought it was pretty cool that
> the
> SqlMapper interface was so nicely abstracted that you could plug in
> generic
> collections from 2.0 without a rewrite:
>
> List<MyObject> l = new List<MyObject>();
> Mapper.QueryForList("GetMyObjects",myParam,l);
>
> Wishlist?
>
> *Like I said above, emitted types for populating and instantiating result
> objects could very well be revolutionary--I'm not aware of an existing
> framework that robustly does this.
>
> *Syntactically, better support in the mapping files for stored procedure
> parameters.  We like the inline parameter methods you can use with dynamic
> SQL, would be nice to have a way to use that with sprocs too.
>
> *Better decoupling of SqlMappers from physical databases / db connections.
> Decoupling is implicit in the object model, but it's difficult to use the
> SqlMapper as 'just' a repository of maps, rather than as an abstraction in
> front of a physical database.
>
> Anyways, this is a truly excellent project and we'd like to help any way
> we
> can.  This is the best model I've seen for a well structured but heavily
> decoupled object -> db scenario.
>
> Chris Bissell
> Managing Architect
> MySpace.com
>
>
>

Re: MySpace.com

Posted by Gilles Bayon <ib...@gmail.com>.
You could attach to Jira Ticket
*IBATISNET-151*<http://issues.apache.org/jira/browse/IBATISNET-151>

Thanks
-Gilles


On 3/30/06, Christopher Bissell <ch...@enhypniomancy.com> wrote:
>
>  Thanks very much Gilles,
>
> How would you like the files, in a ZIP via email?
>
> I'll start looking at the latest revisions concerning the emit call.
> Would definately love to see that.  We do heavy peformance testing on the
> codebase, and watching those reflection calls go down would make this
> framework scream.
>
> Another subproject we have is to use the extensibility interfaces in
> IBatis's caching mechanism to plug into our middle tier caching layer.  I'll
> keep you posted on that scenario.
>
> Chis
>
>  ------------------------------
> *From:* Gilles Bayon [mailto:ibatis.net@gmail.com]
> *Sent:* Wednesday, March 29, 2006 9:02 AM
>
> *To:* user-cs@ibatis.apache.org
> *Subject:* Re: MySpace.com
>
>
>
> Hi Chris,
>
> Thank for your mail, do you really speak of the same site described in
> this URL ?
> http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx
>
> To by pass reflection use and improve performance, the last source in SVN
> allow us to replace reflection usage by emit call.
> If you have any suggestions or optimizations, we will glad to incorporate
> them.
>
> If you want to post a patch for the store procedure populator improvement
> that you have made, I will Incorporated it.
>
> To remember your whishlist, I will create some Jira tickets.
> Fell free to post more details, your help is welcome.
>
> Cheers
> -Gilles
>
>

RE: MySpace.com

Posted by Ron Grabowski <ro...@yahoo.com>.
Either a zip file or open a new issue here:

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

--- Christopher Bissell <ch...@enhypniomancy.com> wrote:

> Thanks very much Gilles,
>  
> How would you like the files, in a ZIP via email?  
>  
> I'll start looking at the latest revisions concerning the emit call. 
> Would
> definately love to see that.  We do heavy peformance testing on the
> codebase, and watching those reflection calls go down would make this
> framework scream.
>  
> Another subproject we have is to use the extensibility interfaces in
> IBatis's caching mechanism to plug into our middle tier caching
> layer.  I'll
> keep you posted on that scenario.
>  
> Chis
> 
>   _____  
> 
> From: Gilles Bayon [mailto:ibatis.net@gmail.com] 
> Sent: Wednesday, March 29, 2006 9:02 AM
> To: user-cs@ibatis.apache.org
> Subject: Re: MySpace.com
> 
> 
> 
> Hi Chris,
> 
> Thank for your mail, do you really speak of the same site described
> in this
> URL ?
> http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx
> <http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx> 
> 
> To by pass reflection use and improve performance, the last source in
> SVN
> allow us to replace reflection usage by emit call.
> If you have any suggestions or optimizations, we will glad to
> incorporate
> them.
> 
> If you want to post a patch for the store procedure populator
> improvement
> that you have made, I will Incorporated it.
> 
> To remember your whishlist, I will create some Jira tickets.
> Fell free to post more details, your help is welcome.
> 
> Cheers
> -Gilles
> 
> 
> 
> 


RE: MySpace.com

Posted by Christopher Bissell <ch...@enhypniomancy.com>.
Thanks very much Gilles,
 
How would you like the files, in a ZIP via email?  
 
I'll start looking at the latest revisions concerning the emit call.  Would
definately love to see that.  We do heavy peformance testing on the
codebase, and watching those reflection calls go down would make this
framework scream.
 
Another subproject we have is to use the extensibility interfaces in
IBatis's caching mechanism to plug into our middle tier caching layer.  I'll
keep you posted on that scenario.
 
Chis

  _____  

From: Gilles Bayon [mailto:ibatis.net@gmail.com] 
Sent: Wednesday, March 29, 2006 9:02 AM
To: user-cs@ibatis.apache.org
Subject: Re: MySpace.com



Hi Chris,

Thank for your mail, do you really speak of the same site described in this
URL ?
http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx
<http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx> 

To by pass reflection use and improve performance, the last source in SVN
allow us to replace reflection usage by emit call.
If you have any suggestions or optimizations, we will glad to incorporate
them.

If you want to post a patch for the store procedure populator improvement
that you have made, I will Incorporated it.

To remember your whishlist, I will create some Jira tickets.
Fell free to post more details, your help is welcome.

Cheers
-Gilles




Re: MySpace.com

Posted by Gilles Bayon <ib...@gmail.com>.
Hi Chris,

Thank for your mail, do you really speak of the same site described in this
URL ?
http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx

To by pass reflection use and improve performance, the last source in SVN
allow us to replace reflection usage by emit call.
If you have any suggestions or optimizations, we will glad to incorporate
them.

If you want to post a patch for the store procedure populator improvement
that you have made, I will Incorporated it.

To remember your whishlist, I will create some Jira tickets.
Fell free to post more details, your help is welcome.

Cheers
-Gilles

Re: MySpace.com

Posted by Michael Schall <mi...@gmail.com>.
I need the ability to inspect a command object before it is executed
and after is executed.  We have our own replication strategy that will
ship of data altering sql statements to several databases and then
execute them.  Currently the command object executed is not available.
 I have altered the source to call back to my own code passing the
command object,  I store the parameters and start a stopwatch.  After
the command is executed I store the parameters and the amount of time
to execute.

As far as what else it could be used for...  Altering query timeout
per sp...  Profiling statements...  I can't think of any other great
use right off, but it sure would make my easier I hope it makes it
into the codebase.

Would it help if I said "Please!" :)
Thanks
Mike

On 3/30/06, Ron Grabowski <ro...@yahoo.com> wrote:
> That code doesn't exist yet. I was only using it as an example. I'm
> curious to know why you would want to use that syntax for insert and
> update statements instead of the normal way of doing things. I agree it
> would be a useful feature...I'm just curious what other people would
> use it for.
>

Re: MySpace.com

Posted by Ron Grabowski <ro...@yahoo.com>.
That code doesn't exist yet. I was only using it as an example. I'm
curious to know why you would want to use that syntax for insert and
update statements instead of the normal way of doing things. I agree it
would be a useful feature...I'm just curious what other people would
use it for.

--- Michael Schall <mi...@gmail.com> wrote:

> This is a beautiful thing!  I did not know this was a possibility! 
> So
> this will create the command object fill the parameters and leave the
> execution to me?  I would only use this for inserts and updates so I
> don't really care about the resultMap portion, but this is the exact
> anser to my post months ago about needing to execute code before and
> after the command is executed.  What version of code do I need to use
> this functionality?
> 
> > Do you have cases where you just need the underlying statement:
> >
> >  IMappedStatement mappedStatement =
> >   sqlMapper.GetMappedStatement("Select");
> >
> > Then you can execute that statement on your own?
> >
> >  // populate IDbCommand and its parameter collection
> >  IDbCommand command = mappedStatement.GenerateCommand();
> >
> > Wouldn't you be missing out on the resultMap engine if you do
> things
> > that way?
> 


Re: MySpace.com

Posted by Michael Schall <mi...@gmail.com>.
This is a beautiful thing!  I did not know this was a possibility!  So
this will create the command object fill the parameters and leave the
execution to me?  I would only use this for inserts and updates so I
don't really care about the resultMap portion, but this is the exact
anser to my post months ago about needing to execute code before and
after the command is executed.  What version of code do I need to use
this functionality?

> Do you have cases where you just need the underlying statement:
>
>  IMappedStatement mappedStatement =
>   sqlMapper.GetMappedStatement("Select");
>
> Then you can execute that statement on your own?
>
>  // populate IDbCommand and its parameter collection
>  IDbCommand command = mappedStatement.GenerateCommand();
>
> Wouldn't you be missing out on the resultMap engine if you do things
> that way?

RE: MySpace.com

Posted by Christopher Bissell <ch...@enhypniomancy.com>.
Hi Ron,

Yes, Scott's article is true, based on conversations at Mix06.  Actually,
the numbers are higher now--we're getting consistent traffic increases.

I'm super excited that you've already been working on an emission framework!
That's truly icing on the cake.  Every single performance gain is magnified
out of proportion here.  I'd be happy to test it out under load and give you
feedback.  

We're using Ibatis 1.3 beta, which we incremented internally to 1.3.1 to
track the fix to the stored procedure parameter loader.

And yes, we use log4net.  It's really nice to track Ibatis' verbose
debugging in dev and staging through the extension.


-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Wednesday, March 29, 2006 4:38 AM
To: user-cs@ibatis.apache.org
Subject: Re: MySpace.com

--- Christopher Bissell <ch...@enhypniomancy.com> wrote:

> 
> Hello everyone,
> 
> I didn't want to talk about it until it was a 'core' piece of our 
> architecture, but MySpace.com is now running IBatis for a good portion 
> of its data access abstraction layer.

Neat! Is this article true:

 http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx

What version of IBatisNet are you using?

Do you use log4net at all on myspace.com?

> The performance takes a hit due to the multiple reflection calls made 
> through the system, but we ate that in the name of a nicely abstracted 
> back-end tier, and with thoughts towards the possibility of using 
> emitted classes to someday improve performance.  (A natural evolution 
> of this kind of model in the context of the CLR). If there's any 
> efforts we can make in that direction, please let me know.

This has been fixed in SVN. Here are some performance tests:

http://tinyurl.com/zaw4k
http://svn.apache.org/viewcvs.cgi/ibatis/trunk/cs/mapper/IBatisNet.Common.Te
st/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs?rev=386438&vie
w=log

I haven't ran the tests in a while but I recall the IL enhancements makes
things at least an order of magnitude faster.

- Ron



Re: MySpace.com

Posted by Ron Grabowski <ro...@yahoo.com>.
--- Christopher Bissell <ch...@enhypniomancy.com> wrote:

> 
> Hello everyone,
> 
> I didn't want to talk about it until it was a 'core' piece of our
> architecture, but MySpace.com is now running IBatis for a good
> portion of
> its data access abstraction layer.

Neat! Is this article true:

 http://weblogs.asp.net/scottgu/archive/2006/03/25/441074.aspx

What version of IBatisNet are you using?

Do you use log4net at all on myspace.com?

> The performance takes a hit due to the multiple reflection calls made
> through the system, but we ate that in the name of a nicely
> abstracted
> back-end tier, and with thoughts towards the possibility of using
> emitted
> classes to someday improve performance.  (A natural evolution of this
> kind
> of model in the context of the CLR). If there's any efforts we can
> make in
> that direction, please let me know.

This has been fixed in SVN. Here are some performance tests:

http://tinyurl.com/zaw4k
http://svn.apache.org/viewcvs.cgi/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs?rev=386438&view=log

I haven't ran the tests in a while but I recall the IL enhancements
makes things at least an order of magnitude faster.

- Ron

RE: MySpace.com

Posted by Christopher Bissell <ch...@enhypniomancy.com>.
Regarding the sproc support:

Yes, imagine calling a procedure like this:

<procedure parameterClass="MyParameter" ....>
   dbo.BringMeCoffee #property=BrandID,default=6#,
#property=MugSize,default=5#
</procedure> 

Regarding decoupling SqlMappers:

No, I don't want to get any deeper than the elegant interface the SqlMapper
provides.  Imagine, however, that you have many databases with the same
schema.  You want to use the same SqlMapper against them, but the SqlMapper
is tightly coupled to the database it is initially pointed at.   The way I
got around this problem was to run SqlMap config files through a filter that
replaced their connection strings when loaded, but that still means creating
parameter caches against each and every DB.  Now, it may be an unusual
circumstance to be maintaining connection pools against multiple same-schema
databases...

Thanks for the replies, I'll also check out the other boards.


-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Thursday, March 30, 2006 4:38 AM
To: user-cs@ibatis.apache.org
Subject: Re: MySpace.com

--- Christopher Bissell <ch...@enhypniomancy.com> wrote:

> *Syntactically, better support in the mapping files for stored 
> procedure parameters.  We like the inline parameter methods you can 
> use with dynamic SQL, would be nice to have a way to use that with 
> sprocs too.

You mean instead of being required to use a parameterMap and use question
mark place holders:

 ?, ?, ?

You'd like to use this:

 #FirstName#,
 #LastName#,
 #Age,type=int,dbType=int,handler=FooHandler#

The Java and Dev list are also good lists to sign up up and discuss things
like this too. They get more traffic than this list. The IBatisNet
developers are signed up to all the lists.

> *Better decoupling of SqlMappers from physical databases / db 
> connections.
> Decoupling is implicit in the object model, but it's difficult to use 
> the SqlMapper as 'just' a repository of maps, rather than as an 
> abstraction in front of a physical database.

Do you have cases where you just need the underlying statement:

 IMappedStatement mappedStatement =
  sqlMapper.GetMappedStatement("Select");

Then you can execute that statement on your own?

 // populate IDbCommand and its parameter collection  IDbCommand command =
mappedStatement.GenerateCommand();

Wouldn't you be missing out on the resultMap engine if you do things that
way?

- Ron



Re: MySpace.com

Posted by Ron Grabowski <ro...@yahoo.com>.
--- Christopher Bissell <ch...@enhypniomancy.com> wrote:

> *Syntactically, better support in the mapping files for stored
> procedure
> parameters.  We like the inline parameter methods you can use with
> dynamic
> SQL, would be nice to have a way to use that with sprocs too.

You mean instead of being required to use a parameterMap and use
question mark place holders:

 ?, ?, ?

You'd like to use this:

 #FirstName#,
 #LastName#,
 #Age,type=int,dbType=int,handler=FooHandler#

The Java and Dev list are also good lists to sign up up and discuss
things like this too. They get more traffic than this list. The
IBatisNet developers are signed up to all the lists.

> *Better decoupling of SqlMappers from physical databases / db
> connections.
> Decoupling is implicit in the object model, but it's difficult to use
> the
> SqlMapper as 'just' a repository of maps, rather than as an
> abstraction in
> front of a physical database. 

Do you have cases where you just need the underlying statement:

 IMappedStatement mappedStatement = 
  sqlMapper.GetMappedStatement("Select");

Then you can execute that statement on your own?

 // populate IDbCommand and its parameter collection
 IDbCommand command = mappedStatement.GenerateCommand();

Wouldn't you be missing out on the resultMap engine if you do things
that way?

- Ron

MySpace.com

Posted by Christopher Bissell <ch...@enhypniomancy.com>.
Hello everyone,

I didn't want to talk about it until it was a 'core' piece of our
architecture, but MySpace.com is now running IBatis for a good portion of
its data access abstraction layer.

We like the flexibility.  I came in from a 'heavier' ORM background but very
much appreciated the configurability IBatis offers against a changing data
storage medium, because we have a whole range of heavily denormalized
databases.

The performance takes a hit due to the multiple reflection calls made
through the system, but we ate that in the name of a nicely abstracted
back-end tier, and with thoughts towards the possibility of using emitted
classes to someday improve performance.  (A natural evolution of this kind
of model in the context of the CLR). If there's any efforts we can make in
that direction, please let me know.

The only performance optimization we've made so far is to ensure that the
call to pre-load stored procedure parameters borrows the already-open
connection of the IDalSession above it.  We saw that under super-heavy load
the fact that the sproc parameter populator tried to grab its own connection
within the connection of its parent that a semi-deadlock situation would
result, because the parameter populator does all its work in a heavy lock.
Interested in hearing why this was done, because we definitely got a big
boost on app startup post-optimization.

All-in-all I really like the system.  I thought it was pretty cool that the
SqlMapper interface was so nicely abstracted that you could plug in generic
collections from 2.0 without a rewrite:

List<MyObject> l = new List<MyObject>();
Mapper.QueryForList("GetMyObjects",myParam,l);

Wishlist?

*Like I said above, emitted types for populating and instantiating result
objects could very well be revolutionary--I'm not aware of an existing
framework that robustly does this.

*Syntactically, better support in the mapping files for stored procedure
parameters.  We like the inline parameter methods you can use with dynamic
SQL, would be nice to have a way to use that with sprocs too.

*Better decoupling of SqlMappers from physical databases / db connections.
Decoupling is implicit in the object model, but it's difficult to use the
SqlMapper as 'just' a repository of maps, rather than as an abstraction in
front of a physical database. 

Anyways, this is a truly excellent project and we'd like to help any way we
can.  This is the best model I've seen for a well structured but heavily
decoupled object -> db scenario.

Chris Bissell
Managing Architect
MySpace.com



Re: DataAccess problems

Posted by Ron Grabowski <ro...@yahoo.com>.
Can you post the full stack trace please? What method in IBatisNet is
throwing the exception?

--- "Svancara, Randall - CO 7th" <Sv...@idhw.state.id.us> wrote:

> I have implemented IBATIS data access and data mapper.  I have been
> looking at the Subversion repository for examples of how to implement
> IBATIS.
> 
> Right now I am receiving an error:
> 
> 
> ERROR 4722778ms [672              ] AccountService         .ctor
> - ** Error: 
> - The error occurred while configure DaoSessionHandler.
> - The error occurred in <property name="resource"
> value="SqlMap.config"
> xmlns="http://ibatis.apache.org/dataAccess" />.  
> - Check the
> IBatisNet.DataAccess.DaoSessionHandlers.SqlMapDaoSessionHandler.
> 'Test.Client.vshost.exe' (Managed): Loaded 'D:\Data\Visual Studio
>
2005\Projects\IBATIS_TEST\Test.Client\bin\Debug\IBatisNet.DataMapper.dll
> ', No symbols loaded.
> A first chance exception of type
> 'IBatisNet.Common.Exceptions.ConfigurationException' occurred in
> IBatisNet.DataAccess.dll
> A first chance exception of type
> 'IBatisNet.DataAccess.Exceptions.DataAccessException' occurred in
> Test.Service.dll
> The program '[1548] Test.Client.vshost.exe: Managed' has exited with
> code 0 (0x0).
> 
> Here is my dao.config:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <daoConfig  xmlns="http://ibatis.apache.org/dataAccess" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 
>   <context id="SqlMapDao" default="true">
> 
> 
>     <!-- ==== Sql Server : SqlClient configuration ========= -->
> 		<database>
>       <provider name="sqlServer1.1"/>
> 			<dataSource name="SqlServer"
> connectionString="data source=(local)\NetSDK;database=TEST;user
> id=sa;password=dofa7h;connection reset=false;connection lifetime=5;
> min
> pool size=1; max pool size=50"/>
> 		</database>
> 
>     <daoSessionHandler id="SqlMap">
>       <property name="resource" value="SqlMap.config"/>
>     </daoSessionHandler>
> 
>     <daoFactory>
>       <dao
> interface="Test.Persistance.Dao.Interface.Accounts.IaccountDao,
> Test.Persistance.Dao"
>
implementation="Test.Persistance.Dao.Implementations.Accounts.AccountDao
> , Test.Persistance.Dao"/>
>     </daoFactory>
>   </context>
> 
> </daoConfig>
> 
> Here is my SqlMap.config:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <sqlMapConfig xmlns="http://ibatis.apache.org/dataMapper" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
> 
> 
>   <settings>
> 		<setting useStatementNamespaces="false"/>
> 		<setting cacheModelsEnabled="true"/>
> 	</settings>
> 			
> 	<!-- ==== SqlClient configuration =========	-->
> 	<!-- Optional ( default ) -->
> 	<!-- Rem : If used with a Dao it will be ignored -->
> 	<database>
> 		<provider name="sqlServer1.1"/>
>     <dataSource name="SqlServer" connectionString="data
> source=(local)\NetSDK;database=TEST;user
> id=sa;password=dofa7h;connection reset=false;connection lifetime=5;
> min
> pool size=1; max pool size=50"/>
>   </database>
> 
> 	<sqlMaps>
> 		<sqlMap resource="Maps/Account.xml"/>
> 	</sqlMaps>
> </sqlMapConfig>
> 
> I can not figure out why I am getting this error message.  The line
> of
> code that throws and error for me is
> "builder.Configure("dao.config");"
> 
> I am using Visual Studio 2005/.net 2.0.
> 
> Thanks,
> 
> 
> Randall Svancara
> Web Developer
> 
> The information contained in this email may be privileged,
> confidential or otherwise protected from disclosure.  All persons are
> advised that they may face penalties under state and federal law for
> sharing this information with unauthorized individuals.  If you
> received this email in error, please reply to the sender that you
> have received this information in error.  Also, please delete this
> email after replying to the sender.
>