io.katharsis.jpa.JpaRepositoryFactory Maven / Gradle / Ivy
package io.katharsis.jpa;
import java.io.Serializable;
/**
* Used to create resource and relationship repositories for the provided
* classes. By default {@link DefaultJpaRepositoryFactory}} is used.
*/
public interface JpaRepositoryFactory {
/**
* Creates a resource repository that maps an entity to a JSON API endpoint. The provided resource class not necessarily has to be
* an entity class. The JpaModule is checked whether there is a mapping available.
*
* @param resource type
* @param identifier type
* @param module managing the repository
* @param resourceClass to create the jpa. Might either be the entity or a mapped dto.
* @return created repository
*/
public JpaEntityRepository createEntityRepository(JpaModule module, Class resourceClass);
/**
* Creates a relationship repository that maps an entity relationship to a JSON API endpoint. The provided resource classes do not necessarily have to be
* an entity class. The JpaModule is checked whether there is a mapping available.
*
* @param source resource type
* @param source identifier type
* @param target resource type
* @param target identifier type
* @param module managing the repository
* @param sourceResourceClass representing the source of the relation (entity or mapped dto)
* @param targetResourceClass representing the target of the relation (entity or mapped dto)
* @return created repository
*/
public JpaRelationshipRepository createRelationshipRepository(
JpaModule module, Class sourceResourceClass, Class targetResourceClass);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy