This one time, at band camp, Havemeister, Thomas said:
HT>This is perhaps a simple question: How can I remove Objects by ID without loading
them before using and the "remove()" command?
HT>
HT>Here is a code snippet:
HT>
HT> public void removeRequirement(Vector pVector)
HT> throws PersistenceException
HT> {
HT> if (isActive() == false)
HT> {
HT> begin();
HT> }
HT>
HT> int lId=0;
HT> for (Enumeration enum=pVector.elements(); enum.hasMoreElements(); )
HT> {
HT> lId = ((Integer) enum.nextElement()).intValue();
HT> requQuery.bind(lId);
HT> remove( (this.requQuery.execute()).next());
HT> }
HT> commit();
HT> }
HT>
HT>this will work, but is of course quite slow, because the castor is loading each
object, before removing it.
HT>
HT>When processing somethin like this:
HT>
HT> ....
HT> Requirement lReq = new Requirement();
HT> lReq.setId(xx);
HT> remove (lReq);
HT> ....
HT>
HT>an Exception will be thrown. What is the best way for removing objects using castor?
Thomas,
Castor currently requires that objects be loaded in order to be removed. This
is so that the cache can be properly updated upon object removal.
Bruce
--
perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev