RandomID を null にすることはできません:
乱数を生成する関数 RandomGen があります。ItkTInventory は、Master Sample Detail Form を使用して CRUD を作成したときに作成された DB Java ファイルです。[保存] ボタンのアクションを実行すると、生成された乱数を mysql の DB に挿入したいと考えています。
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
    RandomGen rand = new RandomGen();
    ItkTInventory inventory = new ItkTInventory();
    inventory.setSRandomID(rand.randomCode());
    try {
        entityManager.getTransaction().commit();
        entityManager.getTransaction().begin();
    } catch (RollbackException rex) {
        rex.printStackTrace();
        entityManager.getTransaction().begin();
        List<barcode.ItkTInventory> merged = new ArrayList<barcode.ItkTInventory>(list.size());
        for (barcode.ItkTInventory i : list) {
            merged.add(entityManager.merge(i));
        }
        list.clear();
        list.addAll(merged);
    }
}