.
, . orm.xml ( , Spring Boot schema.xml ).
public interface YourRepository extends JpaRepository<YourEntity, Long> {
List<YourEntity> yourQueryMethod();
}
YourEntity.yourQueryMethod. orm.xml ( , - ).
LocalContainerEntityManagerFactory . , , , , database.type, -
<bean class="LocalContainerEntityManagerFactoryBean">
<property name="mappingResources" value="classpath:META-INF/orm-${database.type}.xml" />
... other config ...
</bean>
This way you can keep your code clean if / then / else and apply where necessary. Cleans your code beautifully imho.
source
share