Make sure type doesn't have null value. Otherwise, got hibernate error