Hi Marina,
the persistence.xml file must be in a META-INF directory reachable from
the CLASSPATH. In my test environment I have all the class files in a
classes directory. I copy the persistence.xml file to classes/META-INF
and then put the classes directory in the beginning of the CLASSPATH.
Regards Michael
> Hi Michael,
>
> Are there any rules for locating persistence.xml in this case?
>
> thanks,
> -marina
>
> Michael Bouschen wrote On 11/04/05 00:26,:
>
>>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
>>>
>>>
>