Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes Why doe I have to list classes in persistence.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Why doe I have to list classes in persistence.xml?" Watch "Why doe I have to list classes in persistence.xml?" New topic
Author

Why doe I have to list classes in persistence.xml?

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
I have a console mode JPA java program that won't run unless I list the classes in META-INFO/persistence.xml like this:


However, I have a Spring MVC Servlet that does not require the classes to be listed:


I'd prefer to not have to list my classes in my console mode program. How can I modify my console mode program to not require my classes be listed like my Spring MVC Servlet?

Thanks,
Siegfried
Sumit Suresh Rao
Greenhorn

Joined: Feb 16, 2009
Posts: 13
I dont think that would be possible

looking at the defition in schema of persistence. xml you wld get the following


ref : http://openjpa.apache.org/builds/2.2.1/apache-openjpa/docs/jpa_overview_persistence.html

may be someone else can better enlighten us
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 381
I tried a simple ROO Spring MVC/JPA project (that generates persistence.xml) and it does not include the list of classes in the persistence.xml either. And that code works for both Oracle and MSSQL. It is a Spring MVC servlet, however.
Hmmm.... Could console mode vs. web apps have have anything to do with it?

On the one hand I don't think it should.
On the other hand, something in spring is probably doing it. Something that I'm calling in my servlet that I'm not doing in my console mode application. Hmmm... Both apps are pretty simple.

I wonder if I can cajole ROO into making a console mode application?

Anyone have any other ideas?
Thanks
siegfried
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why doe I have to list classes in persistence.xml?