Que banco de dados vc est� utilizando ?
Abra�[]s,
Max Ricardo
Mercurio Ribeiro
IT & Business
Consultant for Alcoa Company
e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> (company) / [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> (personal)
phones # : (0x11) 9101-5511 mob. / (0x11) 3741-4418
com.
-----Original Message-----
From: Artur Lu�s [mailto:[EMAIL PROTECTED]]
Sent: Friday, 24 de January de 2003 11:25 AM
To: [EMAIL PROTECTED]
Subject: [enterprise-list] Usando BMP em tabela com registro autocountOlha eu ak� de novo...E ai galera blz?Seguinte, estou usando BMP e tive um problema quando insiro um item na tabela.Meu c�digoprivate 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// 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).
}� 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.
