Re: store collections
Abid Hussain <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi again,
I forgot to tell that the problem seems to have to do with the using of
proxies.
Because, when I change the code to this:
public void storeAll(Collection valueObjects) {
if (valueObjects != null) {
broker.beginTransaction();
for (Iterator i = valueObjects.iterator(); i.hasNext();)
Object valueObject = i.next();
--> logger.debug(valueObject);
broker.store(valueObject, ObjectModification.INSERT);
}
broker.commitTransaction();
}
...it works because the object is loaded from the database when calling
the debug()-method.
It seems that the broker has nothing to store in the method without the
logging-statement seen below.
But is there any other way to solve this problem?
Regards,
Abid
Abid Hussain schrieb:
> Hi everybody,
>
> I want to implement a method which stores not only one object but a
> collection of objects.
> I tried this one:
> public void storeAll(Collection valueObjects) {
>
> if (valueObjects != null) {
> broker.beginTransaction();
> for (Iterator i = valueObjects.iterator(); i.hasNext();)
> Object valueObject = i.next();
> broker.store(valueObject, ObjectModification.INSERT);
> }
> broker.commitTransaction();
> }
> ...but it doesn't work, not one object is stored into the database.
>
> Anybody got an idea?
>
> Regards,
>
> Abid
>
--
Abid Hussain
Mail: [email protected]
Web: http://www.abid76.de