-
Notifications
You must be signed in to change notification settings - Fork 41.2k
After update spring-boot from 1.4.0 to 1.4.1 the file META-INF/orm.xml
no longer loaded
#6983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The first post show the result of Spring boot 1.4.0:
Spring boot 1.4.1:
The |
@xak2000 Can you please provide a small sample that reproduces the problem? |
Of course, I will try tomorrow to reproduce the problem using as small as possible project. |
Unpack and run
Then change
This sample is just clean spring-boot project generated from http://start.spring.io/ site. I only added the |
Thank you. Unfortunately this is a regression caused by the fix for #6635. Thankfully you can work around the problem by adding the following configuration class to your application: package demo;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager;
@Configuration
public class PersistenceUnitRootWorkaroundConfiguration {
@Bean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(JpaProperties properties,
JpaVendorAdapter jpaVendorAdapter,
ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
jpaVendorAdapter, properties.getProperties(),
persistenceUnitManagerProvider.getIfAvailable(),
null);
return builder;
}
} With this class in place, I see the following output from your sample using 1.4.1.RELEASE:
|
Thanks you, Andy! This workaround works like a charm! |
Hi, I have similar issue on 1.4.1 version. I wrote here #6635 where I was asked to open a new issue, but I'm writing here instead. Basically here is the problem: we are using hbm.xml files for our entity mapping, which means that we have POJO classes as a model without any annotation in them. But, we are using Spring Data JPA repositories. You can find attached sample project in this comment. |
@znikola You have a separate problem. You're declaring your own JPA configuration so the changes in #6635 won't help you as they only apply to the auto-configured JPA. For the time being at least, you need to call |
That location would be location to |
Uh oh!
There was an error while loading. Please reload this page.
After update spring-boot from 1.4.0 to 1.4.1 the file
META-INF/orm.xml
no longer loaded.I have enabled
org.hibernate
logger to leveldebug
and found this:Spring Boot 1.4.0
(gradle bootRun
):Spring Boot 1.4.1
(gradle bootRun
):The main difference here is
PU root URL
. In first case it isfile:/home/xakep/ws/line-meter/build/resources/main
and in second case it isfile:/home/xakep/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/1.4.1.RELEASE/db60078355dbe57b3ff5efcbf7b411fb5ae75306/spring-boot-autoconfigure-1.4.1.RELEASE.jar
.Also I debug
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.getOrmXmlForDefaultPersistenceUnit()
and found that this line:returns the
META-INF/orm.xml
resource when used withspring-boot 1.4.0
, but the same line returnsfile:/home/xakep/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/1.4.1.RELEASE/db60078355dbe57b3ff5efcbf7b411fb5ae75306/spring-boot-autoconfigure-1.4.1.RELEASE.jarMETA-INF/orm.xml
when used withspring-boot 1.4.1
.It can be not even bug with
spring-boot
but withspring-orm
, but unfortunately I can't debug any futher.The persistence unit used in my app is default persistence unit. Almost no configuration.
The text was updated successfully, but these errors were encountered: