You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Mark Romiti <mr...@everware.com> on 2004/09/24 23:29:50 UTC
New OJB User: Question on ODMG API - performing an record update using ORACLE - command ignored
Hi:
I'm developing a protoype for a major government agency in the Intelligence
Arena using Struts on front and OJB as backend. The initial functionality
is is basically CRUD of a User Record. I have structured the app very much
like the beer example provided. The only difference is I using Maps as the
DTO objects and maintain the OJB Libraries and application back end code in
a separate JAR. The struts stuff is in the usual WAR and the entire app is
packaged as an EAR and deployed to BEA 8.x.
I have Adds and Queries working. I' m having a problem with the update.
The initial functionality of the Update Screen retrieves a User record based
on a passed ID (and this works fine) When I goto make changes and Update
that record this is where my problem occurs. It seems that the SQL Update
Statement does not generated at all. I verified this using Oracle SQL trace
utility to see what kind of DML gets generated for the database.
I have followed examples from two sources on the OJB web site and still
don't seem to understand the problem. No exceptions are occuring. I have
included code below. Please let me know if you have any ideas.
Obviously, I have put log statements to follow the code execution and it
goes all the way through the commit with no apparent errors.
Also one other question - For performance reasons I'm not sure if I should
be calling closeDatabase() after every transaction. ??
public void updateUser(HashMap map, HashMap prevMap) throws Exception
{
Transaction txu= null;
OQLQuery query = null;
try {
txu= impl.newTransaction();
txu.begin();
Userlocals userlocals = new
Userlocals().getFromHashMap(map); txu.lock(userlocals,
Transaction.WRITE);
String agency = (String) map.get("AGENCY");
String prevAgency = (String) prevMap.get("AGENCY");
//*** Checking for changes between current agency
//*** and previous agency - (from previous post)
if (((agency == null && prevAgency !=null) ||
(agency != null && prevAgency ==null))||
(((agency != null && prevAgency !=null) ||
(agency != null && !agency.equals(prevAgency)))))
{
//*** This executes ***//
userlocals.setAgency(agency);
}
//*** Other fields here to do same as above not included
//*** This executes also ***
txu.commit();
}
catch (Exception e)
{
throw e;
}
finally {
closeDatabase();
}
return;
}
Mark Romiti
SCJP, Senior Developer Everware Inc.
Office - 703-246-0000 ext 105
Cell - 703-624-1814
Office Email - mromiti@everware.com
Personal Email - mromiti@att.net
Cell Email - 17036241814@mobile.att.net
Yahoo IM: markromiti
www.everware.com