Created
January 27, 2021 22:57
-
-
Save yostane/6696661eada11c3472b314edccc14e58 to your computer and use it in GitHub Desktop.
datasource vs hard coded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.2" | |
| xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> | |
| <persistence-unit name="my-persistence-unit"> | |
| <properties> | |
| <!-- database connection --> | |
| <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" /> | |
| <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/jpaForBeginners" /> | |
| <property name="javax.persistence.jdbc.user" value="postgres" /> | |
| <property name="javax.persistence.jdbc.password" value="postgres" /> | |
| </properties> | |
| </persistence-unit> | |
| </persistence> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <persistence version="2.2" | |
| xmlns="http://xmlns.jcp.org/xml/ns/persistence" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"> | |
| <persistence-unit name="prod"> | |
| <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> | |
| <properties> | |
| <property name="hibernate.show_sql" value="true" /> | |
| <property name="hibernate.format_sql" value="true"/> | |
| <property name="hibernate.hbm2ddl.auto" value="create" /> | |
| </properties> | |
| </persistence-unit> | |
| </persistence> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment