You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by cmose <cj...@gmail.com> on 2006/08/01 22:32:50 UTC
Phantom data results??
Hey all,
I'm mostly an ibatis noob and having quite a bizarre problem, for me at
least, with ibatis returning phantom results on some test queries.
Basically, is there any caching happening with Ibatis behind the scenes that
I should be aware of?? Right now I'm using a simple data source and letting
ibatis handle the conneciton pooling and etc., I seem to be having a
situation where queries in the ibatis mapping file return results different
from those same queries pasted into Oracle's isql*plus (e.g., the queries
run from ibatis only return results if they were inserted using ibatis).
Ibatis seems to be using a phantom table when it's running it's inserts and
queries, that completely ignores anything that has been done to the table
via isql*plus (e.g., pasting the sql code from the mapping file directly
into isql*plus yields vastly different results then running it using
ibatis).
Now I realize that something could be wonky with isql*plus, but I'm more
likely to believe a configuration or use error on my part then isql*plus not
working correctly.
Thanks much!!
As an aside to this, is there anything in particular, configuration wise or
functionality wise that I sould worry about when using a singleton
SqlMapClient across a dozen or so classes?
(sorry if this was a repeat, I received a nabble confirmation in my email
and made the mistake of assuming that was also the list subscription
confirmation for which I received another email after already having posted
this, ergo I'm uncertain whether or not the original message actually went
out - thanks for your patience ;-) ).
--
View this message in context: http://www.nabble.com/Phantom-data-results---tf2036087.html#a5602576
Sent from the iBATIS - User - Java forum at Nabble.com.
Re: Phantom data results??
Posted by "Albert L. Sapp" <as...@uiuc.edu>.
cmose wrote:
> Jeff thanks for the reply,
> I didn't really believe that there were phantom tables being created
> somewhere ;-)
> Trouble is that I have 0 caching configured anywhere and am not using
> explicit transactions anywhere, strictly using a simple data source that
> just connects to the database via jdbc and then using the sqlmapclient to
> call up queries from the mapping files so I'm rather at a loss to figure out
> where this problem is occuring.
>
> Albert, I'm not certain I follow what you mean; do you mean that an
> application running on a tomcat server was using ibatis and you had to
> restart tomcat before that application would see updates made via isql*plus
> or anything else other than the app?
>
Sorry, should have been a clearer. Yes, we have a Java application
running on a tomcat server that was built with iBatis sql maps and dao.
We did find that when a change was made using anything, but the
application, we did not see the changes until we rebooted the tomcat
server. Unfortunately, neither I or the other person working on the
project have taken the time to really figure out why this was. Neither
of us is familiar enough with anything we are using to do the
troubleshooting needed to pinpoint the cause. So I can't really give
you a clear point of attack. Hope someone else can point to a likely
place. I will be following this thread with interest.
> If so, I'm currently still testing this out so I'm just running a few
> classes directly from eclipse. I tried restarting eclipse, cleaning the
> project, shoot, I went so far as rebooting the workstation that the app was
> running on and all to no avail.
>
> I'm really quite stuck on this and I'm very very hesitant to put this into a
> production environment if i can't figure out what is causing this problem.
>
> thanks much for any insight!
>
Re: Phantom data results??
Posted by cmose <cj...@gmail.com>.
sven,
thanks for the info, wasn't aware of that - does the data get committed once
one's session ends or...?
--
View this message in context: http://www.nabble.com/Phantom-data-results---tf2036087.html#a5611732
Sent from the iBATIS - User - Java forum at Nabble.com.
Re: Phantom data results??
Posted by cmose <cj...@gmail.com>.
Gwyn,
that's an interesting insight regarding isql*plus, I'll have to look into
that. I was under the impression that the inserts are "committed" in fairly
short order, e.g., I think in the past I've done some similar tests with
ibatis that involved prepopulating some tables using isql*plus and I had no
problems.
I'm positive that login information, tables, and etc., are all identical
between using isql*plus and ibatis.
--
View this message in context: http://www.nabble.com/Phantom-data-results---tf2036087.html#a5605220
Sent from the iBATIS - User - Java forum at Nabble.com.
Re: Phantom data results??
Posted by Gwyn Evans <gw...@gmail.com>.
If you enable logging on "java.sql" you can see the SQL & the params
being passed to the DB, and my (on Oracle) experience has been that
they match. The whole point of iBatis is that there's not anything
like that behind the scenes!
Are you 100% sure that you're using the same username on the DB
connections, just to ensure there's not two different schemeas
involved, but I think it's the next paragraph...
You say "the queries run from ibatis only return results if they were
inserted using ibatis" - Do you see the ibatis-inserts from sqlplus? I
suspect that when you do inserts from isqlplus, you've not committing
them - not sure of isqlplus but certainly sqlplus does not
auto-commit. If you do an insert then select, you'll see it but it
won't be there for others to see 'till committed, which ibatis will be
doing for you.
/Gwyn
On 01/08/06, cmose <cj...@gmail.com> wrote:
>
> Jeff thanks for the reply,
> I didn't really believe that there were phantom tables being created
> somewhere ;-)
> Trouble is that I have 0 caching configured anywhere and am not using
> explicit transactions anywhere, strictly using a simple data source that
> just connects to the database via jdbc and then using the sqlmapclient to
> call up queries from the mapping files so I'm rather at a loss to figure out
> where this problem is occuring.
>
> Albert, I'm not certain I follow what you mean; do you mean that an
> application running on a tomcat server was using ibatis and you had to
> restart tomcat before that application would see updates made via isql*plus
> or anything else other than the app?
>
> If so, I'm currently still testing this out so I'm just running a few
> classes directly from eclipse. I tried restarting eclipse, cleaning the
> project, shoot, I went so far as rebooting the workstation that the app was
> running on and all to no avail.
>
> I'm really quite stuck on this and I'm very very hesitant to put this into a
> production environment if i can't figure out what is causing this problem.
>
> thanks much for any insight!
> --
> View this message in context: http://www.nabble.com/Phantom-data-results---tf2036087.html#a5604514
> Sent from the iBATIS - User - Java forum at Nabble.com.
>
>
Re: Phantom data results??
Posted by cmose <cj...@gmail.com>.
Jeff thanks for the reply,
I didn't really believe that there were phantom tables being created
somewhere ;-)
Trouble is that I have 0 caching configured anywhere and am not using
explicit transactions anywhere, strictly using a simple data source that
just connects to the database via jdbc and then using the sqlmapclient to
call up queries from the mapping files so I'm rather at a loss to figure out
where this problem is occuring.
Albert, I'm not certain I follow what you mean; do you mean that an
application running on a tomcat server was using ibatis and you had to
restart tomcat before that application would see updates made via isql*plus
or anything else other than the app?
If so, I'm currently still testing this out so I'm just running a few
classes directly from eclipse. I tried restarting eclipse, cleaning the
project, shoot, I went so far as rebooting the workstation that the app was
running on and all to no avail.
I'm really quite stuck on this and I'm very very hesitant to put this into a
production environment if i can't figure out what is causing this problem.
thanks much for any insight!
--
View this message in context: http://www.nabble.com/Phantom-data-results---tf2036087.html#a5604514
Sent from the iBATIS - User - Java forum at Nabble.com.
Re: Phantom data results??
Posted by Jeff Butler <je...@gmail.com>.
iBATIS does not cache results unless you specifically ask it to do so. And
there is no "phantom table" code in iBATIS (this did make me smile when I
read it). Have you configured any <cacheModel> elements anywhere? If not,
then iBATIS is not caching results. If you have configured <cacheModels>,
then temporarily disable them to see if anything changes.
More likely this is something related to transaction configuration. Or
maybe explicit transactions are not being committed/ended properly
somewhere.
Jeff Butler
On 8/1/06, Albert L. Sapp <as...@uiuc.edu> wrote:
>
> I have run into the same thing where anything done outside of the
> application (isql*plus or enterprise manager) does not appear in the
> results from a query inside iBatis. We found if we restarted the tomcat
> server that the activity done outside the application was now visible to
> the application. We stopped modifying table data directly and all
> interaction is now through the application. If we absolutely have to
> work outside the application, we know we must do a restart of the tomcat
> server.
>
> It has been a while since we had to deal with this so we never really
> tried to find out why this happens. Something to do with data caching,
> I am sure. We know that we will have the problem, so we just deal with
> it the way we know works.
>
> Al
>
> cmose wrote:
> > Hey all,
> > I'm mostly an ibatis noob and having quite a bizarre problem, for me at
> > least, with ibatis returning phantom results on some test queries.
> >
> > Basically, is there any caching happening with Ibatis behind the scenes
> that
> > I should be aware of?? Right now I'm using a simple data source and
> letting
> > ibatis handle the conneciton pooling and etc., I seem to be having a
> > situation where queries in the ibatis mapping file return results
> different
> > from those same queries pasted into Oracle's isql*plus (e.g., the
> queries
> > run from ibatis only return results if they were inserted using ibatis).
> >
> > Ibatis seems to be using a phantom table when it's running it's inserts
> and
> > queries, that completely ignores anything that has been done to the
> table
> > via isql*plus (e.g., pasting the sql code from the mapping file directly
> > into isql*plus yields vastly different results then running it using
> > ibatis).
> >
> > Now I realize that something could be wonky with isql*plus, but I'm more
> > likely to believe a configuration or use error on my part then isql*plus
> not
> > working correctly.
> > Thanks much!!
> >
> > As an aside to this, is there anything in particular, configuration wise
> or
> > functionality wise that I sould worry about when using a singleton
> > SqlMapClient across a dozen or so classes?
> >
> > (sorry if this was a repeat, I received a nabble confirmation in my
> email
> > and made the mistake of assuming that was also the list subscription
> > confirmation for which I received another email after already having
> posted
> > this, ergo I'm uncertain whether or not the original message actually
> went
> > out - thanks for your patience ;-) ).
> >
>
>
Re: Phantom data results??
Posted by "Albert L. Sapp" <as...@uiuc.edu>.
I have run into the same thing where anything done outside of the
application (isql*plus or enterprise manager) does not appear in the
results from a query inside iBatis. We found if we restarted the tomcat
server that the activity done outside the application was now visible to
the application. We stopped modifying table data directly and all
interaction is now through the application. If we absolutely have to
work outside the application, we know we must do a restart of the tomcat
server.
It has been a while since we had to deal with this so we never really
tried to find out why this happens. Something to do with data caching,
I am sure. We know that we will have the problem, so we just deal with
it the way we know works.
Al
cmose wrote:
> Hey all,
> I'm mostly an ibatis noob and having quite a bizarre problem, for me at
> least, with ibatis returning phantom results on some test queries.
>
> Basically, is there any caching happening with Ibatis behind the scenes that
> I should be aware of?? Right now I'm using a simple data source and letting
> ibatis handle the conneciton pooling and etc., I seem to be having a
> situation where queries in the ibatis mapping file return results different
> from those same queries pasted into Oracle's isql*plus (e.g., the queries
> run from ibatis only return results if they were inserted using ibatis).
>
> Ibatis seems to be using a phantom table when it's running it's inserts and
> queries, that completely ignores anything that has been done to the table
> via isql*plus (e.g., pasting the sql code from the mapping file directly
> into isql*plus yields vastly different results then running it using
> ibatis).
>
> Now I realize that something could be wonky with isql*plus, but I'm more
> likely to believe a configuration or use error on my part then isql*plus not
> working correctly.
> Thanks much!!
>
> As an aside to this, is there anything in particular, configuration wise or
> functionality wise that I sould worry about when using a singleton
> SqlMapClient across a dozen or so classes?
>
> (sorry if this was a repeat, I received a nabble confirmation in my email
> and made the mistake of assuming that was also the list subscription
> confirmation for which I received another email after already having posted
> this, ergo I'm uncertain whether or not the original message actually went
> out - thanks for your patience ;-) ).
>