Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deploy jar with jpa Entites to Glassfish

 
Felix Jauch
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi @all,

I try to deploy a simple JPA Example on Glassfish, but the injection of my persistenceUnit fails always on this line:

@PersistenceUnit(unitName="testUnit")
private EntityManager manager;

the persistence.xml is the following:
<persistence "xmlns etc etc.">
<persistence-unit name="testUnit" transaction-type="JTA">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<jta-data-source>jdbc/MySqlDS</jta-data-source>
<properties>
<property name="toplink.ddl-generation" value="create-tables"/>
<property name="toplink.platform.class.name"
value="oracle.toplink.essentials.platform.MySQL4Platform"/>
</properties>
<jar-file>entities.jar</jar-file>
</persistence-unit>
</persistence>

The datasource MySqlDS is configured on Glassfish an the ping over the admin console works fine. This persistence.xml is in the meta-inf directory of the entities.jar. I pack the entities.jar to my ejb-module jar file (in the root) and deploy the jar contains the ejbs and entities.jar with the admin console.

But neither the database schema is generated nor the persistenceunit is available. Whats Wrong??

thanks in advanced

felix
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get rid of your entities.jar. Put the persistence.xml file in the META-INF dir of the ejb-module.jar and the entitiy classes in the root dir of the ejb-module.jar (with the session bean classes). That is the simplest way to deploy.

-Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic