Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Sharing using information with an entity listener
Sharing using information with an entity listener [message #551010] Wed, 04 August 2010 20:12 Go to next message
Mauro Flores is currently offline Mauro FloresFriend
Messages: 84
Registered: September 2009
Location: Brasil
Member
The following code is a correct and good aproach to pass the name of the system user to an entity listener?

// My bussiness code:
...
Session unitOfWork =  JpaHelper.getEntityManager(em).getUnitOfWork(); 
unitOfWork.setProperty("user", user);	 
em.merge(entity); 
...


// My entity listener code: 
class MyEntityListener extends DescriptorEventAdapter {

 @Override
  public void preUpdateWithChanges(DescriptorEvent event) {
    Session unitOfWork = event.getSession();  
System.out.println("User doing the merge  = " +  unitOfWork.getProperty("user"));
  }


Thaks for some help. Mauro.
Re: Sharing using information with an entity listener [message #551779 is a reply to message #551010] Mon, 09 August 2010 14:19 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Seems fine.


James : Wiki : Book : Blog : Twitter
Previous Topic:Difficulties Unmarshalling Timestamp
Next Topic:Eclipselink and JBoss 5.1 java.net.MalformedURLException
Goto Forum:
  


Current Time: Thu Apr 25 17:30:06 GMT 2024

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

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

Back to the top