Re: Debugging Queries

2004-07-26 Thread Craig Andrews
Tino Schöllhorn wrote:
I am using MySQL and OJB and now I want to create a Query over a large 
table. For performance reason I want to use the pageing-feature - but 
I have the feeling that currently OJB is somehow ommitting this (the 
result is fine - but the SQL seems not to include the LIMIT-clause).

Is there a way to get the native SQL from a query which OJB would send 
to the database (this would help for other, complex queries too).
A database specific way would be to add the line:
log=/path/to/some/file.log
to my.cnf, which would cause MySQL to write each and every query it 
receives out to file.log. You can then just monitor what goes in there. 
Unfortunately, there is a large performance penalty, but it can be handy 
for debugging whole transactions.

--
Craig
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


OJB runaway lock objects

2004-07-26 Thread Craig Andrews
Hi,
I am looking for help debugging a nasty problem with a JBoss app I am 
building, using OJB as the persistence mechanism. I have a very simple 
set up, with only a single object, and the following session bean:

public class ProductAdmin extends SessionBean {
private Implementation odmg = null;
private Database db = null;
public void ejbCreate() {
odmg = OJB.getInstance();
db = odmg.newDatabase();
try {
db.open(default, Database.OPEN_READ_WRITE);
} catch (ODMGException e) {
e.printStackTrace();
}
}
public void ejbRemove() throws EJBException, RemoteException {
try {
if (db != null) db.close();
} catch (ODMGException e) {
throw new EJBException(e);
}
odmg = null;
}
public Integer create() throws Exception {
Product p = new Product();
Transaction tx = odmg.newTransaction();
tx.begin();

try {
tx.lock(p, Transaction.WRITE);
tx.commit();
} catch (Exception e) {
tx.abort();
throw (e);
}
return p.getId();
}
}
If I then run the create method a few thousand times, it becomes
apparent that there are thousands of 
org.apache.ojb.odmg.locking.ObjectLocks and
org.apache.ojb.odmg.locking.LockEntry objects that cannot be garbage
collected. The net result is that after ~90,000 objects are written to
the database, there is no memory left for the JVM!

The system is supposed to be supporting a userbase of over 200,000, so
this many writes is quite feasible in a short space of time.
Is there anything I'm doing wrong with the transactions? I have followed 
the tutorials as closely as I can and have reached the stage where I 
wouldn't be able to see the woods if there were one, due to these trees 
everywhere.

Thanks!
--
Craig Andrews [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]