Hello, I'm looking for the persistence in EJB
@PersistenceContext(name = "postgres")
private EntityManager em;
persistence.xml:
<?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="postgres" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="PostgreSQL"/>
<property name="eclipselink.logging.level" value="INFO"/>
<property name="eclipselink.jdbc.driver" value="org.postgresql.Driver"/>
<property name="eclipselink.jdbc.url" value="jdbc:postgresql://localhost:5432/thunor"/>
<property name="eclipselink.jdbc.password" value="heslo"/>
<property name="eclipselink.jdbc.user" value="persistence"/>
</properties>
</persistence-unit>
</persistence
but when I try to run the project, I'l get following errors:
java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [postgres] in the scope of the module called [Thunor]. Please verify your application.
the passwords and user works when calling from terminal
coub /tmp $ psql -U persistence thunor
Password for user persistence: *****
psql (8.4.2)
Type "help" for help.
thunor=> \q
coub /tmp $
I've googled through entire internet, and there isn't satisfying (problem solving answer).
Do anybody know where is the problem?
Thanks for answering.