[jboss-user] [Beginner's Corner] - JBoss:EJB is not creating table in MySQL DB

Gurubg G do-not-reply at jboss.com
Sat Jan 15 18:45:38 EST 2011

Gurubg G [http://community.jboss.org/people/gurubg] created the discussion

"JBoss:EJB is not creating table in MySQL DB"

To view the discussion, visit: http://community.jboss.org/message/580992#580992

Hello Folks, 

I have a strange problem, I am not receiving any error when I deploy my  http://www.coderanch.com/forums/f-11/EJB-JEE EJB project to  http://www.coderanch.com/forums/f-63/JBoss JBoss . 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 ?
I am using Eclipse IDE, MySQL server 51.1 and JBoss 5.0.1 server..

Please find the log attached  .. 

And I am posting the configuration files I have used.

|| *Peristence.xml* ||
| <?xml version="1.0" encoding="UTF-8" ?> 
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" 
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 <persistence-unit name="LessonDS-PU" transaction-type="JTA">
      <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/> 
</persistence> |

|| *mysql-ds.xml* ||
| <?xml version="1.0" encoding="UTF-8"?>

<!-- $Id: mysql-ds.xml 41017 2006-02-07 14:26:14Z acoliver $ -->
<!--  Datasource config for MySQL using 3.0.9 available from:

<!--    <connection-property name="autoReconnect">true</connection-property> -->
</datasources>  |

I have placed the DB conenctor file mysql-connector-java-5.1.14-bin.jar in \server\default\lib folder .. 

This is my code for Entity which I am trying to create 

|| *Entity bean* ||
package com.lessonejb.entities;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.OneToMany;


public class User implements Serializable {
          private static final CascadeType[] ALL = null;
          private String email;
          private String password;
          private String name;
          private String surname;
          private int role;
          private long userID;
          private Set <Course> coursesCreated;
          private Set <Course> coursesEnrolled;
          private Set <Test> testsCreated;
          private Set <Test> testsTaken;

           * Gets the analysis unique identifier.
           * This field is used as primary key for persistence.
           * @return analysis unique identifier
          public String getEmail()
                    return email;

           * Sets the analysis unique identifier
           * @param id unique identifier to set
          public void setEmail(String email)
                    this.email = email;

          /** Password */
          public String getPassword()
                    return password;

          public void setPassword(String email)
                    this.password = password;

          /** Name of the user */
          public String getName()
                    return name;

          public void setName(String name)
                    this.name = name;

          /** Surname of the user */
          public String getSurname()
                    return surname;

          public void setSurname(String surname)
                    this.surname = surname;

          /** Role of the user 1-Trainer, 2-Trainee, 3-Assistant*/
          public int getRole()
                    return role;

          public void setRole(int role)
                    this.role = role;

          /** Role of the user 1-Trainer, 2-Trainee, 3-Assistant*/
          public long getUserID()
                    return userID;

          public void setUserID(long userID)
                    this.userID = userID;
          }} |

But I do not see any table named "lessonuser" created in the "lessonds" database. 
Can someone point out if I am going wrong somewhere ? 

Thanks in advance .. 

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110115/1b202f99/attachment-0001.html 

More information about the jboss-user mailing list