Re: Java Persistence API and persistence.xml
On Sun, 16 Mar 2008 00:53:01 +0100, CK wrote:
Also, there is no datasource here, although I do not know whether you
actually need one when using the embedded derby db.
Oh, and does the database scheme exist already? I think you need to
create the scheme the tables and so on are created for you, but I
cannot say for sure.
Hope this helps, please report back if it does and also if it does
not.
I got it working. I actually tried to cancel this post, but it was
already out the door.
Anyway, your post was helpful. I got the system to create the schema for
me. The file is actually quite close to what was necessary. The problems
were mainly in the XML file above. I'll post the result here so that it
goes to the search engines.
This gets things working with Glassfish and Derby.
Thanks!
-----
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="EmployeeService" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<class>javapersistence.Employee</class>
<properties>
<property name="toplink.jdbc.driver"
value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="toplink.jdbc.url"
value="jdbc:derby:MyTestDb;create=true"/>
<property name="toplink.jdbc.user" value="APP" />
<property name="toplink.jdbc.password" value="APP" />
<!-- Java2DB properties, creates the tables -->
<property name="toplink.ddl-generation" value="create-tables" />
</properties>
</persistence-unit>
</persistence>
-----
--
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>