Hi,
I'm using JBoss pre 2.1 and a MySQL database with the mm.mysql.jdbc-1.2c
driver.

I built an own PrimaryKey class, which contains just a "long id", as follows

  public class PrimaryKey implements Serializable {
    public long id;
    ...
  }

In my beans I got an id-field named id as well, e.g.

  public class AddressBean extends EntityBean {
    public long id;
    ...
  }

In the database the id (primary key) is stored as BIGINT(20).

The problem:
When I'm calling the findByPrimaryKey-method on my home interface, I'm
getting
the following SQL exception:

[Default] JBoss PRE-2.1 Started in 0m:8s
[JAWS] Exists command executing: SELECT COUNT(*) FROM adr_partner WHERE id=?
[JAWS] Set parameter: idx=1, jdbcType=BIGINT, value=100249
[JAWS] java.sql.SQLException: Cannot convert class
provantis.base.ejb.PrimaryKey to SQL type requested
[JAWS]  at
org.gjt.mm.mysql.PreparedStatement.setObject(PreparedStatement.java)
[JAWS]  at
org.gjt.mm.mysql.PreparedStatement.setObject(PreparedStatement.java)
[JAWS]  at
org.jboss.minerva.jdbc.PreparedStatementInPool.setObject(PreparedStatementIn
Pool.java:281)


The reason is that JAWS (or the MySQL JDBC driver) doesn't know how to map
my PrimaryKey-object to a BIGINT (in the setObject method).
What's to do in this case? Say bye-bye to my PrimaryKey class and use Long
instead, or is there a way to specify the mapping?

Thanx for any help on this,
Oliver Lieven

provantis IT Solutions OHG

[Address]  Siemensstr. 1, 71254 Ditzingen, Germany.
[Phone]    +49-(0)7156 - 4 36 23 - 0
[Fax]      +49-(0)7156 - 4 36 23 - 11
[E-mail]   mailto:[EMAIL PROTECTED]
[Internet] http://www.provantis.de




--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to