Every transaction appears to run twice.
Rick Ross <[email protected]>
| Newsgroups | gmane.comp.java.prevayler |
|---|---|
| Message-ID | <[email protected]> |
I'm definitely n00b here but I was busting out code no problem when I
realized that my transactions are running twice. Every one of them.
They don't result in to things being added to the container so I am
really baffled.
I am running a checkpointPrevayler with no saves (so it's essentially
clean every time I run)
I followed the Bank query pattern as in the demos. I'll do the
whole code if needed but I was hoping that there are some pointers
someone could give me.
Note that the id generation is not deterministic but it doesn't happen
inside the transaction (I don't think). The ID is essentially just
the VMID. If there is a better way to do that that's fine.
Again.. I call the transaction once prevayler.execute(new
NutTransactionWithQuery("Cashew")); Each of the output lines
happens twice but only one Nut object is stored in the Store
public abstract class StoreTransactionWithQuery implements
TransactionWithQuery {
public Object executeAndQuery(Object store, Date date) throws
Exception {
System.err.println("StoreTransactionWithQuery.executeAndQuery");
return executeAndQuery((Store) store, date);
}
public abstract Object executeAndQuery(Store store, Date date);
}
// Yes, that should be named NutTransactionWithQuery
public class NutTransaction extends StoreTransactionWithQuery {
ID id = new ID(Utils.generateRandomID());
String type;
boolean isPrimary = false;
public NutTransaction() {
}
public NutTransaction(String type) {
this.type = type;
}
public NutTransaction(String type, boolean isPrimary) {
this(type);
this.isPrimary = isPrimary;
}
public Object executeAndQuery(Store store, Date date) {
System.err.println("NutTransaction.executeAndQuery - date
is : " + date);
Nut nut = new Nut();
nut.setID(id);
System.err.println("NutTransaction.executeAndQuery - id is :
" + nut.getID());
nut.setType(type);
nut.setPrimary(isPrimary);
// add the nut to the store
store.add(nut);
// Now get it back from the store (to be sure) and return it.
return store.getNut(nut.getID());
}
}
Any help would be greatly appreciated
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org