Autonumber Generation in Entity Bean


EJB programming & troubleshooting: Autonumber Generation in Entity Bean

  1. Autonumber Generation in Entity Bean (6 messages)

    I am creating a BMP that insert different value into my database table . one of my database column is autonumber generation on insertion of other values into database .
    I am getting EJBException in that identity not allowed .

    pls respond me how to deal with autonumber in BMP.

  2. What do you mean by auto number generation?
  3. its the same as sequence no in oracle . I am using SQL server as database and datatype of one of my column is Autonumber .
  4. What is sequence number in Oracle
  5. Can you post the finder method code? Looks like you have an incompatible type being returned for the primary key.
  6. My code is as follows

    public interface QuestionsHome extends EJBHome{
    public Questions create(String question_desc,String ans_option, String difficulty_level, String skills_id, String updated_by) throws RemoteException,CreateException;

    public Questions findByPrimaryKey(String question_id)throws RemoteException,FinderException;


    public String ejbFindByPrimaryKey(String qid) throws FinderException
        Connection cn=null;
        InitialContext ctx = new InitialContext();
         javax.sql.DataSource ds =(javax.sql.DataSource) ctx.lookup("ACESPool");
    cn = ds.getConnection();
    System.out.println("Connected to Database");
            Statement st = cn.createStatement();

       ResultSet result = st.executeQuery("SELECT * FROM ACES_QUESTIONS_MASTER WHERE QUESTION_ID=" + qid);
    }catch (Exception e)
  7. Autonumber Generation in Entity Bean[ Go to top ]

    Your findByPrimaryKey & ejbFindByPrimaryKey return values don't match - one is "Questions" & the other is "String".