I am using jboss 3.0 RC1 and mySQL.
I have a one to many CMR that models shopping_cart
and shopping_cart_items. I have an empty() method
that empties all the items out of the shopping cart.
Here is the code:
try {
Iterator it = cart.getItems().iterator();
while( it.hasNext() ) {
it.next();
it.remove();
}
}
catch (Exception e) {
e.printStackTrace();
throw new ShoppingCartException(e.getMessage());
}
When this runs, jboss sets the items' primary key to
NULL in the database. But I want those database rows
to be deleted. How do I use CMR to go through all
the items and remove their rows from the database?
Thanks!