Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » UCP connection labelling callback in eclipse link jpa
UCP connection labelling callback in eclipse link jpa [message #1863927] Wed, 06 March 2024 20:02
Jayaram Subramanian is currently offline Jayaram SubramanianFriend
Messages: 3
Registered: March 2024
Junior Member
We are trying to Oracle UCP connection labelling callback 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
Previous Topic:few questions on RepeatableWriteUnitOfWork / IsolatedCache
Next Topic:Unable to use cache coordination
Goto Forum:
  


Current Time: Sat Apr 27 13:16:45 GMT 2024

Powered by FUDForum. Page generated in 0.02989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top