Announcement Announcement Module
Collapse
No announcement yet.
Why do I need to enumerate entity classes in persistence.xml? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why do I need to enumerate entity classes in persistence.xml?

    When I use spring ROO to create a spring MVC web site with the jpa hibernate provider to connect to Microsoft SQL Server database, Roo sets it up so I
    (1) use a database.properities file and
    (2) I don't need to enumerate the entity classes in my persistence.xml file.

    However, when I use spring in a console mode program that uses spring/jpa to read/write to a Microsoft SQL Server
    (1) How do I make it use the database.properties file for obtaining the username and password?
    (2) Eliminate the need to list my entity classes like this (in the META-INF/peristence.xml file):


    Code:
        <persistence-unit name="GuestbookPUHibernateMSSQL" transaction-type="RESOURCE_LOCAL">
          <provider>org.hibernate.ejb.HibernatePersistence</provider>
    	  <class>guest.Guest</class>
    	  <class>guest.Author</class>
    	  <class>guest.Book</class>
    	  <class>guest.Periodical</class>
          <properties>
    Both programs work and create tables from the java (groovy, actually) classes in the SQL Server database.
    Thanks
    Siegfried
Working...
X