I have the following code:
public String addBankAccountTransaction(String
lBankAccountTransactionJson) {
log.info("\n\nBankAccountActions::addBankAccountTransaction:start");
GsonBuilder gsonb = new GsonBuilder();
DateDeserializer ds = new DateDeserializer();
gsonb.registerTypeAdapter(Date.class, ds);
GoogleKeyDeserializer gkd = new GoogleKeyDeserializer();
gsonb.registerTypeAdapter(Key.class, gkd);
Gson gson = gsonb.create();
BankAccountTransaction lBankAccountTransaction =
gson.fromJson(lBankAccountTransactionJson,
BankAccountTransaction.class);
PersistenceManager pm = PMF.getSecond().getPersistenceManager();
Transaction tx = pm.currentTransaction();
try {
tx.begin();
pm.makePersistent(lBankAccountTransaction);
tx.commit();
log.info("BankAccountActions::addBankAccountTransaction:lBankAccountTransaction.getKey::Committed
transction");
} catch (Exception e) {
log.info("BankAccountActions::addBankAccountTransaction:Exception "
+ e.getStackTrace());
} finally {
if (tx.isActive()) {
log.info("BankAccountActions::addBankAccountTransaction:lBankAccountTransaction.getKey::transction
FAILED!");
tx.rollback();
}
pm.close();
}
log.info("BankAccountActions::addBankAccountTransaction:lBankAccountTransaction.getKey()
" + lBankAccountTransaction.getKey());
log.info("BankAccountActions::getBankAccounts:end\n\n");
return "ok";
}
It throws no error, but the makePersistent doesn't seem to complete/
work and the key is subsequently null and it doesn't show up in the
datastoreviewer so I assume it's not there. Maybe I don't have logging
setup correctly, my logging.properties looks like:
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
# Set the default logging level for INFO loggers to WARNING
.level = INFO
# Set the default logging level for ORM, specificFINEy, to INFO
DataNucleus.JDO.level=INFO
DataNucleus.Persistence.level=FINE
DataNucleus.Cache.level=INFO
DataNucleus.MetaData.level=INFO
DataNucleus.General.level=INFO
DataNucleus.Utility.level=INFO
DataNucleus.Transaction.level=FINE
DataNucleus.Datastore.level=FINE
DataNucleus.ClassLoading.level=INFO
DataNucleus.Plugin.level=INFO
DataNucleus.ValueGeneration.level=INFO
DataNucleus.Enhancer.level=INFO
DataNucleus.SchemaTool.level=INFO
Any ideas why this isn't saving and why I don't see any errors? I am
using SDK 1.3.6. Thanks!
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.