Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SessionCustomizer in OSGi environments(Small? change to get SessionCustomizer working in OSGi environments)
icon14.gif  SessionCustomizer in OSGi environments [message #657055] Tue, 01 March 2011 13:27 Go to next message
Caspar MacRae is currently offline Caspar MacRaeFriend
Messages: 12
Registered: March 2011
Location: London
Junior Member
I was going to pop this on bugzilla but thought I'd see if anyone has any better ideas or workarounds first..


The SessionCustomizer is unusable in an OSGi environment without first modifying the org.eclipse.persistence.core bundle to add dynamic import..

The EntityManagerSetupImp could be modified to be more OSGi aware (via a class/instance loading façade) and lookup the client SessionCustomizer from the OSGi registry - using the class name from the "eclipselink.session.customizer" property as a filter parameter.

This would ensure the correct SessionCustomizer is found without any need to know the specific client's implementation class (so no nasty workarounds).

Re: SessionCustomizer in OSGi environments [message #657173 is a reply to message #657055] Tue, 01 March 2011 19:32 Go to previous messageGo to next message
Shaun Smith is currently offline Shaun SmithFriend
Messages: 197
Registered: July 2009
Senior Member
SessionCustomizer works for me in OSGi. The trick is to ensure that EclipseLink can load the class you name either in your persistence.xml or that you pass in the properties you use to create your EntityManagerFactory.

E.g.
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("eclipselink.classloader", this.getClass().getClassLoader());
properties.put("eclipselink.session.customizer", "my.Customizer");                  
emf = new PersistenceProvider()	.createEntityManagerFactory("comics", properties);


--Shaun
Re: SessionCustomizer in OSGi environments [message #657343 is a reply to message #657173] Wed, 02 March 2011 14:02 Go to previous message
Caspar MacRae is currently offline Caspar MacRaeFriend
Messages: 12
Registered: March 2011
Location: London
Junior Member
Thanks Shaun, works perfectly.

A case of RTFM Embarrassed
Previous Topic:SequenceGenerator
Next Topic:[JPA-Newbie] -- JPA 2 for dynamic/custom entity types (database schemas)?
Goto Forum:
  


Current Time: Thu Apr 25 14:06:53 GMT 2024

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

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

Back to the top