Hello,
I'm using the latest OJB- version for a "simple" struts- jsp- website,
which is some kind of message- board, and have the following problem:
- I'm saving messages with the following code:
public void saveMessage(Message m) {
if(m.getMessage_id()==Constants.UNSPEC) m.setMessage_id(0);
try {
broker.beginTransaction();
broker.store(m);
broker.commitTransaction();
} catch (Exception ex) {
broker.abortTransaction();
ex.printStackTrace();
}
}
- the new message is written to the database successfully, and I can
"load" it too by
public Message loadMessage(long message_id) {
Criteria crit = new Criteria();
crit.addEqualTo("message_id", new Long(message_id));
Query query = new QueryByCriteria(Message.class, crit);
java.util.Iterator iter = broker.getIteratorByQuery(query);
...
}
- but there's a hierarchy between the messages, they are linked by a
class- field "mother_id"; and when I want to display the mother-
message with all it's "daughters" I use following code:
public ArrayList loadDaughters(Message m) {
ArrayList retArray = new ArrayList();
Criteria crit = new Criteria();
crit.addEqualTo("mother_id", new Long(m.getMessage_id()));
crit.addOrderBy("creation_date", true);
Query query = new QueryByCriteria(Message.class, crit);
java.util.Iterator iter = broker.getIteratorByQuery(query);
...
}
and the latest messages aren't listed! Although the datasets are
correct (in the database).
I have to restart the JSP- container, afterwards all messages are
displayed. I think that old results of the mother_id- query are
saved - what can I do?
Thank you very much for any help or hints!,
Hinnerk
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]