Use class name not value to support non-Hibernate JPA vendors

With this change I got a simple Eclipselink version of the data-jpa
sample working. I'll push that when I get time to research it a bit more
(I needed to set up a Java agent so either that might be a problem
for our integration tests if we can't work around it).

Fixes gh-1268. Cherry picked onto master after (apparently) a failed
merge of commit ac2ab39.