0 Replies Latest reply on Sep 29, 2003 5:01 PM by gonzaljo

    getPrimaryKey() with auto-increment

    gonzaljo Newbie

      Hi there


      I have a Entity bean with auto-increment pk-field on MS SQLSERVER2000. The bean will be created, but the PK (that is defined as Long) will set as BigDecimal.

      If i reload the bean, then the PK-Field will be set correctly. So i create a small Workarround:

      obj = jndiContext.lookup("Unit");
      UnitHome shome = (UnitHome)PortableRemoteObject.narrow(obj,
      UnitHome.class);

      Unit Unit = shome.create("MasterUnit", new Double(2.231));

      Unit = shome.findByPrimaryKey(new Long(((BigDecimal)Unit.getPrimaryKey()).longValue()));

      Everybody knows another way to do this?


      Thanks