Configuring persistence

The Entity API looks great and very intuitive, but how does the server know which database is supposed to store/query the entity objects? The persistence.xml file, which will be placed under src/main/resources/META-INF of your project, is the standard JPA configuration file. By configuring this file, you can easily switch from one persistence provider to another and thus also from one application server to another (believe it, this is a huge leap towards application server compatibility).

In the persistence.xml file we will basically need to specify the persistence provider and the underlying data source used.

<persistence version="2.0" xmlns="" xmlns:xsi="" ...

Get JBoss AS 7 Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.