File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 entity bean with mysql

 
Faraz Ali
Ranch Hand
Posts: 108
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I created a persistance class, and a session bean to presist the data.
Below is my persistance.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="test1">
<jta-data-source>java:/test1</jta-data-source>
</persistence-unit>
</persistence>

When i am deploying this application, it gives me error that persistance.xml is incorrect. How to fix it?

Secondly, i created tables in mysql database, now i want to configure my mysql db with ejb. how to do this?

I want all my entity bean data to be stored in mysql db. And where to place mysql driver jar file? Can you guys help me on this?

Thanks a lot.
 
Jair Rillo Junior
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey There,

First of all, give us more information, like: which exception did you get? Which Application Server you're deploying your application? Where did you put that file? (In WEB-INF/classe/META-INF/persistence.xml ??)

About the MySQL, it seems you're using a DataSource. It is working properly? If you're using the DataSource with MySQL Driver, it must be in the Applicatoin Server lib folder. If you won't to use DataSource, you must change the persistence.xml file
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic