Java Code Examples for org.hibernate.util.ReflectHelper#overridesEquals()

The following examples show how to use org.hibernate.util.ReflectHelper#overridesEquals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootClass.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void checkCompositeIdentifier() {
	if ( getIdentifier() instanceof Component ) {
		Component id = (Component) getIdentifier();
		if ( !id.isDynamic() ) {
			Class idClass = id.getComponentClass();
			if ( idClass != null && !ReflectHelper.overridesEquals( idClass ) ) {
				LogFactory.getLog(RootClass.class)
					.warn( "composite-id class does not override equals(): "
						+ id.getComponentClass().getName() );
			}
			if ( !ReflectHelper.overridesHashCode( idClass ) ) {
				LogFactory.getLog(RootClass.class)
					.warn( "composite-id class does not override hashCode(): "
						+ id.getComponentClass().getName() );
			}
			if ( !Serializable.class.isAssignableFrom( idClass ) ) {
				throw new MappingException( "composite-id class must implement Serializable: "
					+ id.getComponentClass().getName() );
			}
		}
	}
}
 
Example 2
Source File: BasicLazyInitializer.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected BasicLazyInitializer(
		String entityName,
        Class persistentClass,
        Serializable id,
        Method getIdentifierMethod,
        Method setIdentifierMethod,
        AbstractComponentType componentIdType,
        SessionImplementor session) {
	super(entityName, id, session);
	this.persistentClass = persistentClass;
	this.getIdentifierMethod = getIdentifierMethod;
	this.setIdentifierMethod = setIdentifierMethod;
	this.componentIdType = componentIdType;
	overridesEquals = ReflectHelper.overridesEquals(persistentClass);
}