Hi all,
it's me again.
This time i encounter a warning...
my EJB still working...

here is the warning..
--------snip--------------------
[Verifier]
Bean   : ejb/entity/State
Method : public StatePK ejbFindByPrimaryKey(StatePK) throws FinderException
Section: 9.2.5
Warning: The return type of the ejbFindByPrimaryKey method must be the
primary key type.
---------------/snip-------------------

i checked the ejbFindByPrimaryKey method, it returns my primarykey class...
------------------snip--------------
public StatePK ejbFindByPrimaryKey(StatePK key) throws FinderException {
  Connection connection = null;
  PreparedStatement statement = null;
  try {
   connection = dataSource.getConnection();
   statement = connection.prepareStatement("SELECT COUNTRY_CODE FROM
dbo.STATE WHERE COUNTRY_CODE = ? AND STATE_CODE = ?");
   statement.setString(1, key.countryCode);
   statement.setString(2, key.stateCode);
   ResultSet resultSet = statement.executeQuery();
   if (!resultSet.next()) {
    throw new FinderException("Primary key does not exist");
   }
   statement.close();
   statement = null;
   connection.close();
   connection = null;
   return key;
  }
  catch(SQLException e) {
   throw new EJBException("Error executing SQL SELECT COUNTRY_CODE FROM
dbo.STATE WHERE COUNTRY_CODE = ? AND STATE_CODE = ?: " + e.toString());
  }
  finally {
   try {
    if (statement != null) {
     statement.close();
    }
   }
   catch(SQLException e) {
   }
   try {
    if (connection != null) {
     connection.close();
    }
   }
   catch(SQLException e) {
   }
  }
 }
---------------/snip--------------


Here is my StatePK Class code
-------------snip-----------------
public class StatePK implements Serializable {

    public String countryCode;
    public String stateCode;

    public StatePK() {
    }

    public StatePK(String countryCode, String stateCode) {
        this.countryCode = countryCode;
        this.stateCode = stateCode;
    }
    public boolean equals(Object obj) {
        if (this.getClass().equals(obj.getClass())) {
            StatePK that = (StatePK) obj;
            return this.countryCode.equals(that.countryCode) &&
this.stateCode.equals(that.stateCode);
        }
        return false;
    }
    public int hashCode() {
        return (countryCode + stateCode).hashCode();
    }
}

-------------/snip---------------


anyoneone knows wat going on?

Thanks
john


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to