4 Replies Latest reply on Mar 19, 2008 3:46 PM by Sajith Kariyawasam

    could not insert exception in JBOSS 4.2.2 GA ...

    Sajith Kariyawasam Newbie

      Hi all ,

      im testing en Entity ( named as BookBank ) , using MySQL.

      I tested with the default database(HSQL) , and it succeeded.
      But when i configure the database to MySQL , it throws the following exception ..
      ( i placed connection pool config file "booksdb-ds.xml" in to the deploy directory of JBOSS and the

      mySQL-J connector jar file to the lib directory )
      when i used with HSQL the -ds.xml file had following properties

      , those properties i didnt include in the booksdb-ds.xml file..
      is that the cause of the problem ?

      pls help

      i have attached my Entity class , persistence.xml and part of the booksdb-ds.xml files for your consideration ...

      also please give me a good resource of "EJB3 persistance , how the configurations should be done in JBOSS , etc etc .." for a beginner

      thanks in advance

      19:25:30,000 WARN [JDBCExceptionReporter] SQL Error: 1146, SQLState: 42S02
      19:25:30,000 ERROR [JDBCExceptionReporter] Table 'b04042.bookbank' doesn't exist

      19:25:30,062 ERROR [STDERR] javax.ejb.EJBException: javax.persistence.Persistenc
      eException: org.hibernate.exception.SQLGrammarException: could not insert: [dev.
      19:25:30,062 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptio
      19:25:30,062 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(T
      19:25:30,062 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.i
      19:25:30,062 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo
      19:25:30,062 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor
      19:25:30,062 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invo

      package dev.saji.ejb.bean.entity;

      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.GenerationType;
      import javax.persistence.Id;
      import javax.persistence.Table;
      import java.io.Serializable;

      public class BookBank implements Serializable {

      long id;
      String title;
      String author;
      double price;

      public BookBank() {

      public BookBank (String title , String author , double price) {
      this.title = title;
      this.author = author;
      this.price = price;


      @GeneratedValue(strategy = GenerationType.AUTO)
      public long getId() {
      return id;

      public void setId(long id) {
      this.id = id;

      public String getTitle() {
      return title;

      public void setTitle(String title) {
      this.title = title;

      public String getAuthor() {
      return author;

      public void setAuthor(String author) {
      this.author = author;

      public double getPrice() {
      return price;

      public void setPrice(double price) {
      this.price = price;

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence-unit name="EntityBean">