org.compass.gps.device.jpa.entities
Class HibernateJpaEntitiesLocator

java.lang.Object
  extended by org.compass.gps.device.jpa.entities.HibernateJpaEntitiesLocator
All Implemented Interfaces:
JpaEntitiesLocator

public class HibernateJpaEntitiesLocator
extends Object
implements JpaEntitiesLocator

A specilized version that works with Hibernate. This class should be used instead of DefaultJpaEntitiesLocator since it works with both hbm files and annotatios.

Author:
kimchy

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
HibernateJpaEntitiesLocator()
           
 
Method Summary
 EntityInformation[] locate(javax.persistence.EntityManagerFactory entityManagerFactory, JpaGpsDevice device)
          Locates the entities used for the index operation.
protected  boolean shouldFilter(String entityname, ClassMetadata classMetadata, Map allClassMetaData, JpaGpsDevice device)
          Returns true if the entity name needs to be filtered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected org.apache.commons.logging.Log log
Constructor Detail

HibernateJpaEntitiesLocator

public HibernateJpaEntitiesLocator()
Method Detail

locate

public EntityInformation[] locate(javax.persistence.EntityManagerFactory entityManagerFactory,
                                  JpaGpsDevice device)
                           throws JpaGpsDeviceException
Description copied from interface: JpaEntitiesLocator
Locates the entities used for the index operation.

Specified by:
locate in interface JpaEntitiesLocator
Parameters:
entityManagerFactory - The EntityManagerFactory to be optionally used for locating the entities.
device - The Jpa device that called this locator.
Returns:
An array of the enteties that need to be indexed during the index operation.
Throws:
JpaGpsDeviceException

shouldFilter

protected boolean shouldFilter(String entityname,
                               ClassMetadata classMetadata,
                               Map allClassMetaData,
                               JpaGpsDevice device)
Returns true if the entity name needs to be filtered.

Implementation filteres out inherited hibernate mappings, since the select query for the base class will cover any inherited classes as well.

Note, that this method is called after it has been verified that the class has Compass mappings (either directly, or indirectly by an interface or a super class).

Parameters:
entityname - The name of the entity
classMetadata - The Hibernate class meta data.
device - The Jpa Gps device
Returns:
true if the entity should be filtered out, false if not.


Copyright (c) 2004-2009 The Compass Project.