Compass provides generic support for any JPA capable implementation, but it
also provides tighter integration with specific implementation. For example,
the ability to automatically inject listeners without user configuration, or
automatically get a list of all the entities that are going to be indexed
(the default Compass one checks for annotations, with the specific
implementation checks based on Class meta data).

In the lifecycle listeners I only need (currently) the object saved, which I
use lifecycle.getRelated() in order to get it. But I will probably need the
ClassMetaData in the future.


Patrick Linskey wrote:
> 
> 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.
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Getting-all-the-ClassMetaDatas-tf2905426.html#a8120951
Sent from the open-jpa-dev mailing list archive at Nabble.com.

Reply via email to