Hi
I am a new user to ojb and I have a problem when updating foreign key
reference to null.
I am using ojb version 0.9.8, in a session bean deployed to jboss 3.0.5.
I have marked all my session bean methods as transaction required.
I have three tables:
Artist:
ArtistId, Integer, PK, AUTO_INCREMENT
ArtsistName: VARCHAR
Gallery
GalleryId Integer, PK, AUTO_INCREMENT
GalleryName: VARCHAR
Painting:
PaintingId Integer, PK, AUTO_INCREMENT
PaintingTitle: VARCHAR
ArtistId Integer FK
GalleryId Integer FK
I can successfully create a new painting object and persist it to my
database with the foreign keys initially set to null.
I can also successfully update my painting object with different foreign
key values for artist and gallery. However
When I try to update my painting object to reflect the gallery or artist
foreign key as null as in the following example code:
try
{
Painting painting = findPaintingByTitle("SomeTitle"); //This method
successfully returns me a painting object represented by the title
Transaction tx = odmg.currentTransaction();
tx.lock(painting,Transaction.UPGRADE);
painting.setGallery(null);
}
catch(....)
my changes are not reflected in the database and I do not get any ojb
errors or warnings.
Any suggestions!!
Ashraf Moosa