<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
JBoss:EJB is not creating table in MySQL DB
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/gurubg">Gurubg G</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/580992#580992">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hello Folks, </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have a strange problem, I am not receiving any error when I deploy my <a class="jive-link-external-small" href="http://www.coderanch.com/forums/f-11/EJB-JEE" target="_new">EJB</a> project to <a class="jive-link-external-small" href="http://www.coderanch.com/forums/f-63/JBoss" target="_new">JBoss</a> . I have a single entity bean defined and expecting it to be created in MySQL DB. But strangely I do not see any table created . Has anyone faced the same problem before ?</p><p>I am using Eclipse IDE, MySQL server 51.1 and JBoss 5.0.1 server..</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Please find the log attached  .. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>And I am posting the configuration files I have used.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"><tbody><tr><th align="center" style="background-color: #6690bc;; border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong>Peristence.xml</strong></span></th></tr><tr><td style="border: 1px solid #000000;"><p><?xml version="1.0" encoding="UTF-8" ?> </p><p><span><persistence version="2.0" xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span>" </span></p><p><span>   xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" </span></p><p><span>   xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" target="_blank">http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd</a><span>"></span></p><p> <persistence-unit name="LessonDS-PU" transaction-type="JTA"></p><p> <provider>org.hibernate.ejb.HibernatePersistence</provider></p><p>  <jta-data-source>java:/lessonds</jta-data-source> </p><p>  <exclude-unlisted-classes>false</exclude-unlisted-classes></p><p>    <properties></p><p>      <property name="hibernate.hbm2ddl.auto" value="create-drop"/></p><p>      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/> </p><p>    </properties></p><p>  </persistence-unit></p><p></persistence></p></td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"><tbody><tr><th align="center" style="background-color: #6690bc;; border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong>mysql-ds.xml</strong></span></th></tr><tr><td style="border: 1px solid #000000;"><p><?xml version="1.0" encoding="UTF-8"?></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><!-- $Id: mysql-ds.xml 41017 2006-02-07 14:26:14Z acoliver $ --></p><p><!--  Datasource config for MySQL using 3.0.9 available from:</p><p><a class="jive-link-external-small" href="http://www.mysql.com/downloads/api-jdbc-stable.html" target="_blank">http://www.mysql.com/downloads/api-jdbc-stable.html</a></p><p>--></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><datasources> </p><p>  <local-tx-datasource> </p><p>  <jndi-name>lessonds</jndi-name> </p><p>  <connection-url>jdbc:mysql://localhost:3306/lessonds</connection-url> </p><p>  <driver-class>com.mysql.jdbc.Driver</driver-class> </p><p>  <user-name>root</user-name> </p><p>  <password>guru</password> </p><p><!--    <connection-property name="autoReconnect">true</connection-property> --></p><p>       <metadata> </p><p>        <type-mapping>mySQL</type-mapping> </p><p>        </metadata> </p><p>    </local-tx-datasource> </p><p></datasources> </p></td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have placed the DB conenctor file mysql-connector-java-5.1.14-bin.jar in \server\default\lib folder .. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>This is my code for Entity which I am trying to create </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><table border="1" cellpadding="3" cellspacing="0" class="jiveBorder" style="width: 100%; border: 1px solid #000000;"><tbody><tr><th align="center" style="background-color: #6690bc;; border: 1px solid #000000;background-color: #6690bc;" valign="middle"><span style="color: #ffffff;"><strong>Entity bean</strong></span></th></tr><tr><td style="border: 1px solid #000000;"><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>package com.lessonejb.entities;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import java.io.Serializable;</p><p>import java.util.Set;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>import javax.persistence.CascadeType;</p><p>import javax.persistence.Entity;</p><p>import javax.persistence.GeneratedValue;</p><p>import javax.persistence.Id;</p><p>import javax.persistence.ManyToMany;</p><p>import javax.persistence.Table;</p><p>import javax.persistence.OneToMany;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>//@SuppressWarnings("serial")</p><p>@Entity</p><p>@Table(name="lessonuser")</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public class User implements Serializable {</p><p>          private static final CascadeType[] ALL = null;</p><p>          private String email;</p><p>          private String password;</p><p>          private String name;</p><p>          private String surname;</p><p>          private int role;</p><p>          private long userID;</p><p>          private Set <Course> coursesCreated;</p><p>          private Set <Course> coursesEnrolled;</p><p>          private Set <Test> testsCreated;</p><p>          private Set <Test> testsTaken;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /**</p><p>           * Gets the analysis unique identifier.</p><p>           * This field is used as primary key for persistence.</p><p>           * @return analysis unique identifier</p><p>           */</p><p>          @Id</p><p>          public String getEmail()</p><p>          {</p><p>                    return email;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /**</p><p>           * Sets the analysis unique identifier</p><p>           * @param id unique identifier to set</p><p>           */</p><p>          public void setEmail(String email)</p><p>          {</p><p>                    this.email = email;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /** Password */</p><p>          public String getPassword()</p><p>          {</p><p>                    return password;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public void setPassword(String email)</p><p>          {</p><p>                    this.password = password;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /** Name of the user */</p><p>          public String getName()</p><p>          {</p><p>                    return name;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public void setName(String name)</p><p>          {</p><p>                    this.name = name;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /** Surname of the user */</p><p>          public String getSurname()</p><p>          {</p><p>                    return surname;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public void setSurname(String surname)</p><p>          {</p><p>                    this.surname = surname;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /** Role of the user 1-Trainer, 2-Trainee, 3-Assistant*/</p><p>          public int getRole()</p><p>          {</p><p>                    return role;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public void setRole(int role)</p><p>          {</p><p>                    this.role = role;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          /** Role of the user 1-Trainer, 2-Trainee, 3-Assistant*/</p><p>          public long getUserID()</p><p>          {</p><p>                    return userID;</p><p>          }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>          public void setUserID(long userID)</p><p>          {</p><p>                    this.userID = userID;</p><p>          }</p>}</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>But I do not see any table named "lessonuser" created in the "lessonds" database. </p><p>Can someone point out if I am going wrong somewhere ? </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks in advance .. </p><p>Guru</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/580992#580992">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>