0 Replies Latest reply on Sep 3, 2004 7:14 AM by Sathya Sekar

    Entity bean field to database table column mapping not recog

    Sathya Sekar Newbie

      Hi,

      I am running into this issue where the server is not apparently recognizing my mapping between the EJB field and the table column.

      Here is my ejb-jar.xml segment for the bean :


      <display-name>TaskBean</display-name>

      <ejb-name>Task</ejb-name>

      com.apple.ist.test.interfaces.TaskHome
      com.apple.ist.test.interfaces.Task
      <local-home>com.apple.ist.test.interfaces.TaskLocalHome</local-home>
      com.apple.ist.test.interfaces.TaskLocal

      <ejb-class>com.apple.ist.test.ejb.TaskCMP</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Task</abstract-schema-name>
      <cmp-field >
      <field-name>taskID</field-name>
      </cmp-field>
      <cmp-field >
      <field-name>taskName</field-name>
      </cmp-field>
      <cmp-field >
      <field-name>taskDescription</field-name>
      </cmp-field>
      <primkey-field>taskID</primkey-field>


      Then in jbosscmp-jdbc.xml :


      <ejb-name>Task</ejb-name>
      <table-name>TaskNew</table-name>

      <cmp-field>
      <field-name>taskID</field-name>
      <column-name>id</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>taskName</field-name>
      <column-name>name</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>taskDescription</field-name>
      <column-name>descrpn</column-name>
      </cmp-field>


      But it doesnt seem to recognize this file at all. from the server.log :


      2004-09-03 16:08:40,820 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Task] Executing SQL: SELECT COUNT(*) FROM Task WHERE taskID=?
      2004-09-03 16:08:41,273 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Task] Executing SQL: INSERT INTO Task (taskID, taskName, taskDescription) VALUES (?, ?, ?)
      2004-09-03 16:08:41,277 ERROR [org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.Task] Could not create entity
      java.sql.SQLException: Unknown column 'taskDescription' in 'field list'
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2746)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1532)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
      at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
      at com.mysql.jdbc.Connection.execSQL(Connection.java:2204)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1777)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1871)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1796)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1658)


      The table name itself is improper. Is there anything more I need to configure ?

      Thanks.