[ajug-members] JPA question
J. Talafous
jtalafous at gmail.com
Mon Nov 20 15:41:24 EST 2006
I'm using Java Persistence API to avoid learning advanced SQL and
doing any db design. So far it's working pretty well with Hibernate
as the provider, but Toplink is working too, (but doesn't do per-table
@Inheritance). For example, one of the fields in one of my classes:
@ManyToMany
Map<MyObject,AnotherObject> myMap = new HashMap<MyObject,AnotherObject>();
persists nicely, no problem.
BUT... anything I try to persist the following, FAILS:
Map<String,String> myMap = new HashMap<String,String>();
or this:
List<String> myList = new ArrayList<String>()
Both JPA providers are claiming that they don't see String.java as an
entity class in persistence.xml, and since I don't have the code, I
can't put it there.
I could wrap String in another class, but this seems like not a good
idea, because it seems JPA should be able to handle this. For
example:
String[] myList = new String[3]();
gets persisted! Of course, all the @Basic String fields get persisted,
so why is JPA having a problem with Strings inside a List or Map?
it's so simple... I must be missing something here. Any ideas?
Thanks!
More information about the ajug-members
mailing list