Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Eclipselink in SE Environment not able to provide persistence

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
-- 
View this message in context: http://www.nabble.com/Eclipselink-in-SE-Environment-not-able-to-provide-persistence-tp21996639p21996639.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top