sylvainhamel | 4 Oct 2004 14:56
Picon
Favicon

Re: Paging ? (OFFSET/LIMIT)


Didnt say stored proc is a temporary thing but their implementation 
varies so much between rdbms that it makes it a pain to write cross 
vendor code.

--- In SimpleORM <at> yahoogroups.com, "Philippe Back \(High Octane\)" 
<phil <at> h...> wrote:
> Nevertheless, SPs are here to stay...
> It is incredible what can be achieved with them.
> (I don't like writing such code anyway).
> /Phil
> 
> ----- Original Message ----- 
> From: "sylvainhamel" <sylvainhamel <at> h...>
> To: <SimpleORM <at> yahoogroups.com>
> Sent: Wednesday, 29 September, 2004 02:03
> Subject: [SimpleORM] Re: Paging ? (OFFSET/LIMIT)
> 
> 
> > 
> > The proc way of paging is the recommended way of doing this on 
sql 
> > server. Dont know how well this fits in .NET with recordsets and 
> > all. I didnt like this way because frankly you would require a 
lot 
> > of work to implement this on many database systems. Where as my 
> > solution is pretty efficient and would work on many database with 
> > very little or no modifications. Besides the options still have 
to 
> > be defined in iBatis. They are just implemented at a deeper 
(Continue reading)

sylvainhamel | 4 Oct 2004 15:09
Picon
Favicon

Re: Paging ? (OFFSET/LIMIT)


Shall be done as soon as I can get away with it.

--- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas 
<berglas <at> S...> wrote:
> Hello Sylvain,
> 
> No problem about "proof of concept".  I agree with your general 
point 
> about using the database.  This is a strong departure from much of 
the 
> cool Java community which considers the database old technology.
> 
> Further, the real "impedence mismatch" that an ORM is trying to 
manage 
> is not so much the difference between "object" and "relational", 
but the 
> fact that we are working on two different tiers with two loosely 
coupled 
> caches.  If the database was a real Object DB, we would still have 
most 
> of the same problems.
> 
> As to avoiding the fork, I am basically done with the next version 
> subject to bugs being reported.  My next candidate release will 
probably 
> be the last.
> 
> If your company has a few more afternoons to waste then I would 
like you 
(Continue reading)

sylvainhamel | 4 Oct 2004 14:48
Picon
Favicon

Re: Bug: SRecordMeta.flushAndPurge()


Will have a look.

--- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas 
<berglas <at> S...> wrote:
> Done, thanks.
> 
> Sylvain, is my use of java.util.Iterator.remove() break .Net?  It 
is Java2.
> 
> Regards,
> 
> Anthony
> 
> Weinhold Ingo wrote:
> 
> > Howdy,
> > 
> > I'm new to SimpleORM (more precisely have been evaluting it for a 
few weeks), so first thanks to Anthony for the nice tool.
> > 
> > While reading a bit through the sources I've found a bug in 
SRecordMeta.flushAndPurge():
> > 
> >   public void flushAndPurge() {
> >     SConnection scon = SConnection.getBegunConnection();    
> >     java.util.Iterator ci = scon.transactionCache.values
().iterator();
> >     while (ci.hasNext()) {
> >       SRecordInstance ri = (SRecordInstance)ci.next();
(Continue reading)

sylvainhamel | 4 Oct 2004 14:53
Picon
Favicon

Re: .net example code


Good step in the right direction. I am in the process of testing the 
new version on existing code. Stay tuned for the conclusions.

--- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas 
<berglas <at> S...> wrote:
> Hello Sylvain,
> 
> I have added SJSharp.newInteger, isInteger etc. so that you could 
have 
> the J# version use native .Net data types.
> 
> Could you please send me the current version of your JDBC bridge 
and any
> other changes that you have made for .Net.  I won't test the .net
> version, but I'd like to be basically in sync with you.
> 
> Anthony
> 
> 
> sylvainhamel wrote:
> 
> > We are using simpleorm in a 3 year/person project. We believe 
enough 
> > in our product that we invested over 100K in this library. Cheap 
cost 
> > was never a deciding factor. 
> > 
> > Performance has been very good so far. The biggest performance 
> > penalty is in the "join" aspect of queries. Complex queries 
(Continue reading)

Jan Tietze | 12 Oct 2004 15:57
Picon

Re: Re: Bug: SRecordMeta.flushAndPurge()

Interestingly, this problem now seems to hit me if I'm reading the source and exception correctly:

java.util.ConcurrentModificationException
	at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
	at java.util.AbstractList$Itr.next(Unknown Source)
	at simpleorm.core.SConnection.flush(SConnection.java:469)
	at simpleorm.core.SConnection.commit(SConnection.java:424)
[...]

in a single-thread process.

I'm also in the process of upgrading from 1.12 to 2.15 and looked into the source, and it doesn't seem to
correct this issue. I'll try this later today though.

>>> sylvainhamel <at> hotmail.com 04.10.2004 14:48:35 >>>

Will have a look.

--- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas 
<berglas <at> S...> wrote:
> Done, thanks.
> 
> Sylvain, is my use of java.util.Iterator.remove() break .Net?  It 
is Java2.
> 
> Regards,
> 
> Anthony
> 
> Weinhold Ingo wrote:
(Continue reading)

Jan Tietze | 12 Oct 2004 18:04
Picon

Re: Re: Re: Bug: SRecordMeta.flushAndPurge()

Anyone have any idea on whether this replacement for SConnection.flush()
 
  /** Flush all records of tables in this transaction to the database. */
  public static void flush(){
    SConnection scon = getBegunConnection();   
    // Iterator ci = scon.updateList.iterator();
   
    for (int i = 0; i < scon.updateList.size(); i++)
    {
      SRecordInstance ri = (SRecordInstance)scon.updateList.get(i);
      if (ri != null) ri.flush(); // Could have been manually flushed.
    }
    scon.updateList.clear();
  }
 
will solve the problem and actually implement the intended behavior without side effects? I have implemented this and it seems to work fine. The previous code (as contained in 1.12 and 2.15) was
 
  /** Flush all records of tables in this transaction to the database. */
  public static void flush(){
    SConnection scon = getBegunConnection();   
    Iterator ci = scon.updateList.iterator();
    while (ci.hasNext()) {
      SRecordInstance ri = (SRecordInstance)ci.next();
      if (ri != null) ri.flush(); // Could have been manually flushed.
    }
    scon.updateList.clear();
  }
But - as shown below - this will lead to a ConcurrentModificationException sometimes.

>>> jan.tietze <at> cuc.de 12.10.2004 15:57:26 >>>
Interestingly, this problem now seems to hit me if I'm reading the source and exception correctly:
 
java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at simpleorm.core.SConnection.flush(SConnection.java:469)
at simpleorm.core.SConnection.commit(SConnection.java:424)
[...]
 
in a single-thread process.
 
I'm also in the process of upgrading from 1.12 to 2.15 and looked into the source, and it doesn't seem to correct this issue. I'll try this later today though.

>>> sylvainhamel <at> hotmail.com 04.10.2004 14:48:35 >>>

Will have a look.

--- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas
<berglas <at> S..> wrote:
> Done, thanks.
>
> Sylvain, is my use of java.util.Iterator.remove() break .Net?  It
is Java2.
>
> Regards,
>
> Anthony
>
> Weinhold Ingo wrote:
>
> > Howdy,
> >
> > I'm new to SimpleORM (more precisely have been evaluting it for a
few weeks), so first thanks to Anthony for the nice tool.
> >
> > While reading a bit through the sources I've found a bug in
SRecordMeta.flushAndPurge():
> >
> >   public void flushAndPurge() {
> >     SConnection scon = SConnection.getBegunConnection();   
> >     java.util.It erator ci = scon.transactionCache.values
().iterator();
> >     while (ci.hasNext()) {
> >       SRecordInstance ri = (SRecordInstance)ci.next();
> >       if (ri.getMeta() == this)
> >         ri.flushAndPurge();
> >     }
> >   }
> >
> > While iterating through transactionCache (a HashMap)
ri.flushAndPurge() modifies it (remove()s the entry), which is not
considered safe (expect a ConcurrentModificationException earlier or
later).
> >
> > Simple solutions would be 1. to do the work in two passes --
build a separate list with the concerned records first and iterate
over it afterwards -- or 2. have a package private
SReco rdInstance.flushAndPurge(boolean remove) that doesn't remove the
record from the cache when being told so, and remove it in
SRecordMeta using the iterator instead.
> >
> > CU, Ingo


Yahoo! Groups Links
Anthony & Melissa Berglas | 13 Oct 2004 02:34

Re: Re: Re: Re: Bug: SRecordMeta.flushAndPurge()


Hello Jan,

I've had a quick look at this and your change looks OK but I cannot see 
why it would actually be needed given that ri.flush does not remove the 
element, mearly nulls it.

I did find a related bug in SRecordMeta.flush.

I'll look at this some more later.  If you can add a test case to 
BasicTests (say) that would be great.

I'm hoping to get more feedback from people from the 2.15 candidate 
before making it the production release.

Regards,

Anthony

Jan Tietze wrote:

> 
> Anyone have any idea on whether this replacement for SConnection.flush()
>  
>   /** Flush all records of tables in this transaction to the database. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();   
>     // Iterator ci = scon.updateList.iterator();
>    
>     for (int i = 0; i < scon.updateList.size(); i++)
>     {
>       SRecordInstance ri = (SRecordInstance)scon.updateList.get(i);
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }
>  
> will solve the problem and actually implement the intended behavior 
> without side effects? I have implemented this and it seems to work 
> fine. The previous code (as contained in 1.12 and 2.15) was
>  
>   /** Flush all records of tables in this transaction to the database. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();   
>     Iterator ci = scon.updateList.iterator();
>     while (ci.hasNext()) {
>       SRecordInstance ri = (SRecordInstance)ci.next();
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }
> But - as shown below - this will lead to a 
> ConcurrentModificationException sometimes.
> 
>  >>> jan.tietze <at> cuc.de 12.10.2004 15:57:26 >>>
> Interestingly, this problem now seems to hit me if I'm reading the 
> source and exception correctly:
>  
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at simpleorm.core.SConnection.flush(SConnection.java:469)
> at simpleorm.core.SConnection.commit(SConnection.java:424)
> [...]
>  
> in a single-thread process.
>  
> I'm also in the process of upgrading from 1.12 to 2.15 and looked into 
> the source, and it doesn't seem to correct this issue. I'll try this 
> later today though.
> 
>  >>> sylvainhamel <at> hotmail.com 04.10.2004 14:48:35 >>>
> 
> Will have a look.
> 
> --- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas
> <berglas <at> S..> wrote:
>  > Done, thanks.
>  >
>  > Sylvain, is my use of java.util.Iterator.remove() break .Net?  It
> is Java2.
>  >
>  > Regards,
>  >
>  > Anthony
>  >
>  > Weinhold Ingo wrote:
>  >
>  > > Howdy,
>  > >
>  > > I'm new to SimpleORM (more precisely have been evaluting it for a
> few weeks), so first thanks to Anthony for the nice tool.
>  > >
>  > > While reading a bit through the sources I've found a bug in
> SRecordMeta.flushAndPurge():
>  > >
>  > >   public void flushAndPurge() {
>  > >     SConnection scon = SConnection.getBegunConnection();   
>  > >     java.util.Iterator ci = scon.transactionCache.values
> ().iterator();
>  > >   !   while (ci.hasNext()) {
>  > >       SRecordInstance ri = (SRecordInstance)ci.next();
>  > >       if (ri.getMeta() == this)
>  > >         ri.flushAndPurge();
>  > >     }
>  > >   }
>  > >
>  > > While iterating through transactionCache (a HashMap)
> ri.flushAndPurge() modifies it (remove()s the entry), which is not
> considered safe (expect a ConcurrentModificationException earlier or
> later).
>  > >
>  > > Simple solutions would be 1. to do the work in two passes --
> build a separate list with the concerned records first and iterate
> over it afterwards -- or 2. have a package private
> SRecordInstance.flushAndPurge(boolean remove) that doesn't remove the
> record from the cache when being told so, and remove it in
> SRecordMeta using the iterator instead.
>  >! >
>  > > CU, Ingo
> 
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=1299q8rms/M=294855.5468653.6549235.3001176/D=groups/S=1705006905:HM/EXP=1097683510/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.html>
> 
> 
> Yahoo! Groups Links
> 
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/SimpleORM/
>        
>     * To unsubscribe from this group, send an email to:
>       SimpleORM-unsubscribe <at> yahoogroups.com
>       <mailto:SimpleORM-unsubscribe <at> yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>. 
> 
> 

------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Jan Tietze | 13 Oct 2004 08:31
Picon

Re: Re: Re: Re: Re: Bug: SRecordMeta.flushAndPurge()

Hello Anthony,

I'll try to generate a test case, but that is probably not going to be easy; I have noticed that a
ConcurrentModificationException will only occur under somewhat bizarre circumstances that I do not
yet fully understand, but this could to be related to the amount of time it takes the iterator to walk
through scon.updateList. I'll try using the iterator and put in a delay.

Note the comments in the JDK API documentation about how this exception cannot be relied on. My guess is that
next() does not check for modification every time next() is called on the iterator, and actually does not
only check for structural but any kind of modification.

More later today,

Jan

>>> berglas <at> SpreadsheetDetective.com 13.10.2004 02:34:48 >>>

Hello Jan,

I've had a quick look at this and your change looks OK but I cannot see 
why it would actually be needed given that ri.flush does not remove the 
element, mearly nulls it.

I did find a related bug in SRecordMeta.flush.

I'll look at this some more later.  If you can add a test case to 
BasicTests (say) that would be great.

I'm hoping to get more feedback from people from the 2.15 candidate 
before making it the production release.

Regards,

Anthony

Jan Tietze wrote:

> 
> Anyone have any idea on whether this replacement for SConnection.flush()
>  
>   /** Flush all records of tables in this transaction to the database. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();   
>     // Iterator ci = scon.updateList.iterator();
>    
>     for (int i = 0; i < scon.updateList.size(); i++)
>     {
>       SRecordInstance ri = (SRecordInstance)scon.updateList.get(i);
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }
>  
> will solve the problem and actually implement the intended behavior 
> without side effects? I have implemented this and it seems to work 
> fine. The previous code (as contained in 1.12 and 2.15) was
>  
>   /** Flush all records of tables in this transaction to the database. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();   
>     Iterator ci = scon.updateList.iterator();
>     while (ci.hasNext()) {
>       SRecordInstance ri = (SRecordInstance)ci.next();
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }
> But - as shown below - this will lead to a 
> ConcurrentModificationException sometimes.
> 
>  >>> jan.tietze <at> cuc.de 12.10.2004 15:57:26 >>>
> Interestingly, this problem now seems to hit me if I'm reading the 
> source and exception correctly:
>  
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at simpleorm.core.SConnection.flush(SConnection.java:469)
> at simpleorm.core.SConnection.commit(SConnection.java:424)
> [...]
>  
> in a single-thread process.
>  
> I'm also in the process of upgrading from 1.12 to 2.15 and looked into 
> the source, and it doesn't seem to correct this issue. I'll try this 
> later today though.
> 
>  >>> sylvainhamel <at> hotmail.com 04.10.2004 14:48:35 >>>
> 
> Will have a look.
> 
> --- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas
> <berglas <at> S..> wrote:
>  > Done, thanks.
>  >
>  > Sylvain, is my use of java.util.Iterator.remove() break .Net?  It
> is Java2.
>  >
>  > Regards,
>  >
>  > Anthony
>  >
>  > Weinhold Ingo wrote:
>  >
>  > > Howdy,
>  > >
>  > > I'm new to SimpleORM (more precisely have been evaluting it for a
> few weeks), so first thanks to Anthony for the nice tool.
>  > >
>  > > While reading a bit through the sources I've found a bug in
> SRecordMeta.flushAndPurge():
>  > >
>  > >   public void flushAndPurge() {
>  > >     SConnection scon = SConnection.getBegunConnection();   
>  > >     java.util.Iterator ci = scon.transactionCache.values
> ().iterator();
>  > >   !   while (ci.hasNext()) {
>  > >       SRecordInstance ri = (SRecordInstance)ci.next();
>  > >       if (ri.getMeta() == this)
>  > >         ri.flushAndPurge();
>  > >     }
>  > >   }
>  > >
>  > > While iterating through transactionCache (a HashMap)
> ri.flushAndPurge() modifies it (remove()s the entry), which is not
> considered safe (expect a ConcurrentModificationException earlier or
> later).
>  > >
>  > > Simple solutions would be 1. to do the work in two passes --
> build a separate list with the concerned records first and iterate
> over it afterwards -- or 2. have a package private
> SRecordInstance.flushAndPurge(boolean remove) that doesn't remove the
> record from the cache when being told so, and remove it in
> SRecordMeta using the iterator instead.
>  >! >
>  > > CU, Ingo
> 
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=1299q8rms/M=294855.5468653.6549235.3001176/D=groups/S=1705006905:HM/EXP=1097683510/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.html>
> 
> 
> Yahoo! Groups Links
> 
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/SimpleORM/
>        
>     * To unsubscribe from this group, send an email to:
>       SimpleORM-unsubscribe <at> yahoogroups.com
>       <mailto:SimpleORM-unsubscribe <at> yahoogroups.com?subject=Unsubscribe>
>        
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>. 
> 
> 

Yahoo! Groups Sponsor
ADVERTISEMENT

Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/SimpleORM/

To unsubscribe from this group, send an email to:
SimpleORM-unsubscribe <at> yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 
gmxcdslrby | 13 Oct 2004 11:30
Picon
Favicon

Important Letter for SimpleORM Members


Refinancing your home is never easier and more profitable.
Our staff works exclusively to save you the most money as possible on any home loan.
We secure loans at better interest rates, for anyone anywhere. Do not miss out.
Please Copy and paste the following link into your web browser now.
http://diplender.com/?partid=rcc1

Refinancing your home is the answer to your question;
How do I save more money? 
Our staff can explain how you can pay your loan off faster or put cash in your pocket,

http://diplender.com/?partid=rcc1
If you do not copy and paste the above link into your web browser the saving process cannot be started.

Lenders are standing by to assist you in your home refinancing process.
All it takes is 30 seconds to take advantage of the lowest interest rates ever.
Do not let yourself pay more cash for your home over longer amounts of time.

http://diplender.com/?partid=rcc1

Please copy and paste the above link into your web browser.

Do not miss out interest rates have never been lower.
http://diplender.com/?partid=rcc1

This email was sent because you joined our group.
If you do not wish to recieve any emails, unsubscribe.
by sending a mail here SimpleORM-unsubscribe <at> yahoogroups.com

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> To unsubscribe from this group, send an email to:
    SimpleORM-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Jan Tietze | 13 Oct 2004 12:09
Picon

Re: Re: Re: Re: Re: Re: Bug: SRecordMeta.flushAndPurge()

Hello Anthony,
 
I agree with you - I have looked at the source code for AbstracList and ArrayList, and this just should not happen by just using set(int, Object) on the ArrayList. I'm still looking at this right now though.
 
Jan

>>> jan.tietze <at> cuc.de 13.10.2004 08:31:00 >>>
Hello Anthony,
 
I'll try to generate a test case, but that is probably not going to be easy; I have noticed that a ConcurrentModificationException will only occur under somewhat bizarre circumstances that I do not yet fully understand, but this could to be related to the amount of time it takes the iterator to walk through scon.updateList. I'll try using the iterator and put in a delay.
 
Note the comments in the JDK API documentation about how this exception cannot be relied on. My guess is that next() does not check for modification every time next() is called on the iterator, and actually does not only check for structural but any kind of modification.
 
More later today,
 
Jan

>>> berglas <at> SpreadsheetDetective.com 13.10.2004 02:34:48 >>>
Hello Jan,

I've had a quick look at this and your change looks OK but I cannot see
why it would actually be needed given that ri.flush does not remove the
element, mearly nulls it.

I did find a related bug in SRecordMeta.flush.

I'll look at this some more later.  If you can add a test case to
BasicTests (say) that would be great.

I'm hoping to get more feedback from people from the 2.15 candidate
before making it the production release.

Regards,

Anthony

Jan Tietze wrote:

>
> Anyone have any idea on whether this replacement for SConnection.flush()

>   /** Flush all records of tables in this transaction to the database. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();& nbsp; 
>     // Iterator ci = scon.updateList.iterator();
>   
>     for (int i = 0; i < scon.updateList.size(); i++)
>     {
>       SRecordInstance ri = (SRecordInstance)scon.updateList.get(i);
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }

> will solve the problem and actually implement the intended behavior
> without side effects? I have implemented this and it seems to work
> fine. The previous code (as contained in 1.12 and 2.15) was

>   /** Flush all records of tables in this transaction to the datab ase. */
>   public static void flush(){
>     SConnection scon = getBegunConnection();  
>     Iterator ci = scon.updateList.iterator();
>     while (ci.hasNext()) {
>       SRecordInstance ri = (SRecordInstance)ci.next();
>       if (ri != null) ri.flush(); // Could have been manually flushed.
>     }
>     scon.updateList.clear();
>   }
> But - as shown below - this will lead to a
> ConcurrentModificationException sometimes.
>
>  >>> jan.tietze <at> cuc.de 12.10.2004 15:57:26 >>>
> Interestingly, this problem now seems to hit me if I'm reading the
> source and exception correctly:
&gt ; 
> java.util.ConcurrentModificationException
> at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
> at java.util.AbstractList$Itr.next(Unknown Source)
> at simpleorm.core.SConnection.flush(SConnection.java:469)
> at simpleorm.core.SConnection.commit(SConnection.java:424)
> [...]

> in a single-thread process.

> I'm also in the process of upgrading from 1.12 to 2.15 and looked into
> the source, and it doesn't seem to correct this issue. I'll try this
> later today though.
>
>  >>> sylvainhamel <at> hotmail.com 04.10.2004 14:48:35 >>>
>
> Will have a look.
>
> --- In SimpleORM <at> yahoogroups.com, Anthony & Melissa Berglas
> <berglas <at> S..> wrote:
>  > Done, thanks.
>  >
>   > Sylvain, is my use of java.util.Iterator.remove() break .Net?  It
> is Java2.
>  >
>  > Regards,
>  >
>  > Anthony
>  >
>  > Weinhold Ingo wrote:
>  >
>  > > Howdy,
>  > >
>  > > I'm new to SimpleORM (more precisely have been evaluting it for a
> few weeks), so first thanks to Anthony for the nice tool.
>  > >
>  > > While reading a bit through the sources I've found a bug in
> SRecordMeta.flushAndPurge():
>  > >
>  > >   public void flushAndPurge() {
>  > >     SConnection scon = SConnection.getBegunConnection();  
>  > >     java.util.Iterator ci = scon.transactionCache.values
> ().iterator();
>  > >   !   while (ci.hasNext()) {
>  > >       SRecordInstance ri = (SRecordInstance)ci.next();
>  > >       if (ri.getMeta() == this)
>  > >         ri.flushAndPurge();
>  > >     }
>  > >   }
>  > >
>  > > While iterating through transactionCache (a HashMap)
> ri.flushAndPurge() modifies it (remove()s the entry), which is not
> considered safe (expect a ConcurrentModificationException earlier or
> later).
>  > >
>  > > Simple solutions would be 1. to do the work in two passes --
> build a separate list with the concerned records first and iterate
> over it afterwards -- or 2. have a package private
> SRecordInstance.flushAndPurge(boolean remove) that doesn't remove the
> record from the cache when being told so, and remove it in
> SRecordMeta using the iterator instead.
>  >! >
>  > > CU, Ingo
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> <http://us.ard.yahoo.com/SIG=1299q8rms/M=294855.5468653.6549235.3001176/D=groups/S=1705006905:HM/EXP=1097683510/A=2376776/R=0/SIG=11ldm1jvc/*http://promotions.yahoo.com/ydomains2004/index.html>
>
>
> Yahoo! Groups Links
&gt ;
>     * To visit your group on the web, go to:
>       http://groups.yahoo.com/group/SimpleORM/
>       
>     * To unsubscribe from this group, send an email to:
>       SimpleORM-unsubscribe <at> yahoogroups.com
>       <mailto:SimpleORM-unsubscribe <at> yahoogroups.com?subject=Unsubscribe>
>       
>     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>




Yahoo! Groups Links

Gmane