Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Transaction logging
Transaction logging [message #780780] Thu, 19 January 2012 06:03 Go to next message
Eclipse UserFriend
Hi,

I want to log each transaction in the following way:

For each entity inserted/deleted/updated between transaction.begin() and transaction.commit() a transaction-id should be written both into the history table corresponding to the changed entity and into a "transaction-log-table". An entry in the transaction-log-table should also include e.g. a list (as string) of the tables/entities involved in the transaction.

I have already created a history customizer but have no idea how to handle the transaction (not entity) specific logging.

Any help would be very appreciated!

Thomas

Re: Transaction logging [message #780841 is a reply to message #780780] Thu, 19 January 2012 10:06 Go to previous messageGo to next message
Eclipse UserFriend
It might be easiest to create an Entity that maps to your transaction log table and persist a log object with each transaction.
Re: Transaction logging [message #780847 is a reply to message #780841] Thu, 19 January 2012 10:47 Go to previous messageGo to next message
Eclipse UserFriend
Hi James,

thanks for your answer. I thought of this too but the following questions arise:

How to ensure a "transaction-log entity" is created and persisted with every transaction? Is it possible to listen to transaction "events" (something like @PreCommit) or do I have to write something like for example a transaction decorator which handles the additional steps on commit (and furthermore an entitymanager which delivers such a decorated transaction on getTransaction())? My goal is to hide the details of this transaction logging from a user of the entitymanager.

How to determine the entities/tables affected by the actual transaction so this information can be stored within the transaction-log entity?

How to write the transaction id into the (from history policy) newly created row within the particular history table of each other entity changed in the actual transaction?

Best regards

Thomas
Re: Transaction logging [message #781002 is a reply to message #780780] Thu, 19 January 2012 10:06 Go to previous messageGo to next message
Eclipse UserFriend
It might be easiest to create an Entity that maps to your transaction log table and persist a log object with each transaction.

--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Transaction logging [message #781003 is a reply to message #781002] Thu, 19 January 2012 10:47 Go to previous message
Eclipse UserFriend
Hi James,

thanks for your answer. I thought of this too but the following questions arise:

How to ensure a "transaction-log entity" is created and persisted with every transaction? Is it possible to listen to transaction "events" (something like @PreCommit) or do I have to write something like for example a transaction decorator which handles the additional steps on commit (and furthermore an entitymanager which delivers such a decorated transaction on getTransaction())? My goal is to hide the details of this transaction logging from a user of the entitymanager.

How to determine the entities/tables affected by the actual transaction so this information can be stored within the transaction-log entity?

How to write the transaction id into the (from history policy) newly created row within the particular history table of each other entity changed in the actual transaction?

Best regards

Thomas
Re: Transaction logging [message #781019 is a reply to message #780780] Thu, 19 January 2012 10:06 Go to previous message
Eclipse UserFriend
It might be easiest to create an Entity that maps to your transaction log table and persist a log object with each transaction.

--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Transaction logging [message #781020 is a reply to message #781002] Thu, 19 January 2012 10:47 Go to previous message
Eclipse UserFriend
Hi James,

thanks for your answer. I thought of this too but the following questions arise:

How to ensure a "transaction-log entity" is created and persisted with every transaction? Is it possible to listen to transaction "events" (something like @PreCommit) or do I have to write something like for example a transaction decorator which handles the additional steps on commit (and furthermore an entitymanager which delivers such a decorated transaction on getTransaction())? My goal is to hide the details of this transaction logging from a user of the entitymanager.

How to determine the entities/tables affected by the actual transaction so this information can be stored within the transaction-log entity?

How to write the transaction id into the (from history policy) newly created row within the particular history table of each other entity changed in the actual transaction?

Best regards

Thomas
Re: Transaction logging [message #781036 is a reply to message #780780] Thu, 19 January 2012 10:06 Go to previous message
Eclipse UserFriend
It might be easiest to create an Entity that maps to your transaction log table and persist a log object with each transaction.

--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: Transaction logging [message #781037 is a reply to message #781002] Thu, 19 January 2012 10:47 Go to previous message
Eclipse UserFriend
Hi James,

thanks for your answer. I thought of this too but the following questions arise:

How to ensure a "transaction-log entity" is created and persisted with every transaction? Is it possible to listen to transaction "events" (something like @PreCommit) or do I have to write something like for example a transaction decorator which handles the additional steps on commit (and furthermore an entitymanager which delivers such a decorated transaction on getTransaction())? My goal is to hide the details of this transaction logging from a user of the entitymanager.

How to determine the entities/tables affected by the actual transaction so this information can be stored within the transaction-log entity?

How to write the transaction id into the (from history policy) newly created row within the particular history table of each other entity changed in the actual transaction?

Best regards

Thomas
Previous Topic:Native ORM vs JPA
Next Topic:Shared cache on multi base using same classes
Goto Forum:
  


Current Time: Sun Jul 13 09:11:04 EDT 2025

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

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

Back to the top