The following is my bean UserBean:
Long id
String username
String name
public Long ejbCreate(String username, String name)
{
this.setId(new Long(0)); this.setUsername(username);
this.setName(name);
return null;
}
At first, I didn't write "this.setId(new Long(0));" as above, JBoss always print error in its console, saying "Primary key can not be null". But new row is inserted into database. After adding this statement, no error appears, and everything is ok.
So I think this statement take some role while creating.
My question is whether I can get the generated key after creating. As so far, I think it's impossible to get it, right?