Olha eu ak� de
novo...
E ai galera
blz?
Seguinte, estou usando
BMP e tive um problema quando insiro um item na tabela.
Meu
c�digo
private Integer insertRow (String
strDescription) throws SQLException
{
String insertStatement = "INSERT INTO product VALUES (?,?)";
PreparedStatement prepStmt = con.prepareStatement(insertStatement);
prepStmt.setInt (1, 0); // Estou colocando 0 por ser Autocount
prepStmt.setString (2, strDescription);
prepStmt.executeUpdate(); // Me retorna o n�mero da linha! :(
prepStmt.close();
return new Integer (0); // Ak� eu queria retornar o ID do Produto que foi
{
String insertStatement = "INSERT INTO product VALUES (?,?)";
PreparedStatement prepStmt = con.prepareStatement(insertStatement);
prepStmt.setInt (1, 0); // Estou colocando 0 por ser Autocount
prepStmt.setString (2, strDescription);
prepStmt.executeUpdate(); // Me retorna o n�mero da linha! :(
prepStmt.close();
return new Integer (0); // Ak� eu queria retornar o ID do Produto que foi
//
gerado pela tabela.
}
}
public Integer ejbCreate(String strDescription) throws CreateException
{
try
{
m_iProductID = insertRow (strDescription);
}
catch (Exception ex)
{
throw new EJBException("ejbCreate: " + ex.getMessage());
}
m_strDescription = strDescription;
return null; // Deve retornar o ID que foi gerado pela tabela (AutoCount).
}
{
try
{
m_iProductID = insertRow (strDescription);
}
catch (Exception ex)
{
throw new EJBException("ejbCreate: " + ex.getMessage());
}
m_strDescription = strDescription;
return null; // Deve retornar o ID que foi gerado pela tabela (AutoCount).
}
� isso, eu estou inserindo um
dado na tabela, sendo que o ID (Primary Key) � Autocount, s� que o ejbCreate
precisa retornar a primary key para que ele construa a interface remota... hoje
estou retornando null, assim eu n�o consigo utilizar a interface remota logo
ap�s a cria��o.
Oq eu tenho que fazer...
algu�m sabe?
Valeu galera... mais uma
vez!
Obrigado.
