No [ManagedType] type... SpringData app trying to move from Hibernate [message #1739567] |
Tue, 02 August 2016 23:01  |
Eclipse User |
|
|
|
This is a Spring Data application that I am trying to move from Hibernate to EclipseLink. What I have found with google isnt helpful (esp solved by moving to Hibernate).
Error is:
Caused by: java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [my.domain.boreservice.domain.BoreHole] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>my.domain.boreservice.domain.BoreHole</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
No persistance.xml so exclude-unlisted-classes should default to false.
@Configuration
@EnableTransactionManagement
@EnableLoadTimeWeaving
@EnableJpaRepositories(basePackages="my.domain.boreservice.repository", queryLookupStrategy=QueryLookupStrategy.Key.CREATE_IF_NOT_FOUND)
public class DataConfig extends JpaBaseConfiguration {
/*
* Data Source Config
*/
@Bean
public DataSource dataSource() {
final JndiDataSourceLookup dsLookup = new JndiDataSourceLookup();
dsLookup.setResourceRef(true);
DataSource dataSource = dsLookup.getDataSource("jdbc/myconnection");
return dataSource;
}
/*
* Jpa Config
*/
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
emfb.setDataSource(dataSource());
emfb.setPersistenceUnitName("BoreServiceJPA");
emfb.setPackagesToScan("my.domain.boreservice.domain");
return emfb;
}
@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
JpaTransactionManager txnMgr = new JpaTransactionManager();
txnMgr.setEntityManagerFactory(emf);
return txnMgr;
}
@Override
protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
EclipseLinkJpaVendorAdapter eclipseLinkJpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
eclipseLinkJpaVendorAdapter.setShowSql(true);
eclipseLinkJpaVendorAdapter.setGenerateDdl(false);
return eclipseLinkJpaVendorAdapter;
}
@Override
protected Map<String, Object> getVendorProperties() {
final Map<String, Object> ret = new HashMap<>();
ret.put(PersistenceUnitProperties.BATCH_WRITING, BatchWriting.JDBC);
ret.put(PersistenceUnitProperties.WEAVING, detectWeavingMode());
return ret;
}
private String detectWeavingMode() {
return InstrumentationLoadTimeWeaver.isInstrumentationAvailable() ? "true" : "static";
}
}
All the database entities are there under domain. Works in hibernate but with a lot of hibernate hassle (lazyloading). EclipseLink 2.6.2, Spring 4.2.5
Any ideas please?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.44958 seconds