Skip to content

Instantly share code, notes, and snippets.

@Tcharl
Last active March 26, 2016 14:50
Show Gist options
  • Select an option

  • Save Tcharl/85c5c141dc8581242794 to your computer and use it in GitHub Desktop.

Select an option

Save Tcharl/85c5c141dc8581242794 to your computer and use it in GitHub Desktop.
Simple repository implementation
@OsgiServiceProvider(classes = { HelloRepository.class })
@Singleton
@Transactional
public class HelloJpaRepository extends DelegatingSimpleJpaRepository<HelloEntity, Long> implements HelloRepository {
/**
* Entity manager.
*/
@PersistenceContext(unitName = "myTestPu")
private EntityManager em;
@PersistenceUnit( unitName = "myTestPu")
private EntityManagerFactory emf;
@Override
@PostConstruct
public void postConstruct() {
instanciateDelegateRepository(emf, em, HelloEntity.class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment