Replies: 4 comments
-
Sorry, but we don't use/support this exact API in EclipseLink. With UCP there are only some data affinity/partitioning classes in How unwrap works You can check at |
Beta Was this translation helpful? Give feedback.
-
thanks for the feedback Radek. |
Beta Was this translation helpful? Give feedback.
-
thanks for the feedback |
Beta Was this translation helpful? Give feedback.
-
Hi |
Beta Was this translation helpful? Give feedback.
-
We are trying to Oracle UCP connection labelling callback (https://docs.oracle.com/en/database/oracle/oracle-database/21/jjucp/implementing-labeling-ucp-connections.html#GUID-B39EA55E-48A7-454A-8756-BAC5588A3868
) for returning connection in eclipse jpa JPA setup with the below implementation
protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
return new EclipseLinkJpaVendorAdapter();
}
@bean("entityManagerFactory")
public LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactory() throws SQLException, SecurityException, UniversalConnectionPoolException, IOException {
AbstractJpaVendorAdapter jpaVendorAdaptor = createJpaVendorAdapter();
LocalContainerEntityManagerFactoryBean factory =
new LocalContainerEntityManagerFactoryBean();
factory.setDataSource(dataSourceProvider.dataSource());
}
In DataSourceProvider class
public DataSource dataSource() throws SQLException, UniversalConnectionPoolException, SecurityException, IOException {
PoolDataSource dataSource = PoolDataSourceFactory.getPoolDataSource();
LOGGER.info("before callback");
RestCoreLabellingCallback callback =new RestCoreLabellingCallback();
dataSource.registerConnectionLabelingCallback(callback);
return dataSource;
}
In labellingcallback class
public boolean configure(Properties reqLabels, Object conn) {
// TODO Auto-generated method stub
try
{
LOGGER.info("configure is called");
...
}
@OverRide
public int cost(Properties reqLabels, Properties currentLabels) {
// TODO Auto-generated method stub
LOGGER.info("cost is called");
....
In the place where we get the connection we use the eclipselinkfactory's un wrap class
try (CallableStatement cs = getThreadLocalEntityManager().getEntityManager().unwrap(Connection.class).
prepareCall(functionCall)
)
Output
When the application starts we are able to see "before callback" is getting called which indicates the labelling callback is getting registered
But when eclipse link factory unwrap call happened from to get java.sql. connection we expected "coest is called" and "configure is called" to be present in the console logs as per the oracle ucp labelling documentation .. but those statements are not getitng logged...
Is there any miss in the implementation.. thanks
Beta Was this translation helpful? Give feedback.
All reactions