It should be like
@ElementCollection(fetch=FetchType.Lazy)
@Column(name="tableName")
private Map<String,String> tableName =new HashMapp<String,String> ();
This should work for you.
When the Map value is an embeddable class or basic type, use the @ElementCollection annotation. (String is a basic type)
And I already used that annotation.
When using Map elements or relationships, the following rules apply.
The Map key or value may be a basic Java programming language type, an embeddable class, or an entity.
When the Map value is an embeddable class or basic type, use the @ElementCollection annotation.
When the Map value is an entity, use the @OneToMany or @ManyToMany annotation.
Use the Map type on only one side of a bidirectional relationship.
If the key type of a Map is a Java programming language basic type, use the annotation javax.persistence.MapKeyColumn to set the column mapping for the key. By default, the name attribute of @MapKeyColumn is of the form RELATIONSHIP-FIELD/PROPERTY-NAME_KEY. For example, if the referencing relationship field name is image, the default name attribute is IMAGE_KEY.
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<class>models.db.User</class>
<properties>
<property name="eclipselink.target-database" value="PostgreSQL"/>
<property name="eclipselink.ddl-generation" value="create-or-extend-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
</properties>
</persistence-unit>
</persistence>
...
val appDependencies = Seq(
....
, "org.eclipse.persistence" % "org.eclipse.persistence.jpa" % "2.4.0"
....
val main = play.Project(appName, appVersion, appDependencies).settings(
....
resolvers += (
"EclipseLink JPA" at "http://download.eclipse.org/rt/eclipselink/maven.repo"
)