persistence@glassfish.java.net

Re: J2SE example with toplink-essentials

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 03 Apr 2006 09:09:01 -0700

Great!

-marina

Jakob Braeuchi wrote:
> hi marina,
>
> it works with milestone 6.
>
> jakob
>
> Marina Vatkina schrieb:
>
>> Hi Jakob,
>>
>> Yes, milestone 5 build is very old.
>>
>> regards,
>> -marina
>>
>> Jakob Braeuchi wrote:
>>
>>> hi marina,
>>>
>>> i used milestone 5, but i'll give milestone 6 a try.
>>>
>>> thanks
>>> jakob
>>>
>>> Marina Vatkina schrieb:
>>>
>>>> Jakob,
>>>>
>>>> Please use the latest GlassFish build.
>>>>
>>>> thanks,
>>>> -marina
>>>>
>>>> Jakob Braeuchi wrote:
>>>>
>>>>> hi,
>>>>>
>>>>> i tried to run the example shown on this page:
>>>>> https://glassfish.dev.java.net/javaee5/persistence/entity-persistence-support.html#Java_SE
>>>>>
>>>>>
>>>>> i had some problems with an NPE when i create the entityManager
>>>>> withoud
>>>>> an additional map:
>>>>>
>>>>> Persistence.createEntityManagerFactory("pu1");
>>>>>
>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>> at
>>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:140)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:282)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:301)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:338)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:78)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.getServerSession(EntityManagerFactoryProvider.java:251)
>>>>>
>>>>> at
>>>>> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:96)
>>>>>
>>>>> at
>>>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:59)
>>>>>
>>>>> at
>>>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
>>>>>
>>>>> at client.Client.main(Client.java:48)
>>>>>
>>>>>
>>>>> Persistence.createEntityManagerFactory("pu1", new HashMap()); works.
>>>>>
>>>>> another problem is the the persistence.xml shown on the same page.
>>>>>
>>>>> the properties prefixed with toplink did not work for me:
>>>>>
>>>>> <property name="toplink.jdbc.driver" value="<database driver>"/>
>>>>> <property name="toplink.jdbc.url" value="<database url>"/>
>>>>> <property name="toplink.jdbc.user" value="<user>"/>
>>>>> <property name="toplink.jdbc.password" value="<password>"/>
>>>>>
>>>>> whith these properties (without toplink prefix) the example ran fine:
>>>>>
>>>>> <property name="toplink.platform.class.name"
>>>>> value="oracle.toplink.essentials.platform.database.MySQL4Platform"/>
>>>>>
>>>>> <property name="jdbc.driver" value="com.mysql.jdbc.Driver"/>
>>>>> <property name="jdbc.connection.string"
>>>>> value="jdbc:mysql://localhost:3306/mydb"/>
>>>>> <property name="jdbc.user" value="myuser"/>
>>>>> <property name="jdbc.password" value="mypwd"/>
>>>>>
>>>>>
>>>>> jakob braeuchi
>>>>
>>>>
>>>>
>>>>
>>
>>