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"
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_2_0.xsd">
<persistence-unit name="LessonDS-PU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/lessonds</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLInnoDBDialect"/>
</properties>
</persistence-unit>
</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:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->
<datasources>
<local-tx-datasource>
<jndi-name>lessonds</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/lessonds</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>guru</password>
<!-- <connection-property
name="autoReconnect">true</connection-property> -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</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;
//@SuppressWarnings("serial")
@Entity
@Table(name="lessonuser")
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
*/
@Id
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 ..
Guru
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/580992#580992]
Start a new discussion in Beginner's Corner at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]