Skip to content

Latest commit

 

History

History

dachs-eclipselink

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

dachs-eclipselink

This the the Dachs module for EclipseLink.

Setup

1. Add dependency

<dependency>
  <groupId>com.ethlo.dachs</groupId>
  <artifactId>dachs-eclipselink</artifactId>
  <version>${dachs.version}</version>
</dependecy>

2. Enable automatic configuration using Spring Boot

spring.jpa.properties.eclipselink.session.customizer=com.ethlo.dachs.eclipselink.DachsSessionCustomizer

3. Register one or more listeners

@Bean
public EntityChangeSetListener entityChangeSetListener()
{
	return new EntityChangeSetAdapter()
	{
		@Override
		public void postDataChanged(EntityDataChangeSet changes)
		{
			// Will be triggered after commit
		}
	}
}

Tips

Auditing and logging of changes

For auditing purposes, one normally is not interested in an entity's related entities. For example when updating an order that has a reference to a product, we do not want to traverse and log the prodduct entity, we just want to know that the order now references it.

To serialize these changes (and avoiding a huge, potentially recursive graph), Dachs supports IdentityUtil.toIndentityReferences(Collection<EntityDataChange> list)