Update. I think I have this figured out. The problem I encountered was
caused by forgotten to add in code to initialize my Vector upon creation and
was receiving a nullPointerException during use.
Dah!
Jeff
On Thursday 27 February 2003 01:41 pm, you wrote:
Hi,
I've setup a non-decomposed M:N relationship in my datastore so now how do
I CRUD (create, read, update and delete) records that participate in this
relationship? An example provided by the OJB website for adding records to
datastore does exist but doesn't reflect any type of advanced relationship
between tables. How would one modify this example to reflect a M:N
relationship? What I'm really looking for CRUD!!! I want CRUD! Yummy
CRUD! Okay, I'm being silly... Any help would be appreciated.
*** Simple example CUT FROM PersistenceBroker API documentation ***
public void apply()
{
// this will be our new object
Product newProduct = new Product();
// now read in all relevant information and fill the new object:
System.out.println(please enter a new product);
String in = readLineWithMessage(enter name:);
newProduct.setName(in);
in = readLineWithMessage(enter price:);
newProduct.setPrice(Double.parseDouble(in));
in = readLineWithMessage(enter available stock:);
newProduct.setStock(Integer.parseInt(in));
// now perform persistence operations
try
{
// 1. open transaction
broker.beginTransaction();
// 2. make the new object persistent
broker.store(newProduct);
broker.commitTransaction();
}
catch (PersistenceBrokerException ex)
{
// if something went wrong: rollback
broker.abortTransaction();
System.out.println(ex.getMessage());
ex.printStackTrace();
}
}
Thanks in advance,
Jeff
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]