Added dynamic primary key detection through reflection