Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA persistence.xml PostgreSQL

843830Feb 4 2010 — edited Feb 6 2010
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2010
Added on Feb 4 2010
3 comments
3,914 views