BTW, I should probably eludicate a bit. When working with
LifecycleEvents, you can get the instance associated with the event, and
from that you can get the corresponding StateManager and ClassMetaData:

    Broker broker = (Broker) ((PersistenceCapable) event.getSource())
        .pcGetGenericContext();
    StateManager sm = broker.getStateManager(event.getSource());
    ClassMetaData meta = sm.getMetaData();

With TransactionEvents, you can do:

    Broker broker = (Broker) event.getSource();
    for (Object o : event.getTransactionalObjects()) {
        StateManager sm = broker.getStateManager(o);
        ClassMetaData meta = sm.getMetaData();
        if (!sm.isDirty())
            continue;

        // update indexes
    }

Also, IMO, searching is something that shouldn't depend on the JPA spec
-- ideally, you should be able to implement all this without any
dependencies on the org.apache.openjpa.persistence package or
sub-packages.

-Patrick

-- 
Patrick Linskey
BEA Systems, Inc. 

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it. 

> -----Original Message-----
> From: Patrick Linskey 
> Sent: Monday, January 01, 2007 5:51 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: RE: Getting all the ClassMetaDatas
> 
> > -----Original Message-----
> > From: Shay Banon [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, January 01, 2007 1:11 PM
> > To: open-jpa-dev@incubator.apache.org
> > Subject: Getting all the ClassMetaDatas
> > 
> > ...
> > 
> > p.s.
> > 
> > I am the author of Compass, so once I have this nailed down, 
> > we will have
> > Search capabilities to OpenJPA ;)
> 
> Cool! FYI, you'll probably be interested in
> org.apache.openjpa.event.TransactionListener and
> org.apache.openjpa.event.LifecycleListener (and associated
> superinterfaces).
> 
> -Patrick
> ______________________________________________________________
> _________
> Notice:  This email message, together with any attachments, 
> may contain
> information  of  BEA Systems,  Inc.,  its subsidiaries  and  
> affiliated
> entities,  that may be confidential,  proprietary,  
> copyrighted  and/or
> legally privileged, and is intended solely for the use of the 
> individual
> or entity named in this message. If you are not the intended 
> recipient,
> and have received this message in error, please immediately 
> return this
> by email and then delete it.
> 

Reply via email to