Wildfly in it basic form can only support code that doesn't imply an access to a given database but when you add this fonctionnaly to your code, you have to configure your server to fullfil that fonctionnality.
These are the different steps and demonstrations on how to do so :
- Add a managment user to your wildfly server by running the add-user script into the bin directory of wildfly.
- Add a driver
- Then you can add datasource either in your browser or directly in code.
Here is a youtube tutorial on how to do the two last operations.
And then you can easily configure your persistence.xml file as it is detailed here :
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
<persistence-unit name="NOT_REQUIRED_IF_YOU_ONLY_USE_ONE" transaction-type="JTA">
<jta-data-source>NAME_OF_YOUR_DATASOURCE</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Hope it will help