private boolean hasPrimaryKey ( T entity ) { Object pk = getPrimaryKey ( entity ) ; if ( pk == null ) { return false ; } else { if ( pk instanceof Number && ( ( Number ) pk ) . longValue ( ) == 0 ) { return false ; } } return true ; }
Returns true if this entity s primary key is not null and for numeric fields is non - zero .