File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB 3.0 entity bean with mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 3.0 entity bean with mysql" Watch "EJB 3.0 entity bean with mysql" New topic
Author

EJB 3.0 entity bean with mysql

Faraz Ali
Ranch Hand

Joined: May 15, 2008
Posts: 108
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

Joined: Aug 27, 2008
Posts: 114
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


Regards, Jair Rillo Junior
http://www.jairrillo.com/blog, SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 5.0, IBM SOA Associate (Test 664).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB 3.0 entity bean with mysql