[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Eclipselink in SE Environment not able to provide persistence
|
Hi Marco,
Where is your persistence.xml. It should be in a directory called META-INF
in the jar or directory that holds your persistence unit and that directory or
jar should be on your classpath.
If that does not help, try increasing the logging level to FINEST. What do
you see when you call Persistence.createEntityManagerFactory()?
Is eclipselink.jar on your classpath?
-Tom
JMarco wrote:
Hi!
I'm trieing to use EclipseLink in a Java 1.6 SE fat client project.
I set up a little test to try EclipseLink. Unfortunately it's not working
:(.
I get following Exception:
[EXCEPTION]
Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for EntityManager named EclipseLinkTest
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at de.eclipselinktest.RunTest.<init>(RunTest.java:12)
at de.eclipselinktest.eclipseLinkTest.main(eclipseLinkTest.java:11)
[/EXCEPTION]
Well of course I have a persistence.xml.
[persistence.xml]
<persistence-unit name="EclipseLinkTest" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="FINE"/>
<property name="eclipselink.logging.thread" value="false"/>
<property name="eclipselink.logging.session" value="false"/>
<property name="eclipselink.logging.timestamp" value="false"/>
<property name="eclipselink.logging.exceptions" value="false"/>
<!-- The following properties should be customized to run the example -->
...
[/persistence.xml]
This is my test:
[TEST]
public class RunTest {
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("EclipseLinkTest");
EntityManager em = emf.createEntityManager();
public void test() {
for(long primaryKey = 1; primaryKey < 10; primaryKey++) {
User user = em.find(User.class, primaryKey);
if (user != null) {
System.out.println(user.toString());
}
}
}
[/TEST]
If I write rubbish before <persistence-unit name> in the XML, Eclipse is
complaining so the file is not beeing ignored but something else must be
wrong.
Thx
Bye
Marco