persistence@glassfish.java.net

Re: Out-of-container example?

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Fri, 04 Nov 2005 09:26:58 +0100

Hi Marina,

> Hi Michael,
>
> Thanks for the example. Just to make sure I understand it correctly,
> "<driver>" is to be substituted with my driver class com.database.MyDriver,
> etc., right?

Yes that's right, e.g. it is oracle.jdbc.driver.OracleDriver in case of
an oracle database.

Regards Michael

>
> thanks,
> -marina
>
> Michael Bouschen wrote:
>
>
>>Hi Marina,
>>
>>attached you find a Main.java and a persistence.xml.
>>
>>Class Main implements a main method that creates EMF, EM, starts a tx,
>>persists a new Customer, commits the tx and then runs an EJBQL query.
>>The persistence.xml lists the persistent classes from the application
>>domain, e.g. oracle.toplink.examples.Customer, etc. I added the values
>>for jdbc driver name, url, anme and password as <driver>, <url>, etc.
>>This needs to be changed according to the local environment.
>>
>>You need to add the -javaagent option to the jvm call:
>> java -javaagent:${glassfish.home}/lib/toplink-essentials-agent.jar Main
>>
>>In addition to the jdbc driver I have the following jars from the
>>{glassfish.home}/lib directory in the classpath: asm.jar,
>>toplink-essentials.jar, antlr.jar, javaee.jar.
>>
>>I hope this helps.
>>
>>Regards Michael
>>
>>
>>>Michael, Tom,
>>>
>>>Can you give an example of persistence.xml
>>>and a main() method that constructs emf for
>>>a Java SE persistence?
>>>
>>>It'll be helpful to put this on the Entity
>>>Persistence web page.
>>>
>>>thanks,
>>>-marina
>>>
>>
>> --------------------------------------------------------------------------------
>> Name: Main.java
>> Main.java Type: Plain Text (text/plain)
>> Encoding: 7BIT
>>
>> Name: persistence.xml
>> persistence.xml Type: text/xml
>> Encoding: 7BIT
>
>