Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » SessionCustomizer for column names
SessionCustomizer for column names [message #526479] Sun, 11 April 2010 17:06 Go to next message
Gabor Beres is currently offline Gabor BeresFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

How can a write a a SessionCustomizer, that translates property to column names like this? :

myProperty -> my_property

I'm interested in the SessionCustomizer code, not the actual translation method.

Thanks.
Re: SessionCustomizer for column names [message #526495 is a reply to message #526479] Sun, 11 April 2010 20:40 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 807
Registered: July 2009
Senior Member
> I'm interested in the SessionCustomizer code, not the actual translation
> method.

This one way of binding a SessionCustomizer:

...
lOptions.put(PersistenceUnitProperties.SESSION_CUSTOMIZER, " nl.knowledgeplaza.profiler.engine.dao.jpa.KPSessionCustomize r ");
EntityManagerFactory lEntityManagerFactory = Persistence.createEntityManagerFactory("kpprofiler", lOptions);


public class KPSessionCustomizer implements org.eclipse.persistence.config.SessionCustomizer
{
@Override
public void customize(Session session) throws Exception
{
...
}
}
Re: SessionCustomizer for column names [message #526538 is a reply to message #526495] Mon, 12 April 2010 08:44 Go to previous messageGo to next message
Gabor Beres is currently offline Gabor BeresFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

Yes, i now that part.
What i don't know is how to get the property names, and do the actual translation.
Re: SessionCustomizer for column names [message #527044 is a reply to message #526479] Tue, 13 April 2010 19:37 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The EclipseLink Session has a set of ClassDescriptors that have a set of DatabaseMappings. You can use the API for these classes to perform your customization.


James : Wiki : Book : Blog : Twitter
Previous Topic:Open session in view
Next Topic:Log4j
Goto Forum:
  


Current Time: Sun Dec 21 17:20:29 GMT 2014

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

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