google/guice — pull request #839 by magnayn (2014-08-17 14:04:19+00:00)
Title: Allow JPA properties to be Objects as well as simple strings.

This is a re-worked patch from the original issue #750

https://code.google.com/p/google-guice/issues/detail?id=750

----
JpaPersistService takes a parameter thus:
Properties persistenceProperties

However, this is used later to create an entity manager:
Persistence.createEntityManagerFactory(persistenceUnitName,
persistenceProperties);

The signature for that method is (String, Map) NOT (String, Properties).

If one is using Hibernate, you can pass the desired DataSource object in
using that Map with Environment.DATASOURCE storing the actual object.
Clearly you cannot do that if it's Properties (String->String map)

Changing this so that the persistenceProperties is a Map would solves this,
so you may now do (for example)

DataSource ds = ...;
Map p = new HashMap();
p.put( Environment.DATASOURCE, ds );
JpaPersistModule jpaPersistModule = new JpaPersistModule("myapp-db")
.properties(p);

Since all Properties objects *are* Map instances, this is a non-breaking
change.

Signed-off-by: Nigel Magnay