-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Non-Hibernate JPA config #1268
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
I don't think you need to tweak the auto-configuration. You should be able to simply declare a bean of type |
I guess you are likely to see the |
Is there a nice compact sample project somewhere that uses Eclipselink? |
With this change I got a simple Eclipselink version of the data-jpa sample working. I'll push that when I get time to research it a bit more (I needed to set up a Java agent so either that might be a problem for our integration tests if we can't work around it). Fixes gh-1268.
With this change I got a simple Eclipselink version of the data-jpa sample working. I'll push that when I get time to research it a bit more (I needed to set up a Java agent so either that might be a problem for our integration tests if we can't work around it). Fixes gh-1268. Cherry picked onto master after (apparently) a failed merge of commit ac2ab39.
Has auto-configuration working for EclipseLink been accomplished in either the 1.2.4 or 1.3.0 snapshot builds yet? I'm using the 1.2.3 release build and haven't been able to configure my spring boot app to use eclipselink. Spring complains that there isn't a bean of one type. Then, after I create that bean in my Application class, it complains there's another bean missing. So far, I've created the following beans: JndiObjectFactoryBean (my DataSource), LocalContainerEntityManagerFactoryBean, EntityManagerFactoryBuilder, EclipseLinkJpaVendorAdapter, JpaProperties, DefaultPersistenceUnitManager, and JpaTransactionManager. Now, the message I'm getting says: "Error creating bean with name 'entityManagerFactory' defined in org.mitre.eev.Application: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot apply class transformer without LoadTimeWeaver specified" I'm using Spring Boot 1.2.3.RELEASE, Spring Framework 4.1.6.RELEASE. I've tried compiling and running with Java 7 and 8 on Tomcat 7 and 8. This may or may not be important, but the JpaProperties bean I create contains no database connection information, since the DataSource is coming from JNDI. Or am I missing something major here? |
It definitely worked for me. I had a sample but didn't push it to the main repo because it required some fiddly configuration for a load time weaver that I thought might be hard in unit tests. Here it is: https://github.com/dsyer/spring-boot-sample-data-eclipselink, or if that doesn't work maybe @olivergierke has something in Spring Data already? |
I don't but your's looks like a great candidate to get polished and promoted to one :). We have a ticket over here for that which I'll take care of. |
@dsyer I've looked at your sample, but I don't see a persistence.xml nor any database connection info. I think the sample uses an in-memory database, while I'm trying to use an Oracle database with a DataSource that's defined in Tomcat's server.xml. |
You probably need to start with something simple and work up to it then, but I don't see that much of a gap. Spring Boot can connect to a JNDI data source (http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-connecting-to-a-jndi-datasource) and it's not that different from using an embedded one, just one line of configuration. If you prefer to use |
I need to configure boot to use EclipseLink, I thought I could just extend JpaBaseConfiguration and provide the createJpaVendorAdapter etc. However, JpaBaseConfiguration includes JpaProperties which has an embedded Hibernate specific class. That class has a DEFAULT_NAMING_STRATEGY which extends ImprovedNamingStrategy. So running boot with EclipseLink (or OpenJPA) results in "Caused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/ImprovedNamingStrategy"
The text was updated successfully, but these errors were encountered: