how to do static weaving if we use eclipselink jpa in the spring boot app. There is a lack of enough articles on it in internet. The articles I saw used de.empulse.eclipselink staticweave-maven-plugin to weave but it is of 10 years old and do not know if it will support Jpa 3 and above. Another issue is its requirement of persistence.xml. How to do using annotation based approach in spring boot.I tried using "map.put(PersistenceUnitProperties.WEAVING, "static");" but it does not weave. Rest all works properly.
@Configuration
public class EclipsLinkJpaConfiguration extends JpaBaseConfiguration {
protected EclipsLinkJpaConfiguration(DataSource dataSource, JpaProperties properties,
ObjectProvider<JtaTransactionManager> jtaTransactionManager) {
super(dataSource, properties, jtaTransactionManager);
}
@Override
protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
return new EclipseLinkJpaVendorAdapter();
}
@Override
protected Map<String, Object> getVendorProperties() {
Map<String, Object> map = new HashMap<>();
map.put(PersistenceUnitProperties.WEAVING, "static");
map.put(PersistenceUnitProperties.LOGGING_LEVEL, SessionLog.FINER_LABEL);
//map.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.CREATE_ONLY);
// map.put(PersistenceUnitProperties.LOGGING_LEVEL, SessionLog.FINER_LABEL);
map.put(PersistenceUnitProperties.BATCH_WRITING, "JDBC");
return map;
}
@Bean
public static DataSource dataSource() {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/studentcrudangular");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}
}