org.springframework.data.jpa.domain.AbstractPersistable Java Examples

The following examples show how to use org.springframework.data.jpa.domain.AbstractPersistable. 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: BaseEntity.java    From spring-data-jpa-extra with Apache License 2.0 6 votes vote down vote up
@Override
public boolean equals(Object obj) {

    if (null == obj) {
        return false;
    }

    if (this == obj) {
        return true;
    }

    if (!getClass().equals(ClassUtils.getUserClass(obj))) {
        return false;
    }

    AbstractPersistable<?> that = (AbstractPersistable<?>) obj;

    return null != this.getId() && this.getId().equals(that.getId());
}
 
Example #2
Source File: FlushOnSaveRepositoryImpl.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
private <S extends T> EntityInformation<Object, S> getEntityInformation(S entity) {

	Class<?> userClass = ClassUtils.getUserClass(entity.getClass());

	if (entity instanceof AbstractPersistable<?>) {
		return new JpaPersistableEntityInformation(userClass, entityManager.getMetamodel());
	}

	return new JpaMetamodelEntityInformation(userClass, entityManager.getMetamodel());
}